if you want to keep a bunch of patients, a container (an array is a container) or a disk file (which is technically a container but it is not the same as a programmatic data-structure) are your best options.
you can do a graph, max/min, and similar things without storing the data, but here again, a container is the best way to do the graph! You need a container of COUNTS of total charge in ranges (range can be distinct, or range of '1') if that is what you want to plot. If you want to plot the different categories distinctly, then you need to save everything instead.
consider
int bargraph[number of buckets];
get a patient's cost amount
figure out what bucket that value is in
bargraph[bucket]++;
and at the end of it all the array is your bar graph, you just plot the counts in it. This same technique (an array of buckets) has a dozen applications so file it away in the back of your mind.
The site seems to disallow deletion by spam / report if there is a reply below the offending message. This was likely the user bailout. That is an annoying trend.