Hi,
This is the complete function. You use a other serie click event ?!
Code: Select all
private void GraphDetail_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, System.EventArgs e)
{
try
{
Steema.TeeChart.Chart tChart=((Steema.TeeChart.Web.WebChart)sender).Chart;
clickedX=s.CalcXPos(valueIndex);
clickedY=s.CalcYPos(valueIndex);
string title = s.Title;
if (s.Title.Length >30)
{
title = s.Title.Substring(0,30) + " ..";
}
title = title + "\n\r" ;
DateTime timeStamp = DateTime.FromOADate(s.XValues[valueIndex]);
if (s is Steema.TeeChart.Styles.HighLow)
{
Steema.TeeChart.Styles.HighLow HighLow = (Steema.TeeChart.Styles.HighLow)s;
clickedX1 = HighLow.CalcXPosValue(HighLow.LowValues[valueIndex]);
clickedY1 = HighLow.CalcXPos( valueIndex);
msgText= title + "Tijdstip : "+timeStamp.ToShortDateString()+ " " + timeStamp.ToShortTimeString() +"\n\rMin Value: "+HighLow.LowValues[valueIndex].ToString("#0.00")+"\n\rMax Value: "+HighLow.HighValues[valueIndex].ToString("#0.00");
}
else
{
msgText= title + "Tijdstip : "+timeStamp.ToShortDateString()+ " " + timeStamp.ToShortTimeString() +"\n\rValue: "+s.YValues[valueIndex].ToString("#0.00");
}
}
catch (Exception error)
{
HDBPageHeader.ErrorMessage = error.Message;
General.Log.Write(error,"GraphDetail_ClickSeries",pageName);
}
}
In the afterdraw event we use the x / y values like so :
Code: Select all
private void GraphDetail_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
try
{
//output text message to the rendered Chart.
if (clickedX!=-1)
{
g.Font.Bold=true;
g.Font.Color=Color.Black;
// Mark the clicked spot
g.Pen.Color = Color.White ;
g.Pen.DrawingPen.Color = Color.White;
g.Donut(clickedX,clickedY,2,2,0,360,100);
if (clickedX1 !=-1) // HighLow serie
{
g.Pen.Color = Color.Red ;
g.Pen.DrawingPen.Color = Color.Red;
g.Donut(clickedX1,clickedY1,2,2,0,360,100);
}
Steema.TeeChart.Chart tChart=((Steema.TeeChart.Web.WebChart)sender).Chart;
int yPos=clickedY;
int xPos = clickedX;
int width=220;
int height = 40;
if (clickedX > tChart.Series[0].CalcXPos(tChart.Series[0].Count-1)-width)
{
xPos = xPos-230;
width = 220;
}
if (msgText.ToLower().IndexOf("min value")>0)
{
height=65;
}
g.FillRectangle(new SolidBrush(Color.WhiteSmoke) ,xPos+10, yPos+10, width, height);
g.TextOut(xPos+10,yPos+10,msgText);
}
}
catch (Exception error)
{
HDBPageHeader.ErrorMessage = error.Message;
General.Log.Write(error,"GraphDetail_AfterDraw",pageName);
}
}
With Regards,
Roland Hillebrand
[/code]