c3.js/bb.js hide a line
up vote
1
down vote
favorite
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?
javascript c3.js billboard.js
add a comment |
up vote
1
down vote
favorite
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?
javascript c3.js billboard.js
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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?
javascript c3.js billboard.js
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?
javascript c3.js billboard.js
javascript c3.js billboard.js
asked Nov 19 at 11:14
hacking_mike
999
999
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
The issue was that I needed to hide the "label" from my data. And not the complete array.
So not:
chart2.toggle('chartX');
but:
chart2.toggle('Weight'); // which is the first entry in my "chartX" array
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The issue was that I needed to hide the "label" from my data. And not the complete array.
So not:
chart2.toggle('chartX');
but:
chart2.toggle('Weight'); // which is the first entry in my "chartX" array
add a comment |
up vote
1
down vote
The issue was that I needed to hide the "label" from my data. And not the complete array.
So not:
chart2.toggle('chartX');
but:
chart2.toggle('Weight'); // which is the first entry in my "chartX" array
add a comment |
up vote
1
down vote
up vote
1
down vote
The issue was that I needed to hide the "label" from my data. And not the complete array.
So not:
chart2.toggle('chartX');
but:
chart2.toggle('Weight'); // which is the first entry in my "chartX" array
The issue was that I needed to hide the "label" from my data. And not the complete array.
So not:
chart2.toggle('chartX');
but:
chart2.toggle('Weight'); // which is the first entry in my "chartX" array
answered Nov 19 at 12:14
hacking_mike
999
999
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373415%2fc3-js-bb-js-hide-a-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown