Juan_mejia Juan_mejia - 2 months ago 13
JSON Question

Avoid unselect behavior on c3js graph

i'm creating a line chart with data points, each data point should have a different style depending of the data, i'm achieving this using the select API that you made available to us
as shown in this example enter link description here
the thing is that, the user can select and unselect other points, and i want to avoid this behavior
is that even posible?

var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
],
selection: {
enabled: true
}
},
point: {
focus: {
expand: {
enabled: false
}
}
}
});
chart.select(['data1'], [1, 3, 5]);

Answer

If all you want to do is lock the points in their current expanded/unexpanded states add

chart.internal.config.data_selection_enabled = false;

after your chart.select call

http://jsfiddle.net/jrdsxvys/316/