Show grid when no series is active

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
BigAl66
Newbie
Newbie
Posts: 2
Joined: Thu Jul 11, 2019 12:00 am

Show grid when no series is active

Post by BigAl66 » Sun Sep 27, 2020 8:28 am

Hi together,

what always bothers me is, that the chart's grid an axes are turned of, when no series is active. Is there a way to overcome this? I have applications that dynamically create and destroy series. The min/max etc. of the axes are configured (automatic = off). Why does TChart turn off all axes and grids? How can I force TChart to draw them even if no series is active?

Thanks

Alex

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

Re: Show grid when no series is active

Post by Yeray » Wed Sep 30, 2020 7:30 am

Hello Alex,

TeeChart doesn't draw an axis when no series uses it and LabelStyle is set to its default value: talAuto.
Also, you may want to set some min and max. Ie:

Code: Select all

  Chart1.Axes.Bottom.SetMinMax(0,10);
  Chart1.Axes.Bottom.LabelStyle:=talValue;

  Chart1.Axes.Left.SetMinMax(0,10);
  Chart1.Axes.Left.LabelStyle:=talValue;
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

BigAl66
Newbie
Newbie
Posts: 2
Joined: Thu Jul 11, 2019 12:00 am

Re: Show grid when no series is active

Post by BigAl66 » Tue Oct 06, 2020 9:48 pm

Hi Yeray,

thank you very much. This works :-). Only one thing: How can I force the bottom axis to display datetime values if no series is active? The bottom axis shows the number instead of the value and I'm not able to set the datetime format (hh:nn:ss) but the numeric format..

I could live with that - it's much better than before. But if there is a solution to force the display of the datetime format it would be perfect :-).

Alex

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

Re: Show grid when no series is active

Post by Yeray » Wed Oct 07, 2020 11:07 am

Alex,

The only way to achieve this is by adding a dummy series (with no data) as follows:

Code: Select all

  Chart1.AddSeries(TPointSeries).XValues.DateTime:=True;
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