CustomVertaxis of High-Low series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
skng
Newbie
Newbie
Posts: 7
Joined: Thu Aug 07, 2014 12:00 am

CustomVertaxis of High-Low series

Post by skng » Wed Oct 01, 2014 6:30 pm

Hi,

How to overcome the access violation error, when I set customVertAxis of High-Low Series to not visible.

Code: Select all

HLSeries->CustomVertAxis->Visible = false;  // access violation error
How to create custom axis (type TChartAxis *) during the runtime? (I have to do this, when I add new series to the chart during the run time) ?
How to access the above custom axis, which were created during the run time ?

Thanks in advance,

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

Re: CustomVertaxis of High-Low series

Post by Yeray » Thu Oct 02, 2014 11:00 am

Hello,
skng wrote:How to overcome the access violation error, when I set customVertAxis of High-Low Series to not visible.
I think that shouldn't happen. Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
skng wrote:How to create custom axis (type TChartAxis *) during the runtime?
Here you have a simple example in Delphi:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i := 0 to 3 do
  begin
    Chart1.AddSeries(TLineSeries);
    Chart1[Chart1.SeriesCount-1].FillSampleValues(1000);
    Chart1.CustomAxes.Add;
    Chart1[Chart1.SeriesCount-1].CustomVertAxis := Chart1.CustomAxes.Items[Chart1.CustomAxes.Count-1];
    Chart1.CustomAxes.Items[Chart1.CustomAxes.Count-1].StartPosition := i * 25;
    Chart1.CustomAxes.Items[Chart1.CustomAxes.Count-1].EndPosition := (i+1) * 25;
  end;

  Chart1.View3D := false;
  Chart1.Title.Visible := false;
  Chart1.Legend.Visible := false;
  Chart1.MarginLeft := 10;
end;
skng wrote:(I have to do this, when I add new series to the chart during the run time) ?
No you don't need to. It depends on how you want your series to be positioned in the chart area.
When you create a new series, it uses the default axes (Left, Bottom and Depth if the series is 3D). Then, if you have two series using the same axes, by default the axis will be automatically scaled to fit all the values in all the series linked to it. So, if the two series have a very different range of values in one of the dimensions, the respective axis will have a range fitting both series, so the data may not look as you want.
Then, you will probably be interested in separating the series in two axes, with two different ranges, as in the example above (with 4 series and 4 custom vertical axes).
skng wrote:How to access the above custom axis, which were created during the run time ?
As you have seen in the example above, knowing the index of the custom axis, you can access it through Chart1.CustomAxes.Items array.
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

skng
Newbie
Newbie
Posts: 7
Joined: Thu Aug 07, 2014 12:00 am

Re: CustomVertaxis of High-Low series

Post by skng » Thu Oct 02, 2014 5:58 pm

Hi Yerray,
access violation error
It was happened due to improper coding and please accept my apologies.
Thanks for your example, and it solved my problem.

Post Reply