Get values from chart when clicked
Posted: Tue Apr 12, 2005 11:08 pm
We are using Delphi 7.1, TeeChart 7 for the development.
We have many charts in the application and lately client wants us to implement a feature where they can click on the chart and that inturn will display a form or a hint which displays Label and Values and much more information about the state of few more variables in the application which is not a part of the chart.
Now when I have a chart displayed via program then I can click on Edit button for the chart which brings up an editing box. Now I got to "Tools" tab and click on Add button which brings up Chart Tools Gallery dialog box.
Select Mark Tip and press OK. Then select the "Series", "Label and Value", "Either click or mouse over" and "Delay"
Press OK on the main dialog box and then move the mouse on the chart or click on the point or a line connecting 2 points and it will display the label and values of axis as a tool tip.
I want to do the similar kind of thing but want to add more information to the tool tip which is displayed.
So my plan was to have some code in Chart's click event which finds if the point or the line was clicked and then get the values and pass those values back to the program with an event so the program can display a tool tip or format the values the way we want and display it differently.
If anyone has a small code sample to detect if the point or line was clicked and what were the Label and Value of each axis then I would apreciate it. I can manage the event part once I have all the values.
Cheers,
Nirav
P.S. : I would attach some images to explain more but there is no way to upload an image on this forum but I will try to upload it on a site and so it can be viewed.
We have many charts in the application and lately client wants us to implement a feature where they can click on the chart and that inturn will display a form or a hint which displays Label and Values and much more information about the state of few more variables in the application which is not a part of the chart.
Now when I have a chart displayed via program then I can click on Edit button for the chart which brings up an editing box. Now I got to "Tools" tab and click on Add button which brings up Chart Tools Gallery dialog box.
Select Mark Tip and press OK. Then select the "Series", "Label and Value", "Either click or mouse over" and "Delay"
Press OK on the main dialog box and then move the mouse on the chart or click on the point or a line connecting 2 points and it will display the label and values of axis as a tool tip.
I want to do the similar kind of thing but want to add more information to the tool tip which is displayed.
So my plan was to have some code in Chart's click event which finds if the point or the line was clicked and then get the values and pass those values back to the program with an event so the program can display a tool tip or format the values the way we want and display it differently.
If anyone has a small code sample to detect if the point or line was clicked and what were the Label and Value of each axis then I would apreciate it. I can manage the event part once I have all the values.
Cheers,
Nirav
P.S. : I would attach some images to explain more but there is no way to upload an image on this forum but I will try to upload it on a site and so it can be viewed.