TChart 2010 VCL - Bug in TColorLineTool
Posted: Wed May 19, 2010 2:17 am
I think I have run into a bug with the TColorLineTool when zooming and unzooming a chart. Here is some sample code that you can use to repro the bug. This was done using the new TChart 2010 VCL with Delphi 2007. Machine is running Windows Vista Ultimate, 32-bit, 4GB ram.
The sample will create a simple bar chart with 4 TColorLines with different colors. Zoom in and out several times and you will notice that some of the lines will start to disappear after zooming out even though they should be visible. If you look closer you will see that what is actually happening is the line's value is being changed and in fact the line is visible. It's just merged with another line because it's value is now the same as the other line. If you zoom in and out enough, eventually you will end up with a single line (actually all 4 lines having the same value).
Unless I'm mistaken, I don't think this should be happening. Please advise.
Thanks
Scott
Code: Select all
procedure TForm6.FormCreate(Sender: TObject);
var i,j: Integer;
tmpColorLine: TColorLineTool;
begin
Chart1.AddSeries(TBarSeries.Create(Self));
for i:=0 to 50 do
Chart1[0].Add(10*i);
tmpColorLine:=TColorLineTool.Create(Self);
tmpColorLine.Axis:=Chart1.Axes.Left;
tmpColorLine.Value:=100;
tmpColorLine.Pen.Color:=clRed;
tmpColorLine.Pen.Width:=2;
Chart1.Tools.Add(tmpColorLine);
tmpColorLine:=TColorLineTool.Create(Self);
tmpColorLine.Axis:=Chart1.Axes.Left;
tmpColorLine.Value:=200;
tmpColorLine.Pen.Color:=clGreen;
tmpColorLine.Pen.Width:=2;
Chart1.Tools.Add(tmpColorLine);
tmpColorLine:=TColorLineTool.Create(Self);
tmpColorLine.Axis:=Chart1.Axes.Left;
tmpColorLine.Value:=300;
tmpColorLine.Pen.Color:=clBlue;
tmpColorLine.Pen.Width:=2;
Chart1.Tools.Add(tmpColorLine);
tmpColorLine:=TColorLineTool.Create(Self);
tmpColorLine.Axis:=Chart1.Axes.Left;
tmpColorLine.Value:=400;
tmpColorLine.Pen.Color:=clBlack;
tmpColorLine.Pen.Width:=2;
Chart1.Tools.Add(tmpColorLine);
end;
Unless I'm mistaken, I don't think this should be happening. Please advise.
Thanks
Scott