Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
ColumnChart 3D
posted

How can I do to show percentage in a ColumnChart3d in the same way we show percentage in a pie chart?

See images.

Thanks.

Parents
  • 53790
    Suggested Answer
    posted

    Hello Dariogs,

    Maybe one possible approach to achieve this behavior is to handle ultraChart1_FillSceneGraph() event and include the code below:  

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)

    {

        TextList.Clear();

        string IsAddedKey = null;

        foreach (Primitive pr in e.SceneGraph)

        {

            if (pr.Row != -1 && pr.Column != -1 && IsAddedKey != (pr.Row.ToString() + "-" + pr.Column.ToString()))

            {

                decimal tempPercent= (Convert.ToDecimal(pr.Value) / CalcSum(dt.Rows[pr.Row]))*100;

                Text textLable = new Text(new Point((int)((Infragistics.UltraChart.Core.Primitives.Path)(pr)).GraphicsPath.PathPoints[0].X, (int)((Infragistics.UltraChart.Core.Primitives.Path)(pr)).GraphicsPath.PathPoints[0].Y), tempPercent.ToString("0.00") + " %");

                textLable.PE.Fill = Color.Black;

                IsAddedKey = pr.Row.ToString() + "-" + pr.Column.ToString();

                TextList.Add(textLable);

            }

        }

        foreach (var item in TextList.Distinct())

            e.SceneGraph.Add(item);

    }

    Please take a look at the attached sample for more details. Please let me know if you have any questions.

    Regards

    UltraChartColumn3DChartWithPercents.zip
Reply Children