So, i want to input data for the bar chart from a database, i got everything figured out, but something does not work...
Here's a part of the view file,
var barChartData = {
labels : {{print_r($action_names, true)}} ,
datasets: [
{
label : 'Electronics',
fillColor : 'rgba(2, 24, 222, 1)',
strokeColor : 'rgba(2, 24, 222, 1)',
pointColor : 'rgba(2, 24, 222, 1)',
pointStrokeColor : '#c1c7d1',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(2, 24, 222, 1)',
data : {{print_r($action_count,true)}}
}
]
}
this does not work, it displays a blank chart.
The output from {{print_r($action_names, true)}}
is ["OBJECT1","OBJECT1","OBJECT3"]
and the output of {{print_r($action_names, true)}}
is [1,2,3]
in the exact same formatting, now, if i just post the values in, as text, it works, the chart appears just fine, but when i use the variable, nothing - blank. I need to use the variable, because the database from which i fetch the data, is gonna change quite frequently.