How can I do to show percentage in a ColumnChart3d in the same way we show percentage in a pie chart?
See images.
Thanks.
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); }
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
Have you been able to resolve your issue ? Did you have a time to take a look at the attached sample. Please let me know if you have any questions.