Recent

Author Topic: [SOLVED] Delete smsLabel value from series point  (Read 3035 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
[SOLVED] Delete smsLabel value from series point
« on: May 24, 2016, 05:54:58 pm »
Hi!
I am trying to have an smsLabel value only when there is an axis generation.
From the chart attached I would not like to have the labels where arrows plotted.
The ox axis is populated using a TListChartSource.
Would it be possible that the series points are edited and the smsLabel value is not displayed?

Code: Pascal  [Select][+][-]
  1.  for i := 0 to line_series.Count - 1 do
  2.   begin
  3.     val_in_ox_list := False;
  4.     for j := 0 to Length(_points_info) - 1 do  //_points_info holds the ox axis points
  5.     begin
  6.       if line_series.GetXValue(i) = _points_info[j] then
  7.       begin
  8.         val_in_ox_list := True;
  9.         break;
  10.       end;
  11.     end;
  12.  
  13.     if not val_in_ox_list then
  14.     begin
  15.        //Delete Label
  16.     end;
  17.   end;        
  18.  

Thank you.
« Last Edit: May 24, 2016, 07:02:45 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Delete smsLabel value from series point
« Reply #1 on: May 24, 2016, 06:30:39 pm »
Code: Pascal  [Select][+][-]
  1. uses
  2.   Math;
  3. const
  4.   EPS = 1e-8;
  5. ...
  6.  for i := 0 to line_series.Count - 1 do
  7.   begin
  8.     line_series.SetText(i, '');  // Erase label
  9.     for j := 0 to Length(_points_info) - 1 do  //_points_info holds the ox axis points
  10.     begin
  11. //      if line_series.GetXValue(i) = _points_info[j] then  // floating point comparison may go wrong due to round-off errors
  12.       if SameValue(line_series.GetXValue(i), _points_info[j], EPS) then
  13.       begin
  14.         line_series.SetText(i, Format('%.0f', [line_series.GetYValue(i)]));  // set y value as label
  15.         break;
  16.       end;
  17.     end;
  18.   end;  

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Delete smsLabel value from series point
« Reply #2 on: May 24, 2016, 07:02:21 pm »
Thank you very much wp!
Lazarus 2.0.2 64b on Debian LXDE 10

 

TinyPortal © 2005-2018