Labels in Varable v.s. directly assigned.
This works: looking at the "labels" line if I put them in with quotes here like this, it will produce a chart. I need them in quotes because if I try to use 1/1/15 it gets calculated 1 divided by 1 divided by 15.
var data = {
labels: ['1-Jan-2015', '2-Jan-2015', '3-Jan-2015', '4-Jan-2015', '5-Jan-2015', '6-Jan-2015', '7-Jan-2015', '8-Jan-2015', '9-Jan-2015', '10-Jan-2015'],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [@d2]
}
]
};
This does not: If I assign the labels via a string variable it does not work. (I verified that label does contain exactly the same thing in the one above. You can see that with "data" it works fine since it contains a string of floats
@{string label = "'1-Jan-2015', '2-Jan-2015', '3-Jan-2015', '4-Jan-2015', '5-Jan-2015', '6-Jan-2015', '7-Jan-2015', '8-Jan-2015', '9-Jan-2015', '10-Jan-2015'";}
var data = {
labels: [@label],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [@d2]
}
]
}
Any help would be Greatly Appreciated!!!
@Wizardre it looks like you are creating one giant label in the 2nd snippet instead of an array of strings.
Hi All,
What about if i use a function returns array of labels. it is also not working, any help please;
labels: ChartLabels()
the function above is actually returning an array of labels.
Regards, Ather
Closing as implementation issue. labels needs to be an array of strings.