Hi,
the range of my data is from -200 to 200 and I set ZeroAligned to true.
After set ZeroAligned to true, the x-axis line is start from 0 of y-axis, and it's position is in the center of this chart.
but the x-axis labels are still in the bottom...
the customer asks that these labels must near the x-axis line.
Could you please tell me how to set this x-axis labels position and let these labels can near the x-axis line?
thanks!
Hi, I am also needing help.
My problem is that When there is only one bar in graph that bar covers whole Form and I reduced width of bar and it is good and its position is at the starting of x-axis but the label of this bar is in the middle of x-axis instead of being just below the bar. I tried above mentioned code, I got the label value in text variable but there is null in Path value. I didn't see any other general value that uniquely identify that label. So could you please help me as soon as possible.
it works very well!!
Thanks for your patience and reply!
The FillSceneGraph is called before rendering the Chart.
I see where is the problem - when changing the Dy , the labels bounds are already calculated by the previous value of the Dy property and the first time we call the FillSceneGraph we actually do not changed the labels bounds but only a property which is used for their calculation. When we move the mouse, we redraw the chart, i.e. calculate the labels bounds but already with the proper Dy value and the labels move to the desired place.
In order to see the desired behavior, we should change directly the bounds on FillSceneGraph event handler as follows:
void chart_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ IAdvanceAxis axisX = e.Grid["X"] as IAdvanceAxis; int yLoc = ((Infragistics.UltraChart.Core.Layers.Axis)(axisX)).startPoint.Y; foreach (Primitive primitive in e.SceneGraph) { Text text = primitive as Text; if (text != null) { if (text.Row == -1 && text.Column == -1 && text.Path.EndsWith("Grid.X")) { text.bounds.Y = yLoc; } } }}
thanks for your reply, it's working!
but may I ask when FillSceneGraphEventArgs will be fired?
Every time I run this program, the chart showed quickly but at this time these labels are at the bottom of this chart.
After about 1-2 seconds, these labels jump to the correct position.
it's not a big problem, just a little strange..
do you have any other suggestion about this situation?
You could change the Dy in the FillSceneGraph event of the chart depending ot the Y value of the start point of the X axis. Something like this:
public Form1(){ InitializeComponent(); .......... ultraChart1.FillSceneGraph += new Infragistics.UltraChart.Shared.Events.FillSceneGraphEventHandler(chart_FillSceneGraph); ........}
void chart_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ ILayer chartLayer = e.ChartCore.GetChartLayer(); IAdvanceAxis axisX = e.Grid["X"] as IAdvanceAxis; if (chartLayer != null) { int yLoc = ((Infragistics.UltraChart.Core.Layers.Axis)(axisX)).startPoint.Y; Infragistics.UltraChart.Resources.Appearance.AxisAppearance axisApperance = ((Infragistics.UltraChart.Resources.Appearance.AxisAppearance)(((Infragistics.UltraChart.Core.Layers.Axis)(axisX)).GetAppearance())); axisApperance.Labels.LabelStyle.Dy = -yLoc + (int)axisApperance.Labels.Font.Size; }}
Let me know if this solves the problems.