Profile Picture

Passing double[] for x and y in windows form

Posted By sigfredo santiago 7 Years Ago
Author
Message
sigfredo santiago
Posted 7 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 1, Visits: 1
Can you plot double[array] as values for example in a stacked bar graph?

Thanks

Nevron Support
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi Sigfredo,

Yes you can import a double array to a stacked bar but it largely depends how the values in the array must be treated. The following code shows how to create a stacked bar chart from a double array where half of the values go into the first bar and the rest into the second:

   NChart chart = nChartControl1.Charts[0];

   double[] values = new double[] { 10, 20, 30, 10, 20, 30 };

   NBarSeries bar1 = new NBarSeries();
   int i = 0;
   for (; i < values.Length / 2; i++)
   {
    bar1.Values.Add(values[i]);
   }
   chart.Series.Add(bar1);

   NBarSeries bar2 = new NBarSeries();
   bar2.MultiBarMode = MultiBarMode.Stacked;
   for (; i < values.Length; i++)
   {
    bar2.Values.Add(values[i]);
   }
   chart.Series.Add(bar2);

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


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic