I'd like to expose a payload like this from my Rails app that can be polled by an external dashboard to build a chart of widget sales over time:
{
chart: {
style: {
color: "#b9bbbb"
},
renderTo: "container",
backgroundColor: "transparent",
lineColor: "rgba(35,37,38,100)",
plotShadow: false
},
credits: {
enabled: false
},
title: {
style: {
color: "#b9bbbb"
},
text: "Weekly Widgets Sold"
},
xAxis: {
categories: ["Dec 1", "Dec 2", "Dec 3", "Dec 4", "Dec 5", "Dec 6", "Dec 7", "Dec 8", "Dec 9"]
},
yAxis: {
title: {
style: {
color: "#b9bbbb"
}
}
},
series: [{
color: "#108ec5",
name: "Widgets Sold",
data: [17, 22, 24, 24, 20, 14, 8, 2]
}, ]
}
Most Geckoboard polling is done via JSON but for Highcharts they want "Javascript". I'm not sure the Rails way to expose Javascript. I feel this wants to be a view but I'm not sure how and where to build this object.
Hoping for an example or sage words of advice.
Thanks!