score:2
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.
Source: stackoverflow.com
Related Query
- Highcharts display label for pie chart using html table as data source
- Two way data binding in Angular JS for graphs implemented using HighCharts
- HTML table as data source for highstock charts using highcharts
- Using a flask variable as data source for highcharts
- Error: Data source must be a URL for refresh | console error | javascript | Highcharts
- Use Node.js as data source for highcharts
- How do I hide the code for the chart data in highcharts?
- How to make highcharts default to 0 for missing data
- Changing data dynamically for a series in Highcharts
- Add additional data to a Highcharts series for use in formatters
- Improve highcharts performance for large amounts of data
- Highcharts not displaying data labels for Pie chart in arabic
- Use an array of objects for series data in Highcharts
- Highchart (Column Chart) : Few data labels are not appearing for a series
- Formatting JSON data monthwise for HighCharts using MySQL
- Highcharts - Provide URL's for series data to open clickable link
- Pass Data String as parameter to a Function for HighCharts
- Advanced LINQ Grouping and Projection Query for Hierarchical Data (EF 4.0 + LINQ + ASP.NET MVC + HighCharts)
- Highcharts-Vue wait for data then update series
- Sort the series data for every X-Axis in Highcharts
- Alternatives to Highcharts for datasets with 10k data points?
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Highcharts - Global configuration with common code and unique data & Headings
- Columns HighChart remove spacing for empty data series
- Highcharts not displaying series data for graph with multiple Y-axes
- Sql query to populate 0's for missing data
- highcharts - precision for stacked column chart data labels
- Formatting JSON Data with ColdFusion for HighCharts
- Format Highcharts xAxis for stock data
- Creating a Highchart for every data set
More Query from same tag
- Highcharts - On and Off over Time
- Highcharts - hover event handling for tooltip throws exception
- Reactive charts with Meteor : d3charts , Hightcharts , ChartJS , other?
- Highcharts: Stacked area drilldown to multiple series
- Config gauge series highchart
- Loading map data from highcharts.com
- Highcharts: How to draw a line on top of a column?
- Printing table with charts in html through FireFox
- highcharts xaxis datetime label with minor tick
- Change color of the values in heatmap or remove the values in highcharter R package
- Highcharts: To rotate the chart 90 degree but also redraw it
- When trying to display a chart using ChartIt, Error saying template does not exist arises
- High charts Change the color of horizontal bar
- How to change the palette colors of a highcharter column plot which depends on a variable?
- set highchart margin
- chart xAxis extremes change/fix
- Highchart - add "onclick event" for total value stackLabel
- Highcharts Graph displaying 0 value continuously : Javascript Array
- Highcharter format number in tooltip
- Websharper HighCharts Example
- HighCharts JSONArray without quotes
- Disabled points not hide. [Highcharts]
- Highcharts step line with gaps and series like [x,y]
- Is there a complete/ready event even if I turn off the animation effect for a HighChart instance?
- How to Increase minimum point value and the color of series in advanced accessible charts in Highcharts by making it traverse
- Only show integer steps on axis
- bar pointPlacement works bad in get one data
- Filter data in Highcharts
- HighMaps Only Displaying Color For Last Series In US Map
- Highcharts add single line to column chart