Series - show axes only = (not) "invisible" series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

Series - show axes only = (not) "invisible" series

Post by Chartist » Wed Sep 03, 2014 5:08 pm

Hi,

I want to draw an "emtpy" chart with the axes only.
You key in e.g. value 33 as lower value and 909 as upper value, - and TCharts draws a nice emtpy window from (in my case left axes) 33 to 909.

My problem is "empty window".
If I set the series to invisible, the annonation of the y-axes is will be gone as well.
If I set it to visible, the chart window is not empty any more, but the series is drawn.

Is there a style for my series which makes its drawing invisible and keeps the annonation at the axes?
I rather would prefer to see the y-axes only and x-axes empty as well.
And in my highest phantasies the grid above the not visible series is visible.

Thanks,
Cheryll
Cheryll

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

Re: Series - show axes only = (not) "invisible" series

Post by Yeray » Thu Sep 04, 2014 3:11 pm

Hi Cheryll,
Chartist wrote:I want to draw an "emtpy" chart with the axes only.
You key in e.g. value 33 as lower value and 909 as upper value, - and TCharts draws a nice emtpy window from (in my case left axes) 33 to 909.

My problem is "empty window".
If I set the series to invisible, the annonation of the y-axes is will be gone as well.
If I set it to visible, the chart window is not empty any more, but the series is drawn.

Is there a style for my series which makes its drawing invisible and keeps the annonation at the axes?
What about having a "dummy series"? It would be a series without any values. Ie:

Code: Select all

uses Series, TeCanvas;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.AddSeries(TFastLineSeries);
  Chart1.Axes.Left.SetMinMax(33,909);
  Chart1.Axes.Bottom.SetMinMax(0,100);
end;
Chartist wrote:I rather would prefer to see the y-axes only and x-axes empty as well.
And in my highest phantasies the grid above the not visible series is visible.
Have you tried hiding the bottom axis labels?

Code: Select all

  Chart1.Axes.Bottom.Labels:=false;
Here the complete code of an example I just made to check it:

Code: Select all

uses Series, TeCanvas;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.AddSeries(TFastLineSeries);
  Chart1.Axes.Left.SetMinMax(33,909);
  Chart1.Axes.Bottom.SetMinMax(0,100);

  Chart1.Axes.Bottom.Labels:=false;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var tmpLeft, tmpRight, tmpTop, tmpBottom: Integer;
begin
  tmpLeft:=Chart1.Axes.Bottom.CalcPosValue(45);
  tmpRight:=Chart1.Axes.Bottom.CalcPosValue(55);
  tmpTop:=Chart1.Axes.Left.CalcPosValue(400);
  tmpBottom:=Chart1.Axes.Left.CalcPosValue(500);

  Chart1.Canvas.Brush.Style:=bsClear;
  Chart1.Canvas.Rectangle(tmpLeft, tmpTop, tmpRight, tmpBottom);
end;
I'm drawing a rectangle with OnAfterDraw event to check the bottom axis has the correct minimum and maximum values. Because once you hide the labels, you loose that reference.
2014-09-04_1710.png
2014-09-04_1710.png (10.31 KiB) Viewed 7358 times
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

Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

Re: Series - show axes only = (not) "invisible" series

Post by Chartist » Thu Sep 04, 2014 5:56 pm

Hi Yeray,

thank you so much for this genius and complete solution!

Warm Regards,
Cheryll
Cheryll

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

Re: Series - show axes only = (not) "invisible" series

Post by Yeray » Fri Sep 05, 2014 7:00 am

Hi Cheryll,
Chartist wrote:thank you so much for this genius and complete solution!
You're welcome! :)
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