Page 1 of 1
Show a point that does not lie on a series
Posted: Tue Mar 07, 2006 10:20 am
by 9788742
In an application using tchart, is there anyway to show marker on some x and y value which is not on the series (line/curve)?
Posted: Tue Mar 07, 2006 10:37 am
by narcis
Hi Lakshmi,
Yes, you can do something like the code below custom drawing on TeeChart's canvas.
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
int x=tChart1.Axes.Bottom.CalcPosValue(5.3);
int y=tChart1.Axes.Left.CalcPosValue(76.2);
g.TextOut(x,y,"My custom text");
}
Show a point that does not lie on a series
Posted: Thu Mar 09, 2006 6:37 am
by 9788742
Hi Narcis,
g.TextOut does solve the problem, but our requirement is to draw a mark such "X" or a circle at a given X & Y value. I guess we can do this using g.Ellipse or g.Line. But I was wondering if there was a easier way to do it, say by just giving X & Y value T-Chart should be able to draw the mark.
Also related question is, I use g.Ellipse or g.Line and draw the mark, I would need a way to even erase the mark, how can we achieve that? I guess one way would be to call invalidate, right?
Posted: Thu Mar 09, 2006 8:54 am
by narcis
Hi Lakshmi,
g.TextOut does solve the problem, but our requirement is to draw a mark such "X" or a circle at a given X & Y value. I guess we can do this using g.Ellipse or g.Line. But I was wondering if there was a easier way to do it, say by just giving X & Y value T-Chart should be able to draw the mark.
To achieve that you may like to use a bubble series which already have their own marks implemented. In a bubble series you can specify the X and Y coordinates for the center and the radius for each bubble.
Also related question is, I use g.Ellipse or g.Line and draw the mark, I would need a way to even erase the mark, how can we achieve that? I guess one way would be to call invalidate, right?
Then you should also consider using Annotation tools as I told you in previous posts.
Show a point that does not lie on a series
Posted: Thu Mar 09, 2006 10:55 am
by 9788742
Hi Narcis,
If i use a bubble series and only one point in that series the bubble mark does not appear.
It needs more than one point to be added to the series for the marks to be visible. Am I right?
ANy thoughts?
Posted: Thu Mar 09, 2006 12:32 pm
by narcis
Hi Lakshmi,
No, it works fine using only one bubble in a chart but it's somewhat tricky as you need to use:
Code: Select all
private void Form1_Load(object sender, System.EventArgs e)
{
bubble1.Add(0,0,10,"My bubble",Color.Red);
bubble1.Marks.Visible=true;
tChart1.Axes.Bottom.SetMinMax(bubble1.XValues[0]-bubble1.RadiusValues[0],bubble1.XValues[0]+bubble1.RadiusValues[0]);
tChart1.Axes.Left.SetMinMax(bubble1.YValues[0]-bubble1.RadiusValues[0],bubble1.YValues[0]+bubble1.RadiusValues[0]);
}
You could also try using a shape series instead of a bubble series.
Show a point that does not lie on a series
Posted: Fri Mar 10, 2006 7:30 am
by 9788742
Thanks Narcis for suggesting shape series.
But I have a problem.
I have draw closely seperated vertical lines (0.1 distance) and the bubble/shape is drawn on the "band" of these closely seperated vertical lines.
So the bubble/shape gets hidden behind these vertical lines since they are so close. I tried setting the transparency value for the bubble/shape but it does not work.
Any ideas/suggestions?
Show a point that does not lie on a series
Posted: Fri Mar 10, 2006 7:39 am
by 9788742
Hi Narcis,
Would there be anyway to show the bubble/shape series on top of the closely seperated line series?
Thanks
Posted: Fri Mar 10, 2006 10:47 am
by narcis
Hi Lakshmi,
Yes, you could try using:
Show a point that does not lie on a series
Posted: Fri Mar 10, 2006 12:07 pm
by 9788742
How do I find out whether a given point exists on series?
Posted: Fri Mar 10, 2006 12:40 pm
by narcis
Hi Lakshmi,
You can try doing something like:
Code: Select all
if (line1.YValues.IndexOf(value) != -1)
{
//Value exists
}
Show a point that does not lie on a series
Posted: Mon Mar 13, 2006 4:48 am
by 9788742
Thanks Narcis,
Is there a way to explicitly set the Z-Order of a series? (rather than doing an exchange later on).
Posted: Mon Mar 13, 2006 11:51 am
by narcis
Hi Lakshmi,
Yes, you can use something like this:
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
int old_order = line1.ZOrder;
line1.ZOrder = line2.ZOrder;
line2.ZOrder = old_order;
}