Skip to content Skip to sidebar Skip to footer

Array For Highcharts:

I just play around with Highcharts (http://www.highcharts.com) inside of a test app based on rails 3.1.1 and HAML. I'm still new to js and I try to accomplish a nice integration of

Solution 1:

I believe you want something like this:

data: $.map(category_transactions_sum, function(i, c) { return [c.title, c.amount]; })

Solution 2:

you can try this (works for me):

temp = $.map(json, function(i) { return[[i.in_time, i.status]]; })         
showData = JSON.parse(JSON.stringify(temp, null, ""));

and then use in the series as :

chart.addSeries({
    data: showData
}); 

Solution 3:

Alex almost has it.

Should be:

someVar = [{title: "Salary", amount: 50},{title: "Food", amount: 25},{title: "Recreation", amount: 10}]
data = $.map(someVar, function(i) { return[[i.title, i.amount]]; })
$(document).ready(function() {
 chart = new Highcharts.Chart({
    chart: {
       renderTo: 'container'
    },
     series: [{
       type: 'pie',
       name: 'Expenses',
       data: data
    }]
 });

Post a Comment for "Array For Highcharts:"