Chart resizes when line is emphasized
Posted: Thu Mar 06, 2014 7:58 pm
In the line chart when the cursor hovers over a line, the width of the line is changed programmatically, to emphasize the line. In TeeChart 9.0.10 (2014 but also versions from 2013) this results in the chart being resized slightly, so the wider line fits. In older versions (8.0.6 definitely) this doesn't happen, and I would like to eliminate this behavior. I tried to change the situation by leaving margin space or playing around with minimums and maximums but so far only turning off Chart.Axes.<>.Automatic helped - but then the normal chart sizing when showing different content doesn't happen either.
Is there a way to turn this behavior off?
Attached is an example (I included the source code too below) that shows this behavior in the newer versions of TeeChart. Just click on the button to populate the cart, and then hover over the lines to see the jiggling:
---------------------
Is there a way to turn this behavior off?
Attached is an example (I included the source code too below) that shows this behavior in the newer versions of TeeChart. Just click on the button to populate the cart, and then hover over the lines to see the jiggling:
---------------------
Code: Select all
unit TeeTest;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VclTee.TeeGDIPlus, VCLTee.TeEngine,
Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart, VCLTee.Series, Vcl.StdCtrls;
type
TForm2 = class(TForm)
Chart1: TChart;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure FillLineChart(ReloadDataOnly : Boolean);
procedure LineSeriesMouseEnter(Sender: TObject);
procedure LineSeriesMouseLeave(Sender: TObject);
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
filllinechart(true);
end;
procedure TForm2.FillLineChart(ReloadDataOnly : Boolean);
var
iRow, iCol : integer;
pSeries :TLineSeries;
begin
Chart1.Axes.Bottom.Title.Caption := ' ';
for iRow := 0 to 6 do begin
pSeries := TLineSeries.Create ( Chart1 );
pSeries.LinePen.Width := 2;
pSeries.ParentChart := Chart1;
pSeries.Title := 'Series' + intToStr(iRow);
pSeries.XValues.DateTime := FALSE;
pSeries.OnMouseEnter := LineSeriesMouseEnter;
pSeries.OnMouseLeave := LineSeriesMouseLeave;
for iCol := 0 to 6 do
pSeries.AddXY(iCol,icol + iRow, 'Point' + intToStr(iCol), clTeeColor);
end;
end;
procedure Tform2.LineSeriesMouseEnter(Sender: TObject);
var
ALineSeries : TLineSeries;
begin
ALineSeries := TLineSeries(Sender);
Chart1.Axes.Bottom.Title.Caption := ALineSeries.Title;
ALineSeries.LinePen.Width := 8;
end;
procedure Tform2.LineSeriesMouseLeave(Sender: TObject);
var
ALineSeries : TLineSeries;
begin
ALineSeries := TLineSeries(Sender);
Chart1.Axes.Bottom.Title.Caption := ' ';
ALineSeries.LinePen.Width := 2;
end;
end.