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
How to add the Y values and display it in Tooltip
Should be possible
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
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
Hi Roger,
one way to do this could be to use the following code (using a TMarksTipTool) :
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;
Pep Jorge
http://support.steema.com
http://support.steema.com