Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Y-Axis maximum value

 Post Reply Post Reply
Author
Lombe Lambert View Drop Down
New Member
New Member
Avatar

Joined: 11 Dec 2012
Posts: 15
Post Options Post Options   Quote Lombe Lambert Quote  Post ReplyReply Direct Link To This Post Topic: Y-Axis maximum value
    Posted: 04 Apr 2014 at 12:25pm
Hi.
I have 4 series to display on the same view with two scale of values. The series 0 and 2 have to use the left Y-Axis, and the series 1 and 3 the right Y-Axis. When I set the Autorange property of the Y-Axis for the serie 0 to Enabled, and I disable the Y-Axis for the serie 2, the scale of the left Y-Axis is good for the serie 0 while the values of serie 2 do not match the values of the Y-Axis. The component used is TAdvChartView. Setting the maximum value of the Y-Axis via the property of the view give a good result. How can I change these maximum values by the code ?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3331
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 07 Apr 2014 at 2:51am
Hi, 

If you have 4 series with a common range for serie 0 and 2 and serie 1 and 3 separately it is recommended to set the AutoRange to arDisabled and set the Minimum and Maximum value manually:

var
  c: TTIWAdvChart;
  I: Integer;
  J: Integer;
begin
  c := TTIWAdvChart.Create(Self);
  c.Parent := Self;
  c.BeginUpdate;
  c.Chart.Series.Add;
  c.Chart.Series.Add;
  c.Chart.Series.Add;
  c.Chart.Series.Add;

  c.Chart.Series[0].AutoRange := arDisabled;
  c.Chart.Series[1].AutoRange := arDisabled;
  c.Chart.Series[2].AutoRange := arDisabled;
  c.Chart.Series[3].AutoRange := arDisabled;

  c.Chart.Series[0].Minimum := 0;
  c.Chart.Series[2].Maximum := 100;
  c.Chart.Series[1].Minimum := 50;
  c.Chart.Series[3].Maximum := 250;

  c.Chart.Series[0].YAxis.Position := yLeft;
  c.Chart.Series[2].YAxis.Position := yLeft;
  c.Chart.Series[1].YAxis.Position := yRight;
  c.Chart.Series[3].YAxis.Position := yRight;

  c.Chart.Series[0].XAxis.Visible := True;
  c.Chart.Series[2].XAxis.Visible := False;
  c.Chart.Series[1].XAxis.Visible := False;
  c.Chart.Series[3].XAxis.Visible := False;

  c.Chart.YAxis.Position := yBoth;

  for I := 0 to c.Chart.Series.Count - 1 do
  begin
    for J := 0 to 9 do
    begin
      if (I = 0) or (I = 2) then
        c.Chart.Series.AddSinglePoint(Random(100))
      else
        c.Chart.Series.AddSinglePoint(Random(250));
    end;
  end;

  c.EndUpdate;

Kind Regards, 
Pieter
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down