Profile Picture

Bar Chart individual bar width

Posted By Naveen Anne 11 Years Ago
Author
Message
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 1 days ago @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Naveen,

You can take a look at the range series, which allows you to draw rectangles with arbitrary bounds - the following code for example creates a bar chart, where the second bar has a slightly bigger width:

   NChart chart = nChartControl1.Charts[0];

   NRangeSeries rangeBar = new NRangeSeries();

   rangeBar.Values.Add(0);
   rangeBar.Values.Add(0);
   rangeBar.Values.Add(0);
   
   rangeBar.Y2Values.Add(10);
   rangeBar.Y2Values.Add(20);
   rangeBar.Y2Values.Add(30);

   rangeBar.UseXValues = true;

   for (int i = 0; i < rangeBar.Y2Values.Count; i++)
   {
    if (i == 1)
    {
     rangeBar.XValues.Add(i - 0.3);
     rangeBar.X2Values.Add(i + 0.3);
    }
    else
    {
     rangeBar.XValues.Add(i - 0.2);
     rangeBar.X2Values.Add(i + 0.2);
    }
   }

   chart.Series.Add(rangeBar);

Hope this helps - let us know if you have any questions...



Best Regards,
Nevron Support Team



Naveen Anne
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 10
Hi There,

I've plotted a bar series graph but as per my requirement I've to change the width of a individual bar (not all the bars) dynamically based on some criteria. Please let me know how this can be achieved.

Thanks, in advance.
Naveen Anne.




Similar Topics


Reading This Topic