Page 1 of 1
Markstip to show points
Posted: Wed Aug 05, 2009 7:07 am
by 6923298
Hi,
I'm just wondering if it's possible for the markstip to also show a point (for example, a cross) on the series where the mouse is over the series' point.
I've multiple line and volume series, so it's not possible for me to assign to a particular series only.
Thanks.
Re: Markstip to show points
Posted: Wed Aug 05, 2009 2:47 pm
by yeray
Hi pw,
Here you have an example of how you could do it. I'm afraid that you should calculate the points manually:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
int seriesClicked = -1;
int valueClicked = -1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 3; i++)
{
new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1[tChart1.SeriesCount - 1].FillSampleValues(50);
new Steema.TeeChart.Styles.Volume(tChart1.Chart);
tChart1[tChart1.SeriesCount - 1].FillSampleValues(50);
}
Steema.TeeChart.Tools.MarksTip marktip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
seriesClicked = -1;
valueClicked = -1;
for (int i = 0; i < tChart1.Series.Count; i++)
{
valueClicked = tChart1[i].Clicked(e.X, e.Y);
if (valueClicked > -1)
{
seriesClicked = i;
break;
}
}
tChart1.Refresh();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if ((valueClicked > -1) && (seriesClicked > -1))
{
g.Brush.Visible = true;
g.Brush.Solid = true;
g.Brush.Color = tChart1.Series[seriesClicked].Color;
g.Ellipse(new Rectangle(tChart1[seriesClicked].CalcXPos(valueClicked) - 4, tChart1[seriesClicked].CalcYPos(valueClicked) - 4, 8, 8));
}
}
}
Re: Markstip to show points
Posted: Wed Aug 05, 2009 10:19 pm
by 6923298
Many thanks, Yeray. This is fantastic...