Histogram
Which is the best way to create a histogram with FR Net?
For example, I have a list of ages:
10,2
27,3
30,7
80,2
I need a histogram chart, showing for each range of ages the count.
For example: 0-20, 20-40, 40-60, 60-80
I am trying to use directly the chart over the dataset, but I cannot find how to group the ages.
The other option is to pre-process the data using a function, but first, I would like to know if there are some way to automatize it.
Thank you
For example, I have a list of ages:
10,2
27,3
30,7
80,2
I need a histogram chart, showing for each range of ages the count.
For example: 0-20, 20-40, 40-60, 60-80
I am trying to use directly the chart over the dataset, but I cannot find how to group the ages.
The other option is to pre-process the data using a function, but first, I would like to know if there are some way to automatize it.
Thank you
Comments
The grouping feature of Microsoft Chart control is not working very well in case when you group by number interval, so it's better to prepare the grouped data before passing it to the chart.
I am creating a dll with the pre-processing functions. Now, I have several options, I have thought something like:
var dataset=Distribution.CreateHistogram((Report.GetDataSource("ds") as ViewDataSource).View, "Ages", min, intervals, width);
Report.RegisterData(dataset, "dsHistogram");
MSChart1.DataSource = Report.GetDataSource("dsHistogram");
I was thinking that maybe you can advice me with a best way to do it. Maybe I could create a "dummy" dataset in the editor and fill it from a function, ...
By the way, Distribution.CreateHistogram is a function that returns a DataView with the distribution registers.
Thank you
MSChart1.Series[0].ClearValues();
DataView view = Distribution.CreateHistogram((Report.GetDataSource("ds") as ViewDataSource).View, "Ages", min, intervals, width);
// now enumerate the dataview rows and add values to the chart
...
MSChart1.Series[0].AddValue(x, y);