Series Clicked and Marktip Text
Series Clicked and Marktip Text
I am using TeeChart 7.05 with Delphi 2005 in a vcl application. I have a dbChart that I programmatically add multiple series based on a query. I have the tool MarkTip enabled in the dbChart. I want to be able to have my application detect what series the user clicks and the value of the MarkTip text at that time. Can anyone tell me how to do that?
Hi,
this can be easily done using the MarksTipTool, setting Series to (all) and Mouse Action to "Click", and them use the following events :
this can be easily done using the MarksTipTool, setting Series to (all) and Mouse Action to "Click", and them use the following events :
Code: Select all
procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
var Text: String);
begin
label1.caption := ' MarkText: ' + text;
end;
procedure TForm1.Chart1ClickSeries(Sender: TCustomChart;
Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
label2.caption := 'Series : ' + Series.Name;
end;
Pep Jorge
http://support.steema.com
http://support.steema.com
Series Clicked and Marktip Text
Thanks the Tooltip worked but the series name is not being passed. I made sure that the series have names. What could I be doing wrong?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi McMClark,
You can try using Chart1[ValueIndex].Name or Chart1[ValueIndex].Title.
You can try using Chart1[ValueIndex].Name or Chart1[ValueIndex].Title.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks.
I want to enable the MarkTipTool in DBCharts that I build at runtime. I want the tool tip to show the X value when the cursor passes over a point on the graph. How can I do that. The code I have is
var
DBChart1: TDBChart;
intList: integer;
begin
for intlist := 1 to NumOfCharts Do
begin
DBChart1 := TDBChart.Create(Self);
DBChart1. Top := LastChartTop + LastChartWidth + 10
DBChart1.Height := DefaultHeight;
tmpLineSeries := TLineSeries.Create(self);
DBChart1.AddSeries(tmpLineSeries);
With tmpLineSeries do
Begin
DataSource:= TempResults_Query1;
YValues.ValueSource := 'Score';
XLabelsSource := 'PublicationDate';
Pointer.Visible := False;
Title := strSubject;
CheckDataSource;
OnGetPointerStyle:=Series1GetPointerStyle;
end;
end;
I want to enable the MarkTipTool in DBCharts that I build at runtime. I want the tool tip to show the X value when the cursor passes over a point on the graph. How can I do that. The code I have is
var
DBChart1: TDBChart;
intList: integer;
begin
for intlist := 1 to NumOfCharts Do
begin
DBChart1 := TDBChart.Create(Self);
DBChart1. Top := LastChartTop + LastChartWidth + 10
DBChart1.Height := DefaultHeight;
tmpLineSeries := TLineSeries.Create(self);
DBChart1.AddSeries(tmpLineSeries);
With tmpLineSeries do
Begin
DataSource:= TempResults_Query1;
YValues.ValueSource := 'Score';
XLabelsSource := 'PublicationDate';
Pointer.Visible := False;
Title := strSubject;
CheckDataSource;
OnGetPointerStyle:=Series1GetPointerStyle;
end;
end;
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi McMClark,
Yes, you can add the following to your coee to achieve what you request:
You'll also have to include TeeTools unit into your uses section.
Yes, you can add the following to your coee to achieve what you request:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
DBChart1[0].FillSampleValues();
DBChart1.Tools.Add(TCursorTool.Create(self));
(DBChart1.Tools.Items[0] as TCursorTool).FollowMouse:=true;
(DBChart1.Tools.Items[0] as TCursorTool).OnChange:=ChartTool1Change;
(DBChart1.Tools.Items[0] as TCursorTool).Style:=cssVertical;
end;
procedure TForm1.ChartTool1Change(Sender: TCursorTool; x, y: Integer;
const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
DBChart1.Title.Text[0]:='Cursor X Value: '+FloatToStr(XValue);
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |