Hello,Is there a way to show value on a pareto chart? I would like to show the value on the columns of the pareto chartThanks
since Pareto charts have no ChartText, it is only possible using the Annotations collection. unfortunately you will have to manually set the Text of each annotation to the data value from the owning datapoint.
Thanks for the answer, would you have any piece of code to start to work with?
Thanks
DataTable table = Infragistics.UltraChart.Data.DemoTable.AllPositive();this.ultraChart1.Data.DataSource = table;this.ultraChart1.Data.DataBind();this.ultraChart1.ChartType = ChartType.ParetoChart;for (int current = 0; current < table.Columns.Count; current++){ BoxAnnotation anno = new BoxAnnotation(); anno.Text = table.Rows[0][current].ToString(); anno.Location.Type = LocationType.RowColumn; anno.Location.Row = 0; anno.Location.Column = current; anno.PE = new PaintElement(Color.Yellow); this.ultraChart1.Annotations.Add(anno);}
It's Infragistics.UltraChart.Core.Primitives
Hi,
Thanks so much for the code but what is the namespace to use for primitive ?using System.???
In this case you can try something like:
protected void Page_Load(object sender, EventArgs e)
{
this.UltraChart1.ChartType = ChartType.ParetoChart;
this.UltraChart1.DataSource = DemoTable.AllPositive();
this.UltraChart1.DataBind();
this.UltraChart1.FillSceneGraph += new FillSceneGraphEventHandler(UltraChart1_FillSceneGraph);
}
private void UltraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e)
List<Primitive> primitives = new List<Primitive>();
foreach (Primitive primitive in e.SceneGraph)
Polyline polyline = primitive as Polyline;
if (polyline == null)
continue;
foreach (DataPoint dataPoint in polyline.points)
double value = Math.Round((double)dataPoint.Value);
string strValue = string.Format("{0}%", value);
Ellipse ellipse = new Ellipse(dataPoint.point, 20);
ellipse.PE = new PaintElement(Color.Yellow);
primitives.Add(ellipse);
Text text = new Text(dataPoint.point, strValue);
text.labelStyle.HorizontalAlign = StringAlignment.Center;
text.labelStyle.VerticalAlign = StringAlignment.Center;
primitives.Add(text);
foreach (Primitive primitive in primitives)
e.SceneGraph.Add(primitive);