How to add custom multiple select to highcharts legend?
up vote
-1
down vote
favorite
I have a chart like this, where I have 29 series in a legend field. And I want to make it look better, so my question is: how can I add custom multiple select instead of selection which is provided by highcharts?
highcharts legend
add a comment |
up vote
-1
down vote
favorite
I have a chart like this, where I have 29 series in a legend field. And I want to make it look better, so my question is: how can I add custom multiple select instead of selection which is provided by highcharts?
highcharts legend
@ewolden still, I need an answer.
– tohhy
Nov 19 at 14:32
@ewolden I want it to look like this and my chart configuration is done similar to this.
– tohhy
Nov 19 at 14:46
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a chart like this, where I have 29 series in a legend field. And I want to make it look better, so my question is: how can I add custom multiple select instead of selection which is provided by highcharts?
highcharts legend
I have a chart like this, where I have 29 series in a legend field. And I want to make it look better, so my question is: how can I add custom multiple select instead of selection which is provided by highcharts?
highcharts legend
highcharts legend
edited Nov 19 at 14:30
asked Nov 19 at 14:21
tohhy
146
146
@ewolden still, I need an answer.
– tohhy
Nov 19 at 14:32
@ewolden I want it to look like this and my chart configuration is done similar to this.
– tohhy
Nov 19 at 14:46
add a comment |
@ewolden still, I need an answer.
– tohhy
Nov 19 at 14:32
@ewolden I want it to look like this and my chart configuration is done similar to this.
– tohhy
Nov 19 at 14:46
@ewolden still, I need an answer.
– tohhy
Nov 19 at 14:32
@ewolden still, I need an answer.
– tohhy
Nov 19 at 14:32
@ewolden I want it to look like this and my chart configuration is done similar to this.
– tohhy
Nov 19 at 14:46
@ewolden I want it to look like this and my chart configuration is done similar to this.
– tohhy
Nov 19 at 14:46
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Yes, it is possible. You have to set enabled legend property to false, add html select list and write your own function to switch between series.
function chose() {
let selected = mySelect.options[mySelect.selectedIndex].text;
chart.series.forEach((series) => {
if (selected === series.name) {
if (series.visible) {
series.hide();
} else {
series.show()
}
}
})
}
btn.addEventListener('click', () => {
chose()
})
Check this example: https://jsfiddle.net/Bastss/daL7nzjr/ . Also, check this Highcharts solution to customize legend when the chart has a lot of series: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/legend/navigation/
Best regards!
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
accepted
Yes, it is possible. You have to set enabled legend property to false, add html select list and write your own function to switch between series.
function chose() {
let selected = mySelect.options[mySelect.selectedIndex].text;
chart.series.forEach((series) => {
if (selected === series.name) {
if (series.visible) {
series.hide();
} else {
series.show()
}
}
})
}
btn.addEventListener('click', () => {
chose()
})
Check this example: https://jsfiddle.net/Bastss/daL7nzjr/ . Also, check this Highcharts solution to customize legend when the chart has a lot of series: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/legend/navigation/
Best regards!
add a comment |
up vote
1
down vote
accepted
Yes, it is possible. You have to set enabled legend property to false, add html select list and write your own function to switch between series.
function chose() {
let selected = mySelect.options[mySelect.selectedIndex].text;
chart.series.forEach((series) => {
if (selected === series.name) {
if (series.visible) {
series.hide();
} else {
series.show()
}
}
})
}
btn.addEventListener('click', () => {
chose()
})
Check this example: https://jsfiddle.net/Bastss/daL7nzjr/ . Also, check this Highcharts solution to customize legend when the chart has a lot of series: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/legend/navigation/
Best regards!
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Yes, it is possible. You have to set enabled legend property to false, add html select list and write your own function to switch between series.
function chose() {
let selected = mySelect.options[mySelect.selectedIndex].text;
chart.series.forEach((series) => {
if (selected === series.name) {
if (series.visible) {
series.hide();
} else {
series.show()
}
}
})
}
btn.addEventListener('click', () => {
chose()
})
Check this example: https://jsfiddle.net/Bastss/daL7nzjr/ . Also, check this Highcharts solution to customize legend when the chart has a lot of series: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/legend/navigation/
Best regards!
Yes, it is possible. You have to set enabled legend property to false, add html select list and write your own function to switch between series.
function chose() {
let selected = mySelect.options[mySelect.selectedIndex].text;
chart.series.forEach((series) => {
if (selected === series.name) {
if (series.visible) {
series.hide();
} else {
series.show()
}
}
})
}
btn.addEventListener('click', () => {
chose()
})
Check this example: https://jsfiddle.net/Bastss/daL7nzjr/ . Also, check this Highcharts solution to customize legend when the chart has a lot of series: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/legend/navigation/
Best regards!
answered Nov 19 at 16:18
Sebastian Wędzel
711
711
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53376635%2fhow-to-add-custom-multiple-select-to-highcharts-legend%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
@ewolden still, I need an answer.
– tohhy
Nov 19 at 14:32
@ewolden I want it to look like this and my chart configuration is done similar to this.
– tohhy
Nov 19 at 14:46