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
995
Sum Values in ColumnChart
posted

Hello .

I am trying to sum the value of a column chart and then show the sum in a label, I am using the ChartDrawItem but can not seem to make it work. My Label1.text always shows 0, while when I use the debug, I can see that my total is incrementing.

 

protected void UltraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e)
{
Box box = e.Primitive as Box;
if (box == null)
{
return;}  

if (box.DataPoint == null)
{
return;} Convert.ToDouble(box.Value);}  

total+=Convert.ToDouble(box.Value);

protected void UltraChart1_PreRender(object sender, EventArgs e)
{
Label1.Text =
Convert.ToString(Convert.ToDouble(Label1.Text) + Convert.ToDouble(box.Value));
}

When I do a debug, it looks like it first goes the prerender event and then to the ChartDrawItem. event Which does not make sense to me.

Thanks
regards

Parents Reply Children
No Data