Page 1 of 1

Show grid when no series is active

Posted: Sun Sep 27, 2020 8:28 am
by 16586564
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

Re: Show grid when no series is active

Posted: Wed Sep 30, 2020 7:30 am
by yeray
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;

Re: Show grid when no series is active

Posted: Tue Oct 06, 2020 9:48 pm
by 16586564
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

Re: Show grid when no series is active

Posted: Wed Oct 07, 2020 11:07 am
by yeray
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;