Hi ,
I would like to have my x and y axes like this in a splinechart:
An idea how to do that in c# ?
Thanks
Hello,
Could you please review the sample attached to this post and see if it meets your requirements - It works for SplineChart also.Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi,
Thanks for your sample, it is almost that, in addition I would like to have the scale of each axis close to the axis like this :
Maybe one possible approach to achieve desired behavior could be if you are using FillScenGraphe event and include this piece of code:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { foreach (Primitive item in e.SceneGraph) { if (item.GetType() == typeof(Line) && ((Line)item).lineStyle.DrawStyle != LineDrawStyle.Dash) { if (((Line)item).p1.X == ((Line)item).p2.X ) { ((Line)item).p1.Offset(this.ultraChart1.Width / 2, 0); ((Line)item).p2.Offset(this.ultraChart1.Width / 2, 0); } else { ((Line)item).p1.Offset(0, -this.ultraChart1.Height / 3); ((Line)item).p2.Offset(0, -this.ultraChart1.Height / 3); } } Text pl = item as Text; if (pl != null && ((Text)item).labelStyle.Orientation == TextOrientation.VerticalLeftFacing) { ((Text)item).bounds = new Rectangle(((Text)item).bounds.X, ((Text)item).bounds.Y - (this.ultraChart1.Height / 3), ((Text)item).bounds.Width, ((Text)item).bounds.Height); } if (pl != null && ((Text)item).labelStyle.Orientation == TextOrientation.Horizontal) { ((Text)item).bounds = new Rectangle(((Text)item).bounds.X + this.ultraChart1.Width / 2, ((Text)item).bounds.Y, ((Text)item).bounds.Width, ((Text)item).bounds.Height); } } }
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
foreach (Primitive item in e.SceneGraph)
if (item.GetType() == typeof(Line) && ((Line)item).lineStyle.DrawStyle != LineDrawStyle.Dash)
if (((Line)item).p1.X == ((Line)item).p2.X )
((Line)item).p1.Offset(this.ultraChart1.Width / 2, 0);
((Line)item).p2.Offset(this.ultraChart1.Width / 2, 0);
}
else
((Line)item).p1.Offset(0, -this.ultraChart1.Height / 3);
((Line)item).p2.Offset(0, -this.ultraChart1.Height / 3);
Text pl = item as Text;
if (pl != null && ((Text)item).labelStyle.Orientation == TextOrientation.VerticalLeftFacing)
((Text)item).bounds = new Rectangle(((Text)item).bounds.X, ((Text)item).bounds.Y - (this.ultraChart1.Height / 3), ((Text)item).bounds.Width, ((Text)item).bounds.Height);
if (pl != null && ((Text)item).labelStyle.Orientation == TextOrientation.Horizontal)
((Text)item).bounds = new Rectangle(((Text)item).bounds.X + this.ultraChart1.Width / 2, ((Text)item).bounds.Y, ((Text)item).bounds.Width, ((Text)item).bounds.Height);
also you could used Range properties of your X and Y axis. Please take a look at the attached sample for more details and let me know if you have any questions.
Regards
You could achieve this if you change the location of your axis in the FillSceneGraphe event. Please take a look at the attached sample for more details and let me know if you have any questions.
Thanks it is almost that , however, my axis are not centered in zeros , it is the same in your sample. Can you please make it to cross X = 0 and Y = 0 please ?