I am developing a web app using AngularJS and FusionCharts
I want to display a graph that is based on monthly sales which I have done built by using this query
SELECT DATE_FORMAT(sales_time, '%b') AS Month, SUM(grand_total)
FROM pos_sales
GROUP BY DATE_FORMAT(sales_time, '%b')
ORDER BY sales_time ASC
Query above will give a result like this
Month | Grand_total
Apr 250.000
May 150.000
I want to use this populated months to be used as a data to generate a daily report based on the month populated.
The question is how can I populate data based on the month clicked? I have tried to use this query
SELECT sales_time, grand_total FROM pos_sales WHERE MONTH(sales_time)
the query above populate daily data but not in monthly order. What I want it to be is like kind of
Month | Item | Total
May Item1 250.000
May Item2 150.000
I can create the graph by hardcoded it but it is not what I want. I want it to be a dynamic graph based on my database.