Chart resizes when line is emphasized

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
például
Newbie
Newbie
Posts: 6
Joined: Wed May 23, 2012 12:00 am

Chart resizes when line is emphasized

Post by például » 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:

---------------------

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.
Attachments
TeeResizing.zip
Simple example to demonstrate unwanted resizing
(1.98 KiB) Downloaded 347 times

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chart resizes when line is emphasized

Post by Yeray » Fri Mar 07, 2014 3:34 pm

Hello,
peldaul wrote:only turning off Chart.Axes.<>.Automatic helped - but then the normal chart sizing when showing different content doesn't happen either.
I tried this and it seems to work fine for me. I'm not sure to understand what's the problem with it:

Code: Select all

procedure TForm2.Button1Click(Sender: TObject);
begin
 filllinechart(true);
 Chart1.Draw;
 Chart1.Axes.Left.Automatic:=false;
 Chart1.Axes.Bottom.Automatic:=false;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

például
Newbie
Newbie
Posts: 6
Joined: Wed May 23, 2012 12:00 am

Re: Chart resizes when line is emphasized

Post by például » Fri Mar 07, 2014 5:50 pm

Hello Yeray,

Thank you for looking into this. The problem is, that whenever I hover over a line, the whole chart resizes a bit. I would like the line to get emphasized, but not to have the chart resized at the same time. To better illustrate my point I uploaded an example (in Delphi 2007 using an older version of TeeChart) that works well (no resizing).
Attachments
OldVersion.zip
Two exe examples
(1.59 KiB) Downloaded 365 times

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chart resizes when line is emphasized

Post by Yeray » Mon Mar 10, 2014 3:35 pm

Hello,

I could reproduce the problem here thanks to the project you sent.
We're studying what's the best way to fix it. We'll be back to you asap.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply