Recent

Author Topic: Trying to plot points, but the plot sizes can't be adjusted.  (Read 481 times)

garymq

  • New Member
  • *
  • Posts: 10
Trying to plot points, but the plot sizes can't be adjusted.
« on: April 14, 2026, 05:53:24 am »
Hello.
I am plotting points on a chart. I do not want lines, I want separate dots.

The code is below.

I can of course use lines to make the graph, and I can adjust the width.
But there are gaps in the data, and if I use lines ( S2.LineType := ltFromPrevious;), the lines automatically join up between dots, and I don't see any gaps. I don't want that.

So I use Pointer.Style, either "S2.Pointer.Style := psPoint;" or "S2.Pointer.Style := psCircle;"

This works, but here's the problem (as shown in the attached screenshots):
S2.Pointer.Style := psPoint; is too thin, and I can barely see the line.
S2.Pointer.Style := psCircle; is too thick.

The only other Pointer styles are stars, diamonds, or other shapes, none of which are suitable.

So my question is: How can I just plot dots, and be able to adjust the size of the points?
(Alternatives are to have another, smaller, Pointer style; or  to be able to make the size of psCircle smaller.)

Code: Pascal  [Select][+][-]
  1. procedure TFrm_AquaView.ReadGraphTideFile(InputFile: String);
  2. { Read in and plot the tide file.
  3. InputFile: tide file (e.g. BWPR01_HHMMYYYY.tid)
  4. }
  5. var
  6.   List1: TStringList;
  7.   i1: Integer=0;
  8.   tidecount: Integer=0;
  9.   st1,st2: String;
  10.   S2: TLineSeries;
  11.   X2: Double;
  12.   Minutes, Hours: Integer;
  13.  
  14. begin
  15.  Chart1.ClearSeries;
  16.  S2 := TLineSeries.Create(Chart1);
  17.  S2.ShowLines:=True;
  18.  S2.ShowPoints:=False;
  19.  S2.Pointer.Visible:=True;
  20.  s2.LinePen.Width:=2;
  21.  
  22.  S2.ShowPoints := True;
  23.  S2.LineType := ltNone;
  24.  S2.Pointer.Style := psCircle;
  25. // S2.Pointer.Style := psPoint;
  26.  S2.Pointer.Brush.Color := clBlack;
  27.  S2.Pointer.Pen.Color := clBlack;          
  28.  

CM630

  • Hero Member
  • *****
  • Posts: 1689
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Trying to plot points, but the plot sizes can't be adjusted.
« Reply #1 on: April 14, 2026, 10:58:10 am »
This shows only points and no lines.
Code: Pascal  [Select][+][-]
  1. ...
  2. uses ... TATypes...
  3. ...
  4.  
  5. procedure TForm1.Button1Click(Sender:TObject);
  6. var
  7.   i: integer = 0;
  8. begin
  9.   S2.LinePen.Style := psClear;
  10.   S2.ShowPoints := True;
  11.   S2.Pointer.Style := psCircle;
  12.   S2.Pointer.HorizSize :=2;
  13.   S2.Pointer.VertSize :=2;
  14.   S2.Pointer.Visible := True;
  15.   S2.Pointer.Brush.Color := clBlack; //fill the circle in
  16.   for i := 0 to 10 do
  17.     S2.Add(i);
  18. end;  
   
« Last Edit: April 14, 2026, 11:34:33 am by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

Warfley

  • Hero Member
  • *****
  • Posts: 2056
Re: Trying to plot points, but the plot sizes can't be adjusted.
« Reply #2 on: April 14, 2026, 12:01:30 pm »
While you can certainly solve this with TAChart, and someone already posted a solution, I personally prefer to just create my own plots using a Canvas. It's fairly easy and you can tweak them to your liking in a way some library often doesn't.

As an example, some time ago I've written the following tool for some work I was doing at the time, which required me to plot a bunch of different measures and compute the 95% confidence interval. The drawing is just like a hundred lines of code, making the plot zoom and draggable just a few lines more. You can check out the code here: https://github.com/Warfley/KleeSummary/blob/master/Forms/Tools/Plot/statsplotframe.pas

garymq

  • New Member
  • *
  • Posts: 10
Re: Trying to plot points, but the plot sizes can't be adjusted.
« Reply #3 on: April 14, 2026, 02:01:36 pm »
Hey
You added:

  S2.Pointer.HorizSize :=2;
  S2.Pointer.VertSize :=2;

That's just what I wanted.
So simple, but somehow I missed these parameters. There are so many options..
Thanks!

 

TinyPortal © 2005-2018