How to check if custom axis is visible

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Technicon
Newbie
Newbie
Posts: 43
Joined: Thu Aug 11, 2016 12:00 am
Contact:

How to check if custom axis is visible

Post by Technicon » Mon Nov 14, 2016 6:51 am

Hi,

I try to manage custom axis on a screen. To prepare free space for axis I had to detect if it's visible on the screen. I know that axis should have visible property set to true and It should have active series attache to.
But there is one situation that I can't figure out. When eg. I have 3 series each one is connected to another axis, then I deactivate series one by one the axis from last deactivated series stays visible (when there is no active series).

How to check if custom axis is really visible?

Best Regards,
Grzegorz

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

Re: How to check if custom axis is visible

Post by Yeray » Mon Nov 14, 2016 1:30 pm

Hello Grzegorz,

I've tried to reproduce the problem with the simple example below but it seems to work fine for me here.
I'm adding several series, each one with its custom vertical axis. I'm hiding the walls and all the axes except the bottom axis and the custom vertical axes. Then, I've added a checkbox that deactivates/activates all the series, the custom vertical axes and the bottom axis:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmpAxis: TChartAxis;
begin
  Chart1.Legend.Visible:=false;
  Chart1.View3D:=false;
  CheckBox1.Checked:=true;

  for i:=0 to Chart1.AxesList.Count-1 do
    if Chart1.Axes[i]<>Chart1.Axes.Bottom then
      Chart1.Axes[i].Visible:=false;

  for i:=0 to 3 do
  begin
    tmpAxis:=Chart1.CustomAxes.Add;
    tmpAxis.Horizontal:=false;

    with Chart1.AddSeries(TFastLineSeries) as TFastLineSeries do
    begin
      FillSampleValues;
      CustomVertAxis:=tmpAxis;
    end;
  end;

  Chart1.Walls.Visible:=false;
  Chart1.MarginLeft:=10;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.SeriesCount-1 do
  begin
    Chart1[i].Active:=CheckBox1.Checked;
    Chart1[i].CustomVertAxis.Visible:=Chart1[i].Active;
  end;

  Chart1.Axes.Bottom.Visible:=CheckBox1.Checked;
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

Technicon
Newbie
Newbie
Posts: 43
Joined: Thu Aug 11, 2016 12:00 am
Contact:

Re: How to check if custom axis is visible

Post by Technicon » Tue Nov 15, 2016 12:04 pm

Hello

Ok now I see what I'm doing wrong. When custom axis doesn't have active series attached are hidden, but when there is no active series on a chart all axis are visible, but I didn't notice this because they all have the same position and they overlap each other.

Best Regards,
Grzegorz

Post Reply