Hai
I have a bar chart which has data columns dynamically max of 12. If one column is available means it shows one bar in full chart width. It shows ike the screen chart. How can I handle this for dynamic columns? I compared this with Excel chart for look and alignment but infragistics failed to meet my requirements. But I need like this. Then I need space between Y axis to the bar how can I do this? The bar should be aligned in middle of X Axis. How to do this? Please help me from this issue.
Sridhar
you need to set p2.X on the line as well as p1.X. you can use this code:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { Axis yAxis = e.Grid["Y"] as Axis; Axis xAxis = e.Grid["X"] as Axis; foreach (Primitive currentPrimitive in e.SceneGraph) { Line l = currentPrimitive as Line; if (l != null && l.p1.Y == l.p2.Y) { // this should be the x axis line l.p1.X = yAxis.startPoint.X; l.p2.X = e.ChartCore.GetChartLayer().GetOuterBounds().Right; } } }
I used that. It is working fine for static columns(Fixed no of bars) but for dynamic column/bars the x axis stops upto bar since it has space after right side. The X axis line dint end like usual. I set margin right as 40. Please refer screen shot.
if (dtStatus.Columns.Count == 1)
{
ucAuditBudgetCode.Axis.X.Margin.Far.Value = 40;
ucAuditBudgetCode.Axis.X.Margin.Near.Value = 40;
}
-------------------
protected void Chart_FillSceneGraph(object sender, FillSceneGraphEventArgs
e)
Axis yAxis = e.Grid["Y"] as Axis
;
Axis xAxis = e.Grid["X"] as Axis
foreach (Primitive currentPrimitive in
e.SceneGraph)
Line l = currentPrimitive as Line
if (l != null
&& l.p1.Y == l.p2.Y)
// this should be the x axis line
l.p1.X = yAxis.startPoint.X;
--I tried some thing here but dint work
//else if (l != null && l.p1.Y == l.p2.Y)
//{
// l.p2.X = xAxis.endPoint.X;
//}
view the last post on this thread http://community.infragistics.com/forums/p/18194/66543.aspx#66543 for a solution that uses the FillSceneGraph event to extend the line back to its original size.
This created margin with Y axis. Great. But X axis border line missing. I need that border also. How can I get this?