score:13
Accepted answer
It looks like you have everything in place. Here's how you can pull data from db:
@aggregated_invoices = Invoice.
where(:account_id => params[:id]).
order("invoice_date DESC").
group("invoice_date").
select("DATE_FORMAT(invoice_date, '%Y-%m-01') AS invoice_date, sum(amount_used) AS amount_used, sum(billed_amount) AS billed_amount")
# Then use these instead of sample data:
@categories = @aggregated_invoices.map {|i| i.invoice_date.strftime("%b/%Y")}
@amount_used_data = @aggregated_invoices.map(&:amount_used)
@billed_amount_data = @aggregated_invoices.map(&:billed_amount)
Source: stackoverflow.com
Related Query
- Rails ActiveRecord group_by & sum db results for use with Lazy HighCharts
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Data with timestamp group to month(like Jan, Feb, March) and showing as total count for month in Highcharts
- How to use Highcharts React to create chart with multiple lines for same XAxis?
- What's the code in Highcharts such that the bars (columns) in the same group use the same color?
- Highcharts column with drilldown results in blurred data label in main chart, except for the drilled down columns
- Returning correctly formatted json response for use in highcharts with Laravel
- Parsing JSON for use with Highcharts using jquery .parseJSON or JSON.parse: how to remove quotes from function calls for formatters?
- Use Node.js as data source for highcharts
- YQL finance data JSON format for use with highcharts
- HighCharts with CodeIgniter results nothing for MySQL fetched data
- Add additional data to a Highcharts series for use in formatters
- How to use highcharts with angular 5?
- How To Use Epoch Time With Highcharts Series Data?
- Can we use Highcharts with React-Native?
- Use an array of objects for series data in Highcharts
- Rails - convert date string into javascript date object for highcharts
- How to use highcharts with princeXML?
- Highcharts chart with 'datetime' xAxis - use categories on drilldown
- Alternatives to Highcharts for datasets with 10k data points?
- Use Twitter Bootstrap popover with Highcharts
- Using highcharts with rails not displaying plotLines
- How do I use an Highcharts Solid Gauge in angular 6 with typescript?
- Proper x-axis for Highcharts stack group column
- Highcharts - Global configuration with common code and unique data & Headings
- Is there any way we can use Highcharts with mPDF converter?
- Highcharts not displaying series data for graph with multiple Y-axes
- Can I use highcharts in a pdf generate with prawn in Rails?
- Rails generates chart for .each do |x| using highcharts or any other chart API
- Formatting JSON Data with ColdFusion for HighCharts
More Query from same tag
- How to display No Data Available Message in highcharts
- Proper format of json for Highchart.js with multiple series
- Plot Option in High Charts
- Adding text to the center of pie chart: Highcharts
- Highcharts userOptions does not update after changing the chart title
- How to add a second xAxis to Highcharts Stockchart
- How to convert datetime string to UTC to plot points on Highcharts
- Adding area gradient to line highchart
- Get the currently selected rangeSelector from an event unrelated to the chart
- styling of particular segments in highchart axis
- Custom field name in ECharts
- How to add custom exporting button in highCharts?
- Highchart drawing issue
- unable to draw pie chart in angularjs using highcharts
- Highcharts show x-axis with dates
- Indicator above bar in graph
- how to use function (chart) in react?
- Ember Highcharts Component throwing odd error
- Highcharts conditional data labels
- C# DotNet.Highcharts Column datalabel percentage
- Outline or border for the spline series in highcharts
- How to set the x value for High Charts error bar
- Highcharts data [x,y] written by golang
- How to plot x axis next to 0th y axis tick label in case of negative data?
- highcharts, gauge chart, update on slider
- jsPDF addHTML method not working with no error message
- "TypeError: firstAxis.options.plotBands is undefined" while using highchart
- Highchart Annotation Connector
- Highcharts - Grouping certain columns in a series together while maintaining proper column widths
- Is there a way of implementing shades of colors in treemap for childs of specific parent