Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

How to change display of zero value in 3D chart?

Last post 07-11-2008 11:13 by [Infragistics] Paul Cavallaro. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 07-09-2008 10:43

    How to change display of zero value in 3D chart?

    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).

    Filed under:
    • Post Points: 20
  • 07-10-2008 15:07 In reply to

    Re: How to change display of zero value in 3D chart?

    Answer

    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.

    • Post Points: 20
  • 07-11-2008 5:02 In reply to

    Re: How to change display of zero value in 3D chart?

    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?

    • Post Points: 20
  • 07-11-2008 10:55 In reply to

    Re: How to change display of zero value in 3D chart?

    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

    • Post Points: 20
  • 07-11-2008 11:05 In reply to

    Re: How to change display of zero value in 3D chart?

    Answer

    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()

    Filed under: ,
    • Post Points: 20
  • 07-11-2008 11:13 In reply to

    Re: How to change display of zero value in 3D chart?

    Awesome! I'm glad you found a workaround, good luck with the rest of your charting.

    -Paul

    • Post Points: 5
Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems