I would like to add a line on the X-axis of a 3D chart.
I currently have it placing the line in the middle of the chart.
How do I place the line where the value of X-axis is equal to "04/20/2009" (today's date).
The values in the X-axis are strings and not dates.
private void DeptChart_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
ILayer chartLayer = e.ChartCore.GetChartLayer();
if (chartLayer != null)
Rectangle bounds = chartLayer.OuterBound;
Line line = new Line(new Point(bounds.Width / 2, bounds.Bottom), new Point(bounds.Width / 2, bounds.Top));
line.PE.Stroke = Color.Red;
e.SceneGraph.Add(line);
}
In your case you need to know the index of this label in your data. You can try using:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
IAdvanceAxis axisX = e.Grid["X"] as IAdvanceAxis;
int xIndex = 10; // the index of today's label
int xLoc = (int)axisX.Map(xIndex);
Line line = new Line(new Point(xLoc, bounds.Bottom), new Point(xLoc, bounds.Top));
I could not get this to work. I am using Infragistics 9.1 with chart type : ColumnChart3D
The value of xLoc is being set at -2147483648 . (the lowest possible int value)
It looks as if all the X-axis data is default or set to 0. I checked Y-axis and looks the same.
If I change chart type to 2D it works great! Is it because the chart type is 3D?
Any thoughts?
Sorry, I didn't see that you are looking for 3D chart.
There is no standard way that you can add a line in 3D chart. If you want to add custom elements in the chart you need to use 2D charts.