Page 1 of 1

Hiding data points

Posted: Tue Sep 06, 2016 9:07 am
by 16479009
Hi,

I've created a function in Delphi which highlights data points as the mouse moves across the chart - it does this by increasing the size of the point as the mouse moves over it and then shrinking it again once the mouse moves away. I would like to update this so that each point is completely invisible until the mouse moves near it - is there a way of making each point invisible on an individual basis?

Regards,

Toby

Re: Hiding data points

Posted: Tue Sep 06, 2016 10:50 am
by yeray
Hello,

You can use Null Points feature: you can set all the points of the series to be null (note you may need to manually set your axis range in order to show the are where the hidden points are) and use the OnMouseMove event to change the "Null" status of the point below the mouse, if any. Ie:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;
  Chart1.Hover.Visible:=false;

  with Chart1.AddSeries(TPointSeries) do
  begin
    FillSampleValues();

    for i := 0 to Count-1 do
      SetNull(i);
  end;

  visibleIndex:=-1;

  Chart1.Axes.Left.SetMinMax(Chart1[0].YValues.MinValue - 10, Chart1[0].YValues.MaxValue + 10);
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var tmp: Integer;
begin
  if visibleIndex>-1 then
    Chart1[0].SetNull(visibleIndex);

  visibleIndex:=Chart1[0].Clicked(X,Y);

  if visibleIndex>-1 then
    Chart1[0].SetNull(visibleIndex, False);
end;