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

Odd X-axis

 Post Reply Post Reply
Author
Hennekens Stephan View Drop Down
New Member
New Member
Avatar

Joined: 16 Aug 2012
Posts: 22
Post Options Post Options   Quote Hennekens Stephan Quote  Post ReplyReply Direct Link To This Post Topic: Odd X-axis
    Posted: 11 Jul 2018 at 10:17am
I have a chart with two series of XY-markers. The X-axis looks odd. I would like to have numbers like 10, 20, 30 etc on the axis and not values in between. Also there is a second row with values that don;t make any sense at all. The max value on the X-axis is 100. Code is listed below the chart.


   Chart.BeginUpdate;
   with Chart.Panes[0] do
   begin
      Series.Clear;
      Title.Font.Color := clBlue;
      Title.Font.Style := [fsBold];
      Range.RangeFrom := 0;
      Range.RangeTo := 100;
      Title.Text := '';
      XAxis.AutoSize := False;
      YAxis.AutoSize := False;
   end;
   // first serie
   with Chart.Panes[0].Series.Add do
   begin
      ClearPoints;
      Color := Lighter(clBlue, 50);
      LegendText := 'Trouwgraad op basis van presentie';
      ChartType := ctXYMarkers;
      ShowValue := False;
      AutoRange := arDisabled;
      Maximum := 100;
      Minimum := 0;
      Marker.MarkerType := mCircle;
      Marker.MarkerSize := 10;
      Marker.MarkerColor := clBlue;
      Marker.MarkerColorTo := Lighter(clBlue, 50);
      Marker.MarkerLineColor := clGreen;
      Marker.GradientType := gtForwardDiagonal;
      Marker.OpacityTo := 150;
      Marker.SelectedColor := clBlue;
      Marker.SelectedColorTo := Lighter(clBlue, 50);
      Marker.SelectedLineColor := clBlue;
      Marker.SelectedSize := 10;
      LineColor := Lighter(clGreen, 50);
      LineWidth := 0;
      XAxis.MajorUnit := 10;
   end;
   // second serie
   with Chart.Panes[0].Series.Add do
   begin
      ClearPoints;
      Color := RGB(128, 176, 255);
      Color := Lighter(clGreen, 50);
      LegendText := 'Trouwgraad op basis van gemiddelde bedekking';
      ChartType := ctXYMarkers;
      ShowValue := False;
      AutoRange := arDisabled;
      Maximum := 100;
      Minimum := 0;
      Marker.MarkerType := mCircle;
      Marker.MarkerSize := 10;
      Marker.MarkerColor := clGreen;
      Marker.MarkerColorTo := Lighter(clGreen, 50);
      Marker.MarkerLineColor := clGreen;
      Marker.GradientType := gtForwardDiagonal;
      Marker.OpacityTo := 150;
      Marker.SelectedColor := clGreen;
      Marker.SelectedColorTo := Lighter(clGreen, 50);
      Marker.SelectedLineColor := clGreen;
      Marker.SelectedSize := 10;
      LineColor := Lighter(clGreen, 50);
      LineWidth := 0;
   end;

   syntaxon := cmxPlantengemeenschappen.Value;
   syntaxonnaam := cmxPlantengemeenschappen.Text;
   n := Pos(' - ', syntaxonnaam);
   syntaxonnaam := Copy(syntaxonnaam, n + 3, Length(syntaxonnaam) - 2 - n);

   points := TObjectList.Create;
   try
      formMain.DbLocal.GetplantengemeenschappenFingerprint(points, syntaxon);
      Chart.Panes[0].Title.Text := GetLangStr('Vingerafdruk') + ' ''' + syntaxonnaam + ''' (' + IntToStr(points.Count) + ' ' +
         GetLangStr('SoortenMetPresentie>0.1') + ')';
      SetLength(FSepciesnames, points.Count);
      for i := 0 to points.Count - 1 do
      begin
         point := TFingerprintPoint(points);
         Chart.Panes[0].Series[0].AddSingleXYPoint(point.Constancy, point.FaithfulnessPres);
         Chart.Panes[0].Series[1].AddSingleXYPoint(point.Constancy, point.FaithfulnessCover);
         FSepciesnames := point.Speciesname; // + Format(' %.f1  %.f1', [point.Constancy, point.FaithfulnessCover]);
      end;
   finally
      points.Free;
   end;
   Chart.EndUpdate;




Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3301
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 11 Jul 2018 at 2:05pm
Hi, 

The secondary values are the XValues, please turn them off with XValues := False on Series X-Axis level. Additionally, the jumps between the values are caused by the MajorUnit and MinorUnit properties, you can set these also at Series X-Axis level. There is an option to turn off auto-calculation of units with the AutoUnits property.
Back to Top
Hennekens Stephan View Drop Down
New Member
New Member
Avatar

Joined: 16 Aug 2012
Posts: 22
Post Options Post Options   Quote Hennekens Stephan Quote  Post ReplyReply Direct Link To This Post Posted: 11 Jul 2018 at 2:27pm
Bingo. Thanks a lot Pieter.
I have now moved all my charts from a certain package to AdvCharts. I am quite satisfied with the flexibility and aesthetic aspects of the package.
Regards,
Stephan
  
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3301
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 11 Jul 2018 at 2:34pm
Thanks Stephan!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down