If the amount of data is going to be really huge and you can sacrifice some realtime-ish manner of presenting it, the best way would be to compute the data for charts in some seperate database table and show the charts out of it. You can setup a background process (using whenever or delayed_job or whatever you like) to periodically update the pre-processed data table with fresh values.
Another option would be caching the chart response by any means you like (using built-in Rails caching, writing your custom cache etc) to deliver the same data to a big number of users with reduced DB hit.
However, in general, preprocessing seems to be the winner as stats tables usually contain very "sparse" data which can be pre-computed to a much smaller set to display on a chart yet having the option to apply some filtering / sorting if needed.
EDIT just forgot to mention there might be some room for optimization on the database side. For instance, if you can limit the periods the user is able to view data for (= cap the amount to be queried per used), than proper indexing and DB setup can deliver substantial performance without man-in-the middle things like caching or precomputing.
- Highcharts - Global configuration with common code and unique data & Headings
- Change color code on colum, depending on data value (highchartJS)
- Highcharts area chart hide graphs with one data point
- Displaying dynamic data using charts and graphs in ruby on rails
- Highcharts display label for pie chart using html table as data source
- Two way data binding in Angular JS for graphs implemented using HighCharts
- Include additional highcharts source data in angular2 app
- Strange character in the Highstock source code
- Highcharts series visibility with csv data source
- HTML table as data source for highstock charts using highcharts
- DotNet.HighCharts - PieChart by populating data by code
- How to have multiple highcharts with different series data in vuejs without repeating code
- Generate highcharts from v-for not populating all graphs with data
- FusionCharts Failed to draw different chart on same data source
- Dynamically populated highcharts data and database storing
- Remove data labels when ploting and exporting graphs
- Using a flask variable as data source for highcharts
- Highcharts cloud issue with data source when duplicating chart
- HighCharts Bubble graph JSON as data source
- Use HTML class as Highcharts table data source
- Use Node.js as data source for highcharts
- how do i link my sqlite(PDO) databse data to highcharts code
- How to generate Highcharts JS live data graphs from data on other website?
- HighChart.js data source recommendations
- Stacked grouped histogram HighCharts graphs with dynamic data using ASP.NET MVC3?
- How to render Gantt Highchart from data source
- I have no direct access to code but wonder if I can append my chart data points to a log file
- HighCharts - When I download csv, can I switch data source to new one?
- adding series to highcharts from JSON
- Highchart Json Format for Highchart stock chart
- highcharts scatter 1 second update with user defined lables on x-axis for each point
- Remove shadow/background glow on highcharts data label?
- Highcharts: arrow being rendered on the wrong charts
- highcharts export differs from presented one
- Angular Highcharts Radial Bar Chart not working as expected
- Highcharts shared tooltip(for line series) - Change on hover ACCORDING TO PLOTBAND
- How to reflow HighCharts when using highcharts-vue?
- Highstock/highcharts show multiple y-axis values in single tooltip
- Highcharts solid-gauge Error: c.color.tweenTo is not a function
- Highcharts packed bubble chart not working for negative values
- Counter with highcharts
- rCharts highlight charts in shiny not working
- Highcharts - is possible to have stackLabels only for a subset of the series?
- maxPointWidth causing more gaps for bars within each x point, in basic Column chart
- highcharts tooltip text align
- Overlapping columns in highchart
- ReferenceError: Can't find variable: modules
- How can I change the color of legend points?