Recent

Author Topic: How to follow data on graph? (by 10 point interval)  (Read 3569 times)

timurgepard

  • Newbie
  • Posts: 4
How to follow data on graph? (by 10 point interval)
« on: November 15, 2016, 09:56:11 am »
Hi guys!

Points of my graph is increasing, and at x axis I have time values.

I want to go only by 10 intervals visible on graph is it possible?

If there is default tool for that?

Like window following graph
« Last Edit: November 15, 2016, 10:06:40 am by timurgepard »

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: How to follow data on graph? (by 10 point interval)
« Reply #1 on: November 15, 2016, 10:15:45 am »
If you don't want to keep all data delete old data from the beginning of the series until you have at most 10 (or whatever) values:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.AddValueToSeries(ASeries: TChartSeries; x, y: Double);
  2. const
  3.   MAXCOUNT = 10;
  4. begin
  5.   ASeries.AddXY(x, y);
  6.   while ASeries.Count > MAXCOUNT do
  7.     ASeries.Listsource.Delete(0);
  8. end;

If you want to keep data fix the axis range to show only the recent 10 intervals:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.AddValueToSeries(ASeries: TChartSeries; x,y: Double);
  2. var
  3.   MAXRANGE = .... // max axis range
  4. begin
  5.   ASeries.AddXY(x, y);
  6.   Chart1.BottomAxis.Range.Max := x;
  7.   Chart1.BottomAxis.Range.Min := x - MAXRANGE;
  8.   Chart1.BottomAxis.Range.UseMax := true;
  9.   Chart1.BottomAxis.Range.UseMin := true;
  10. end;
 

timurgepard

  • Newbie
  • Posts: 4
Re: How to follow data on graph? (by 10 point interval)
« Reply #2 on: November 15, 2016, 10:58:25 am »
Thank you Sir!

God Bless!

It is little bit hard to find those methods and options in documentation at first (from first glance)
Could you please show me where can I find those methods and options?


wp

  • Hero Member
  • *****
  • Posts: 11923
Re: How to follow data on graph? (by 10 point interval)
« Reply #3 on: November 15, 2016, 03:58:45 pm »
http://wiki.lazarus.freepascal.org/TAChart_documentation

See also the tutorials:
http://wiki.lazarus.freepascal.org/TAChart#Documentation

There's no list of all methods and properties, though. You must study the sources. Hold the CTRL-Key down while clicking on the identifier "TChart" in your source code - this opens the main TAChart unit and you can navigate through all declarations. Also look at TAChartUtils, TASeries, TCustomSeries. etc.

timurgepard

  • Newbie
  • Posts: 4
Re: How to follow data on graph? (by 10 point interval)
« Reply #4 on: November 16, 2016, 04:16:47 am »
Thank you!

I tried to find "Listsource" function

I looked at TAChart, with no restult
I looked at TASeries, with no restult
Then I decided to click on its own "Listsource" and found it in TACustomSeries.
But there is a problem, if I did not know how the function is called I would never have found it by myself... without your help.  :(


« Last Edit: November 16, 2016, 04:18:55 am by timurgepard »

 

TinyPortal © 2005-2018