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 238

Summary: [TV52016333] The TPointSeries clicked function doesn't work fine. Check the testi...
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: major    
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2013-11-20 10:33:58 EST
The TPointSeries clicked function doesn't work fine for non-orthogonal charts
Check the testing code:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Chart3DPercent:=100;
  Chart1.Aspect.Orthogonal:=false;
  Chart1.Aspect.Zoom:=80;
  Chart1.AddSeries(TPointSeries).FillSampleValues(5);
  Chart1[0].ColorEachPoint:=true;
end;
// with this, we highlight the zones in the chart that return something with the clicked function:
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var x, y, valueIndex: Integer;
begin
  for x:=0 to Chart1.Width-1 do
    for y:=0 to Chart1.Height-1 do
    begin
      valueIndex:=Chart1[0].Clicked(x,y);
      if valueIndex>-1 then
        Chart1.Canvas.Pixels[x,y]:=clWhite;
    end;
end;
**************************
Here it is a fix proposal, but I haven't tried if it breaks other dependand series clicked function:
- Change the TCustomSeries.ClickedPointer, for the below, using the Calculate3DPosition function:
Function TCustomSeries.ClickedPointer( ValueIndex,tmpX,tmpY:Integer;
                                       x,y:Integer):Boolean;
var P: TPoint;
begin
  PreparePointer(ValueIndex); // 7.0
  if Assigned(ParentChart) then
     P:=ParentChart.Canvas.Calculate3DPosition(tmpX,tmpY,StartZ);
  result:=(DoGetPointerStyle(ValueIndex)<>psNothing) and
          (Abs(P.X-X)<FPointer.HorizSize) and
          (Abs(P.Y-Y)<FPointer.VertSize);
end;
- And remove the first sentence in TCustomSeries.Clicked, where Calculate2DPosition is called:
Function TCustomSeries.Clicked(x,y:Integer):Integer;
//...
begin
  //if Assigned(ParentChart) then
     //ParentChart.Canvas.Calculate2DPosition(X,Y,StartZ);
//...
end; [created:2012-09-07T11:59:46.000+01:00 reported by:yeray@steema.com reported in version:2012.06.120613 (TeeChart VCL)]