Page 1 of 1

CustomVertaxis of High-Low series

Posted: Wed Oct 01, 2014 6:30 pm
by 16469977
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,

Re: CustomVertaxis of High-Low series

Posted: Thu Oct 02, 2014 11:00 am
by yeray
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.

Re: CustomVertaxis of High-Low series

Posted: Thu Oct 02, 2014 5:58 pm
by 16469977
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.