[Lazarus] TAChart 2nd Y Axis
David M. Lawrence
dave at fuzzo.com
Thu Jul 28 05:32:30 CEST 2011
Was the 2nd-Y axis patch (No. 13832;
http://bugs.freepascal.org/view.php?id=13832) ever incorporated into the
Lazarus/TAChart release? I'm new to Lazarus and don't quite know how to
interpret the bugtracker page. I do know that I cannot find some of the
changes mentioned in the patches -- such as for TAGraph -- in the latest
version of TAGraph.
I do scientific programming and am trying to update some of my older
Delphi/Pascal programs. I need the ability to independently set YMax
and YMin values for both Y axes on climate diagrams (which plot both
monthly precipitation and temperature data) on the same chart.
Precipitation data are plotted as bar graphs, temperature data are
plotted by line series. I can get all the data series plotted, but I
cannot get the precip and temp data scaled properly.
In the older version of my program (which used Delphi/Teechart), I had
the precipitation axes set from 0 to 30 cm and the temperature axes set
from -90 to 60 degrees centigrade.
If this list accepts attachments, I can forward a wmf with an actual
chart. Here's the current version of the plotting procedure:
procedure TCLIMatePLOTForm.CLIMPLOTButtonClick(Sender: TObject);
var
Mnth: integer;
begin
ClimateDataChart.Title.Text.Clear;
Series_mpr.Clear;
LineSeries_mt.Clear;
LineSeries_mxt.Clear;
LineSeries_mnt.Clear;
with ClimateDataChart.Title.Text do
Add(SiteName);
if lat < 0 then begin
with LineSeries_mt do begin
for Mnth := 7 to 12 do
Add(mt[Mnth], AbMonth[Mnth], clPurple);
for Mnth := 1 to 6 do
Add(mt[Mnth], AbMonth[Mnth], clPurple);
end;
with LineSeries_mxt do begin
for Mnth := 7 to 12 do
Add(mxt[Mnth], AbMonth[Mnth], clRed);
for Mnth := 1 to 6 do
Add(mxt[Mnth], AbMonth[Mnth], clRed);
end;
with LineSeries_mnt do begin
for Mnth := 7 to 12 do
Add(mnt[Mnth], AbMonth[Mnth], clBlue);
for Mnth := 1 to 6 do
Add(mnt[Mnth], AbMonth[Mnth], clBlue);
end;
with Series_mpr do begin
for Mnth := 7 to 12 do
if PrecipData <> 1 then
Add((mpr[Mnth]/10), AbMonth[Mnth], clAqua)
else
Add(0, AbMonth[Mnth], clAqua);
for Mnth := 1 to 6 do
if PrecipData <> 1 then
Add((mpr[Mnth]/10), AbMonth[Mnth], clAqua)
else
Add(0, AbMonth[Mnth], clAqua);
end;
end else begin
with LineSeries_mt do
for Mnth := 1 to 12 do
Add(mt[Mnth], AbMonth[Mnth], clPurple);
with LineSeries_mxt do
for Mnth := 1 to 12 do
Add(mxt[Mnth], AbMonth[Mnth], clRed);
with LineSeries_mnt do
for Mnth := 1 to 12 do
Add(mnt[Mnth], AbMonth[Mnth], clBlue);
with Series_mpr do
for Mnth := 1 to 12 do
if PrecipData <> 1 then
Add((mpr[Mnth]/10), AbMonth[Mnth], clAqua)
else
Add(0, AbMonth[Mnth], clAqua);
end;
end;
--
Here's the form file:
object CLIMatePLOTForm: TCLIMatePLOTForm
Left = 881
Height = 535
Top = 152
Width = 345
Caption = 'CLIMatePLOT'
ClientHeight = 515
ClientWidth = 345
Color = clSilver
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Menu = PlotMenu
OnClose = FormClose
OnCreate = FormCreate
LCLVersion = '0.9.30'
Visible = True
object ClimateDataChart: TChart
Left = 16
Height = 401
Top = 16
Width = 312
AllowZoom = False
AxisList = <
item
Title.Clipped = False
Title.LabelFont.Orientation = 900
Title.Visible = True
Title.Caption = 'Average precipitation (cm)'
end
item
Alignment = calBottom
Title.Caption = 'Month'
end
item
Alignment = calRight
Title.LabelFont.Orientation = 900
Title.Visible = True
Title.Caption = 'Average temperature (°C)'
end>
Extent.YMax = 30
Extent.UseYMin = True
Extent.UseYMax = True
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Legend.UseSidebar = False
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlack
Title.Font.Height = -11
Title.Font.Name = 'Arial'
Title.Text.Strings = (
''
)
Title.Visible = True
Color = clNone
ParentColor = False
object Series_mpr: TBarSeries
Title = 'Precipitation'
AxisIndexX = 1
AxisIndexY = 0
BarBrush.Color = clAqua
UseReticule = True
end
object LineSeries_mt: TLineSeries
Marks.Visible = False
Title = 'Mean temperature'
AxisIndexY = 2
LinePen.Color = clGreen
LinePen.Width = 2
Pointer.Visible = False
end
object LineSeries_mxt: TLineSeries
Marks.Visible = False
Title = 'Maximum temperature'
LinePen.Color = clRed
LinePen.Width = 2
Pointer.Visible = False
end
object LineSeries_mnt: TLineSeries
Marks.Visible = False
Title = 'Minimum temperature'
LinePen.Color = clBlue
LinePen.Width = 2
Pointer.Visible = False
end
end
object ExitChartButton: TButton
Left = 184
Height = 33
Top = 432
Width = 137
Caption = 'Exit chart'
OnClick = ExitChartButtonClick
TabOrder = 1
end
object CLIMPLOTButton: TButton
Left = 24
Height = 33
Top = 432
Width = 137
Caption = 'Plot climate data'
OnClick = CLIMPLOTButtonClick
TabOrder = 2
end
object PlotMenu: TMainMenu
left = 8
top = 448
object File1: TMenuItem
Caption = '&File'
object Save1: TMenuItem
Caption = '&Save...'
OnClick = Save1Click
end
object N2: TMenuItem
Caption = '-'
end
object Print1: TMenuItem
Caption = '&Print...'
OnClick = Print1Click
end
object PrintSetup1: TMenuItem
Caption = 'P&rint Setup...'
OnClick = PrintSetup1Click
end
object N1: TMenuItem
Caption = '-'
end
object Exit1: TMenuItem
Caption = 'E&xit'
OnClick = ExitChartButtonClick
end
end
end
object ChartSaveDialog: TSaveDialog
DefaultExt = '.wmf'
left = 104
top = 448
end
object PrintDialog: TPrintDialog
left = 40
top = 448
end
object PlotPrintSetupDialog: TPrinterSetupDialog
left = 72
top = 448
end
object mprChartSource: TUserDefinedChartSource
OnGetChartDataItem = mprChartSourceGetChartDataItem
left = 80
top = 40
end
object mtChartSource: TUserDefinedChartSource
OnGetChartDataItem = mtChartSourceGetChartDataItem
left = 184
top = 104
end
object mxtChartSource: TUserDefinedChartSource
OnGetChartDataItem = mxtChartSourceGetChartDataItem
left = 128
top = 168
end
object mntChartSource: TUserDefinedChartSource
OnGetChartDataItem = mntChartSourceGetChartDataItem
left = 240
top = 224
end
object MnthChartSource: TUserDefinedChartSource
left = 160
top = 344
end
end
--
Thank you very much for your time.
Sincerely,
Dave Lawrence
--
------------------------------------------------------
David M. Lawrence | Home: (804) 559-9786
7471 Brook Way Court | Fax: (804) 559-9787
Mechanicsville, VA 23111 | Email: dave at fuzzo.com
USA | http: http://fuzzo.com
------------------------------------------------------
"All drains lead to the ocean." -- Gill, Finding Nemo
"We have met the enemy and he is us." -- Pogo
"No trespassing
4/17 of a haiku" -- Richard Brautigan
More information about the Lazarus
mailing list