How to add the Y values and display it in Tooltip

TeeChart for ActiveX, COM and ASP
Post Reply
Roger
Newbie
Newbie
Posts: 23
Joined: Thu Nov 11, 2004 5:00 am
Location: Dallas

How to add the Y values and display it in Tooltip

Post by Roger » Tue Nov 08, 2005 12:32 pm

Hi,
I have created a graph with two series. I am interested is displaying the the sum of the Y values(series1 Y value + series2 Yvalue) in Tooltip.
I would like to display the sum for both Mouse over and On Click events.

Is it possible?. If yes then please let me know how it can be done.

Thanks,
Mahendra

Rossmc
Newbie
Newbie
Posts: 27
Joined: Wed Jul 28, 2004 4:00 am
Location: South Africa

Should be possible

Post by Rossmc » Tue Nov 08, 2005 1:32 pm

Hi Roger

As long as their x-axis is shared it should be no problem.

OnClickSeries:

sum = tChart1.Series(0).YValues.Value(ValueIndex) + tChart1.Series(1).YValues.Value(ValueIndex)

OnMouseEnterSeries:
Dim XVal as Double

XVal = tChart1.Axis.Bottom.CalcPosPoint(tChart1.Series(0).MouseValues.X)

sum = tChart1.Series(0).YValues.Value(XVal) + tChart1.Series(1).YValues.Value(XVal)

Try that.
Ross

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Nov 08, 2005 3:44 pm

Hi Roger,

one way to do this could be to use the following code (using a TMarksTipTool) :

Code: Select all

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
  var Text: String);
begin
Text := floattostr(Series1.YValue[strtoint(text)] + Series2.YValue[strtoint(text)]);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ChartTool1.Style := smsXValue;
end;

Post Reply