![]() | Steema Issues DatabaseNote: 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. |
| Summary: | DrawLine Tool returns wrong StartPos and EndPos values | ||
|---|---|---|---|
| Product: | ActiveX TeeChart | Reporter: | yeray alonso <yeray> |
| Component: | Chart Tools | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | marc |
| Priority: | --- | ||
| Version: | TeeChart Pro Activex Control 2017.0.0.0 Release | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
In Delphi this works fine, but in ActiveX there are two problems: - You get wrong values (very small) for StartPos.X, StartPos.Y, EndPos.X and EndPos.Y. - In VB6 you get an "Object doesn't support this property or method" error when you try to use the AxisPoint function. Find below the VCL code: uses Series, TeeTools, TeCanvas; procedure TForm1.FormCreate(Sender: TObject); var i: Integer; begin Chart1.View3D:=False; Chart1.Legend.Visible:=False; Chart1.Zoom.Active:=false; Chart1.AddSeries(TPointSeries).FillSampleValues; Chart1.Tools.Add(TDrawLineTool); end; procedure TForm1.Chart1AfterDraw(Sender: TObject); var i: Integer; StartPoint, EndPoint: TPoint; begin if (Chart1.Tools[0] is TDrawLineTool) then with (Chart1.Tools[0] as TDrawLineTool) do begin for i := 0 to Lines.Count-1 do begin Chart1.Canvas.TextOut(5, 10 * i, 'Line ' + IntToStr(i) + ', StartPos (' + FormatFloat('#,##0.##', Lines.Line[i].StartPos.X) + ', ' + FormatFloat('#,##0.##', Lines.Line[i].StartPos.Y) + ')' + ', EndPos (' + FormatFloat('#,##0.##', Lines.Line[i].EndPos.X) + ', ' + FormatFloat('#,##0.##', Lines.Line[i].EndPos.Y) + ')'); StartPoint := AxisPoint(Lines.Line[i].StartPos); EndPoint := AxisPoint(Lines.Line[i].EndPos); Chart1.Canvas.Arrow(true, StartPoint, EndPoint, 8, 8, 0); end; end; end; And here the VB code: Private Sub Form_Load() TChart1.Aspect.View3D = False TChart1.Legend.Visible = False TChart1.AddSeries scPoint TChart1.Series(0).FillSampleValues TChart1.Zoom.Enable = False TChart1.Tools.Add tcDrawLine End Sub Private Sub TChart1_OnAfterDraw() Dim i As Integer Dim StartPoint, EndPoint As TeePoint2D With TChart1.Tools.Items(0).asDrawLine For i = 0 To .Lines.Count - 1 'StartPoint = .AxisPoint(.Lines.Items(i).StartPos.X, .Lines.Items(i).StartPos.Y) 'EndPoint = .AxisPoint(.Lines.Items(i).EndPos.X, .Lines.Items(i).EndPos.Y) 'TChart1.Canvas.Arrow True, StartPoint.X, StartPoint.Y, EndPoint.X, EndPoint.Y, 8, 8, 0 TChart1.Canvas.TextOut 5, 10 * i, "Line " + Str$(i) + ", StartPos (" + Str$(.Lines.Items(i).StartPos.X) + ", " + Str$(.Lines.Items(i).StartPos.Y) _ + ", EndPos (" + Str$(.Lines.Items(i).EndPos.X) + ", " + Str$(.Lines.Items(i).EndPos.Y) Next i End With End Sub