I created a line chart in BB.js (same api as C3.js) like this:
In document.ready
function createChart2(chartX,chartY){
var chart2 = bb.generate({
bindto: "#chart2",
data: {
columns:[chartX,chartY]
},
title: {
text: "Results house 1"
}
});
}
chartX and chartY are arrays of data and my linechart is generated fine. Now I want to create a button which allows the user to toggle one of the lines. So I did this:
<div id="option">
<input name="updateButton"
type="button"
value="Update"
onclick="updateData()" />
</div>
<script>
function updateData(){
chart2.toggle('chartX');
}
</script>
When I press the button I do not get an error but the line is not toggled. What can be wrong in this example?