Page 1 of 1
HighLowSerie : CalcXPosValue goes wrong !?
Posted: Thu Nov 23, 2006 12:58 pm
by 8120407
Hello,
The following line always returns : -32768
Code: Select all
clickedX1 = HighLow.CalcXPosValue(HighLow.LowValues[valueIndex]);
The lowvalue at index = 0.5
the highValue at index = 8.5
We want to show in the afterdraw the clicked position. The outcome must be a donut at the high pen and a donut at the low pen. Also we show the values with g.TextOut next to the HighValue (in a line serie is this :
Code: Select all
clickedX=Line.CalcXPos(valueIndex)),
we cannot use this because we have 2 x values (high,Low).
This problem we have only by a HighLow Serie.
The version we use is : 1.1.2379.21122 (this version is the lastest release, but is not announced in the forums by the way)
With reagards,
Roland Hillebrand[/img]
Posted: Thu Nov 23, 2006 3:33 pm
by narcis
Hi Roland,
It works fine for me here using the series' clicked event like this:
Code: Select all
private void HighLowStyle_Click(object sender, MouseEventArgs e)
{
int valueIndex = HighLowStyle.Clicked(e.X,e.Y);
tChart1.Header.Text = HighLowStyle.XValues[valueIndex].ToString();
}
Posted: Thu Nov 23, 2006 3:41 pm
by 8120407
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]
Posted: Thu Nov 23, 2006 3:46 pm
by narcis
Hi Roland,
Instead of TeeChart's ClickSeries event i use series' Click event. Please see the example I posted at the newsgroups for your other thread. This is implemented there as well.
Posted: Thu Nov 23, 2006 4:04 pm
by 8120407
Hi,
We cannot use your event handler, because in asp.net is the mouseEventHandler not available.
We use instead :
Code: Select all
this.GraphDetail.ClickSeries += new Steema.TeeChart.Web.WebChart.SeriesEventHandler(this.GraphDetail_ClickSeries);
With regards,
Roland Hillebrand