How do you create a bar chart of accounting data grouped by month?

I’ve looked everywhere and couldn’t find any information on how to create a chart of accounting data grouped by month. It could be accounting data but it could also be number of cars sold per month, etc. from a list of data.

For example how do I convert a list of accounting data where each POJO consists of the transaction amount and the date of the transaction into a bar chart with monthly totals?

Currently I’m streaming my collection into a TreeMap of YearMonth and then looping through the results creating new DataSeriesItems for each yearMonth entry.

Hi Stephan,

I don’t think there is a demo for that case, although it might be common, it seems to me quite specific depending on application business logic and model.

I don’t find anything wrong with your approach.

One alternative that comes to my mind is to delegate that grouping to the DBMS by creating a query that selects month of year and sum of transaction amounts for the period you want grouping by month of year. And then using that data for creating the data series.