Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2092 - Clicked function returns hidden Marks if they were previously shown
Summary: Clicked function returns hidden Marks if they were previously shown
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Series (show other bugs)
Version: 25.180808
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL: https://stackoverflow.com/questions/5...
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-24 04:02 EDT by yeray alonso
Modified: 2018-09-24 04:04 EDT (History)
0 users

See Also:
Chart Series: Line
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2018-09-24 04:02:31 EDT
As the customer reports at StackOverflow, sometimes marks individually hidden are still considered at CalcClickedPart.

The problem is actually at the TSeriesMarks.Clicked function, that doesn't consider the Items Visibility. So, if a Mark is ever drawn, its position and shape are defined and that's what is verified at that Clicked function, even if it has been hidden.

A simple example:

uses Series;

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

  with Chart1.AddSeries(TLineSeries) as TLineSeries do
  begin
    for i:=0 to 8 do
    begin
      AddXY(i, 10);
      Marks.Item[i].Visible:=i<6;
    end;

    Marks.Show;
    Chart1.Draw;

    for i:=3 to Count-1 do
      Marks.Item[i].Hide;
  end;
end;


procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var ValueIndex: Integer;
begin
  Caption:='';

  ValueIndex:=Chart1[0].Marks.Clicked(X,Y);
  if ValueIndex>-1 then
  begin
    if Chart1[0].Marks[ValueIndex].Visible then
      Caption:='Mark'
    else
      Caption:='HIDDEN mark';

    Caption:=Caption + ' clicked at index ' + IntToStr(ValueIndex);
  end;
end;