I’m using a 3D Cylinder Column Chart. These charts are then used in creating a PDF by way of the Infragistics.Documents.Report object. Is it possible to display data values that are zero (0) as nothing, or as a different color? i.e. I don’t want a flat, round, red disk displayed when the value is zero (0).
Awesome! I'm glad you found a workaround, good luck with the rest of your charting.
-Paul
It turns out that I'm able to use the Infragistics.UltraChart.Core.Primitives.Path object.The IntelliSense indicates this is for 2D but it does work for the ChartType.CylinderColumnChart3D.
/// <summary>/// Change the chart based upon the data being displayed./// </summary>/// <param name="e"></param>public static void HandleZeroValueInData(ChartDrawItemEventArgs e){ if (e.Primitive.Value != null) { object oValue = e.Primitive.Value; if ((oValue is double) || (oValue is int) || (oValue is decimal)) { double theDataValue = Convert.ToDouble(oValue); if (theDataValue <= 0) { if (e.Primitive is Infragistics.UltraChart.Core.Primitives.Path) { Infragistics.UltraChart.Core.Primitives.Path thePath = (Infragistics.UltraChart.Core.Primitives.Path) e.Primitive; thePath.Brush = Brushes.WhiteSmoke; } } } }
} // end HandleZeroValueInData()
I'm sorry to report that it's not really possible at this time to do what you want to do without using the ColorModel. Take a look at this:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=978
So basically it'll scroll through all those colors that you specify, so you'll be forced to specify a color for every bar and then a specific color for bars that have a value of zero. I hope this helps and let me know how it goes, -Paul
That did the trick! Thank you very much.
Now if I can just figure out how to change the color ... I can do this for 2D but can't get it to work with 3D.
I'm using:
e.Primitive.PE.Fill and e.Primitive.PE.FillStopColor
Any ideas?
You should handle the ChartDrawItem event and remove the drawing of anything that has to do with the 0 valued data points. Here's some sample code:
protected void UltraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e) { if (e.Primitive.Value != null) { Double val = (Double)e.Primitive.Value; if (val == 0) { e.Primitive.Visible = false; } } }
WARNING: This is very hacked together code, you'd probably want to handle exceptions and do a better check to make sure what you're dealing with is actually going to give you a Primitive.Value that is a double, but this should set you on the right track.
Good luck, and let me know how it goes.