1. am i correctly rendering json in the controller?
i don't think so. i would also send a status and you need to tell what json it is. so i would go like:
def percent @series.each do |series| series.name series.pc1 end render status: 200, json: @series.as_json end
2. should i be calling a url in the script or a file (since i'm using a localhost server)?
a url, always a url. you won't be able to access a file. and your url seems correct.
3. i suspect there are others, e.g., should the percent method be in the before action in the controller?
it depends on what you are doing. if you want to respond with the percent method generated json by calling
/seriesroute, you need to call percent in the index method. if you want an explicit call to
/percent you just need to add it to the routes and you are good to go. btw, you did change the routes file for this, right?
you should at least have a get available for the series controller, or if you want full crud, a resource should be there.
also, i think you should keep with the convention of having the model name on the singular form, and your has_many: series, doesn't make sense to me. what are you trying to achieve there?
if a serie has_may series, then you should have a
serie_id in the model and also a belongs to.
hope this helps somehow.
- Extracting data from a JSON call to a Postgres table for use in Highcharts (without PHP)
- Highcharts format json data from php script / unixtime
- Highcharts displays series names but missing data points from json source
- how to create proper json data format from mysql for highcharts
- Send JSON data to highcharts pie from asp.net MVC controller in C#
- Converting svg from Highcharts data into data points
- Highcharts bargraph from json data in angularJS
- Passing data from db into Highcharts in Rails 3.x
- How to format my json data for stack column chart in HighCharts
- Loading data from API into a highcharts vue component
- Formatting JSON from a Pandas data frame for Highcharts within a Django template
- Getting a django view python dict into highcharts series data
- How to make Highcharts fetch data from external JSON file?
- How to create data in Json format for highcharts
- Highcharts JSON decimal data format issue
- passing json values to highcharts from .net code behind
- Highcharts polar chart wind rose data from JSON
- Get json data into Highcharts scatter plot
- How to create seriesfor Highcharts from JSON data to use
- Convert JSON data into format in Highcharts' basic line chart
- Getting Data from PHP, JSON Highcharts?
- Struggling to get this JSON data into highcharts
- Highcharts chart dynamic json data from sql
- Getting data from a JSON result in to a chart (Highcharts)
- Extract data series from a JSON array for a Highcharts chart with 2 y-axis
- Highcharts Time Series data from C# in a format required by HighCharts
More Query from same tag
- Highcharts Error #14 with SPServices
- Highcharts: Pie chart label overlap
- How to auto-format dates in custom tooltip formatter?
- Aligning labels in highchart donut
- Spider Highchart - different color for each gridline
- Highstocks - Place a line between columns when using datetime axis
- How can I change the width of the bars in a highchart?
- change button image
- How to update Highcharts data dynamically over a period of time
- HighCharts Rendering Issue
- Having Several Units on Highcharts Spiderweb
- pie chart highcharts from django query
- clear cache from Highchart when loading data from a json file
- yAxis calculated with one series only
- Highcharts ng heatmap draw line instead of boxes
- Shared legend of charts in react-highcharts?
- Unable to change Spiderweb in Highchart line color
- Pass time values to Highcharts Column chart
- json date format to Highcharts date format
- Highchart prevent auto reload
- Highcahrts sometimes loads but not always
- TypeError: Highcharts[h] is not a function
- JSON for high chart imported with json.load generated error when using json.dump
- Load json-data into Highchart
- Highcharts: How to Change type of Graph
- Highcharts organization change size image and position
- How to get multiple series data in tooltip highcharts?
- Updating highcharts gauge with JSON
- HighCharts column to pie
- highcharts change chart type using dropdown for multiple series