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 1230

Summary: CursorTool and Annotation (scientific format)
Product: VCL TeeChart Reporter: narcís calvet <narcis>
Component: ToolsAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: major    
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://www.teechart.net/support/viewtopic.php?f=3&t=15614&sid=4cdc2f923b57265bf5a60173e533d708&p=69287#p69287
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: a little project where you have the same problem. Drag the cursor to reproduce the problem.

Description narcís calvet 2015-06-09 09:03:12 EDT
Created attachment 461 [details]
a little project where you have the same problem.  Drag the cursor to reproduce the problem.

I would like to show the XValue on an Annotation of my CursorTool. The bottom axis values are in scientific format (1*10E-5 for example).

When I move the cursor, the XValue is shown but if the cursor Snap propertie is false, the value in the Annotation is wrong. 

For example, if I move the cursor between 1*10E-5 and 1*10E-4, the value in the Annotation will be 1.0*14E-59, 1.1*16E-58, 1.9*14E-52, 3.5*18E-58, 4.8*10E-54... 9.9*19E-59 and 1.0*10E-45

Attached an example project demonstrating this. Example below, trying to recreate in a simpler way, doesn't work fine either.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeeGDIPlus, TeeComma, ExtCtrls, TeeProcs, TeEngine, Chart, TeeTools;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    TeeCommander1: TTeeCommander;
    procedure FormCreate(Sender: TObject);
    procedure ChartTool1Change(Sender: TCursorTool; x, y: Integer;
      const XValue, YValue: Double; Series: TChartSeries;
      ValueIndex: Integer);
  private
    { Private declarations } 
    Annotation1 : TAnnotationTool;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var
  Series1 : TLineSeries;
  Cursor1 : TCursorTool;
  i : Integer;
begin
  Chart1.View3D:=False;
  Chart1.Axes.Bottom.AxisValuesFormat:='#.#,x10E-#';
  Chart1.Axes.Bottom.Increment:=0.001000000000000000;

  Series1:=TLineSeries.Create(Self);
  Series1.ParentChart:=Chart1;

  for i := 0 to 25 - 1 do
    Series1.AddXY(i/1000, 5);

  Cursor1:=TCursorTool.Create(Self);
  Cursor1.ParentChart:=Chart1;
  Cursor1.Series:=Series1;
  Cursor1.Style:=cssVertical;
  Cursor1.OnChange:=ChartTool1Change;

  Annotation1:=TAnnotationTool.Create(Self);
  Annotation1.ParentChart:=Chart1;
end;

procedure TForm1.ChartTool1Change(Sender: TCursorTool; x, y: Integer;
  const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
  //Annotation1.Text:=Series.GetHorizAxis.LabelValue(XValue);
  Annotation1.Text:=FormatFloat('#.#,x10E-#', XValue);
end;

end.