Page 1 of 1
Series - show axes only = (not) "invisible" series
Posted: Wed Sep 03, 2014 5:08 pm
by 16467044
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
Re: Series - show axes only = (not) "invisible" series
Posted: Thu Sep 04, 2014 3:11 pm
by yeray
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 (10.31 KiB) Viewed 7626 times
Re: Series - show axes only = (not) "invisible" series
Posted: Thu Sep 04, 2014 5:56 pm
by 16467044
Hi Yeray,
thank you so much for this genius and complete solution!
Warm Regards,
Cheryll
Re: Series - show axes only = (not) "invisible" series
Posted: Fri Sep 05, 2014 7:00 am
by yeray
Hi Cheryll,
Chartist wrote:thank you so much for this genius and complete solution!
You're welcome!