Hello, I hope that they are nice, I mexican.
how I can change the color of the bars of my chart For example
If my bar 1 his value is of 50 to put it of red color, If it is 70 of blue color, etc.
I wait I have explained, I am grateful in advance for his help, Regards.
Thanks!!!!!!! Just what I wanted....
many thank you very much
Hi,
You could use the FillSceneGraph event of the chart to loop through all chart elements and if it is a bar, you could change its color (by the PE element) depending on its value. Here is a sample code:
UltraChart ultraChart1;public Form1(){ InitializeComponent(); ultraChart1 = new UltraChart(); ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.BarChart; this.ultraChart1.FillSceneGraph += new FillSceneGraphEventHandler(ultraChart1_FillSceneGraph); ultraChart1.DataSource = GetTable(); ultraChart1.DataBind(); this.Controls.Add(ultraChart1);}void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e){ foreach (Primitive p in e.SceneGraph) { Box bar = p as Box; if (bar != null) { NumericDataPoint dp = bar.DataPoint as NumericDataPoint; if (dp != null) { if (dp.Value == 50) { bar.PE.Fill = Color.Red; } if (dp.Value == 70) { bar.PE.Fill = Color.Blue; } } } }}