Reputation: 450
I have a situation to bind a json data with a key to plot a graph. But graph is plotting correctly but the name of the data is showing the same key. i need to avoid it .
How can i supply a name for my data. I have tried as follows but its seems not working. Can any guys help one this.
data: {
// columns: [chartData],
json: data,
keys: {
value: [key]
},
type: chartType,
labels: true,
selection: {
enabled: false
},
names: {
data1: 'Some Name'
}
}
Thanks in Advance :) Kiran Gopal
Upvotes: 2
Views: 446
Reputation: 41075
Instead of data1
, you should substitute the value of the variable key
. Or you could construct the names value, like so
var names = {}
names[key] = 'Some Name';
var chart = c3.generate({
...
names: names
},
});
Fiddle - http://jsfiddle.net/Ld2apq0g/
Upvotes: 1