Hello,
I am using TContourSeries for GIS system.
I am adding a TChartImageTool on my chart .Image is the map and map have real base co-ordinates. Default chart assign to image co-ordinates Axis.Maximum and Axis.Minimum. How to connect chart and real image co-ordinates ?
Thank you
How to connect chart and real image co-ordinates ?
Hi, Juri
Or alternatively, you can simply draw image directly on chart Canvas in TChart.OnBeforeDrawSeries event (or other even, depending if you want image behind or in front of series). The following code should give you an idea:
True, if image tool is not connected to series. Otherwise the series minimum and maximum x and y values are being used. This is all done in TChartImageTool.ChartEvent method. To customize this (be able to define image position and width/height, expressed in real values), you should override and change this method implementation.Default chart assign to image co-ordinates Axis.Maximum and Axis.Minimum
Or alternatively, you can simply draw image directly on chart Canvas in TChart.OnBeforeDrawSeries event (or other even, depending if you want image behind or in front of series). The following code should give you an idea:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.LeftAxis.SetMinMax(0,10);
Chart1.BottomAxis.SetMinMax(0,10);
end;
procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var R: TRect;
begin
With Chart1.Canvas do
begin
R.Bottom := Chart1.LeftAxis.CalcYPosValue(5.5);
R.Top := Chart1.LeftAxis.CalcYPosValue(15.5);
R.Left:= Chart1.BottomAxis.CalcXPosValue(3.5);
R.Right:= Chart1.BottomAxis.CalcXPosValue(12.5);
ClipRectangle(Chart1.ChartRect);
StretchDraw(R,Image1.Picture.Graphic);
UnclipRectangle;
end;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com