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

Character of the position in the Y-axis is shifted

 Post Reply Post Reply
Author
Aoki Taro View Drop Down
New Member
New Member
Avatar

Joined: 29 Jan 2016
Posts: 33
Post Options Post Options   Quote Aoki Taro Quote  Post ReplyReply Direct Link To This Post Topic: Character of the position in the Y-axis is shifted
    Posted: 16 Feb 2016 at 9:56am
hello,
Character of the position in the Y-axis is shifted.
Is there a way that does not shift ?

I know the cause is this code.
>  AdvChartView1.Panes[0].YAxis.AutoUnits := False;
But I want to decide on their own the pitch of the Y-axis.

Kind Regards,
TARO


{The following is the code that this phenomenon occurs }
procedure TForm1.XAxisGetVal(Sender: TObject; Serie: TChartSerie;
  Value: double; var AValue: string);
begin
  AValue := Format('%.0f m', [value]);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AdvChartView1.Panes[0].Series[0].OnXAxisGetValue := XAxisGetVal;

  AdvChartView1.Panes[0].BorderStyle:=bsNone;
  AdvChartView1.Enabled := False;

  with AdvChartView1.Panes[0] do
  begin
    Series[2].Free;
    Series[1].Free;

    CrossHair.Visible := False;
    Legend.Visible := False;

    Range.RangeFrom:=0;
    Range.RangeTo  :=200000;

    Title.Text :='';

    XAxis.Darken3D := False;
    XAxis.Size:=55;
    XAxis.Text:='';
    XGrid.AutoUnits:=False;
    XGrid.MajorLineColor := $00D7D7D7;
    XGrid.MajorLineStyle := psSolid;
    XGrid.MinorLineColor := $00D7D7D7;
    XGrid.MinorLineStyle := psDash;
    XGrid.MinorLineWidth := 0;
    XGrid.Visible := True;

    YAxis.AutoUnits := False;
    YAxis.Darken3D := False;
    YAxis.Size:=100;
    YAxis.Text:='';
    YGrid.AutoUnits:=False;
    YGrid.MajorLineColor := $00D7D7D7;
    YGrid.MajorLineStyle := psSolid;
    YGrid.MajorLineWidth := 3;
    YGrid.MinorLineColor := $00D7D7D7;
    YGrid.MinorLineStyle := psDash;
    YGrid.MinorLineWidth := 1;
    YGrid.Visible := True;

    With Series[0] do begin
      ChartType := ctXYLine;
      LineColor := clBlack;
      Marker.MarkerType := mNone;
      Maximum :=  30;
      Minimum := -1;
      ShowValue := False;
      Title.Text := '';
      ValueFormat := '%.1f m';

      XAxis.AutoUnits:=False;
      XAxis.MajorUnit := 100000;
      XAxis.MinorUnit := 20000;
      XAxis.Visible := true;
      XAxis.XYValues := False;
      XGrid.AutoUnits := False;
      XGrid.AutoUnits := False;
      XGrid.MajorDistance := 100000;
      XGrid.MinorDistance := 20000;

      YAxis.AutoUnits:=False;
      YAxis.MajorUnit := 10;
      YAxis.MinorUnit := 5;
      YAxis.MinorUnitVisible := True;
      YAxis.TickMarkColor := clBlack;
      YAxis.Visible := true;
      YGrid.AutoUnits := False;
      YGrid.MajorDistance := 10;
      YGrid.MinorDistance := 5;

      AddSingleXYPoint( 0.00 , 0.60 );
      AddSingleXYPoint( 3.70 , 0.50 );
      AddSingleXYPoint( 10.45 , 20.50 );
      AddSingleXYPoint( 20.20 , 0.50 );
      AddSingleXYPoint( 500.20 ,-0.50 );
      AddSingleXYPoint( 8000.20 , 10.50 );
      AddSingleXYPoint(190000.40 , 20.60 );
    end;
  end;
end;
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3568
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 2016 at 10:17am
Hi, 

This is due to the MajorUnitSpacing and MinorUnitSpacing properties.
These are initialized with a default value to show a distinct difference.

Kind regards, 
Pieter
Back to Top
Aoki Taro View Drop Down
New Member
New Member
Avatar

Joined: 29 Jan 2016
Posts: 33
Post Options Post Options   Quote Aoki Taro Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 2016 at 10:46am
Hi Pieter,
Thank you for your explanation.
It was successful in the following code
      YAxis.MajorUnitSpacing :=0;
      YAxis.MinorUnitSpacing :=4;   //This value was the best at this time ;)
Kind Regards,
TARO
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down