Wanted to plot only one spline at the chart load and further add other splines after loading
Main multispline chart
HI All, as shown in the image, I am plotting multispline chart using highcharts. What I want is to plot only 'a' while loading the chart and the rest will be invisible and I could add them later like this Higcharts Spline (only one).
Thank you in advance.
This previous answered question partly working in my case but I don't want to hide all the series. I want to have one visible series.
highcharts
add a comment |
Main multispline chart
HI All, as shown in the image, I am plotting multispline chart using highcharts. What I want is to plot only 'a' while loading the chart and the rest will be invisible and I could add them later like this Higcharts Spline (only one).
Thank you in advance.
This previous answered question partly working in my case but I don't want to hide all the series. I want to have one visible series.
highcharts
add a comment |
Main multispline chart
HI All, as shown in the image, I am plotting multispline chart using highcharts. What I want is to plot only 'a' while loading the chart and the rest will be invisible and I could add them later like this Higcharts Spline (only one).
Thank you in advance.
This previous answered question partly working in my case but I don't want to hide all the series. I want to have one visible series.
highcharts
Main multispline chart
HI All, as shown in the image, I am plotting multispline chart using highcharts. What I want is to plot only 'a' while loading the chart and the rest will be invisible and I could add them later like this Higcharts Spline (only one).
Thank you in advance.
This previous answered question partly working in my case but I don't want to hide all the series. I want to have one visible series.
highcharts
highcharts
edited Nov 14 '18 at 21:06
admpec
asked Nov 14 '18 at 20:32
admpecadmpec
54
54
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can use Highcharts.Chart.addSeries() method to add additional series dynamically:
Html:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="btn">Add series</button>
JS:
let data = [{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}, {
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
}, {
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
}, {
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
}];
let btn = document.querySelector('#btn');
let i = 1;
btn.addEventListener('click', () => {
if (i < data.length) {
chart.addSeries(data[i]);
i++;
}
});
let chart = Highcharts.chart('container', {
chart: {
type: 'spline'
},
plotOptions: {
series: {
marker: {
enabled: false
},
pointStart: 2010
}
},
series: [
data[0]
]
});
Demo:
https://jsfiddle.net/BlackLabel/rtsznykp/3/
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53308314%2fwanted-to-plot-only-one-spline-at-the-chart-load-and-further-add-other-splines-a%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use Highcharts.Chart.addSeries() method to add additional series dynamically:
Html:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="btn">Add series</button>
JS:
let data = [{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}, {
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
}, {
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
}, {
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
}];
let btn = document.querySelector('#btn');
let i = 1;
btn.addEventListener('click', () => {
if (i < data.length) {
chart.addSeries(data[i]);
i++;
}
});
let chart = Highcharts.chart('container', {
chart: {
type: 'spline'
},
plotOptions: {
series: {
marker: {
enabled: false
},
pointStart: 2010
}
},
series: [
data[0]
]
});
Demo:
https://jsfiddle.net/BlackLabel/rtsznykp/3/
add a comment |
You can use Highcharts.Chart.addSeries() method to add additional series dynamically:
Html:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="btn">Add series</button>
JS:
let data = [{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}, {
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
}, {
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
}, {
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
}];
let btn = document.querySelector('#btn');
let i = 1;
btn.addEventListener('click', () => {
if (i < data.length) {
chart.addSeries(data[i]);
i++;
}
});
let chart = Highcharts.chart('container', {
chart: {
type: 'spline'
},
plotOptions: {
series: {
marker: {
enabled: false
},
pointStart: 2010
}
},
series: [
data[0]
]
});
Demo:
https://jsfiddle.net/BlackLabel/rtsznykp/3/
add a comment |
You can use Highcharts.Chart.addSeries() method to add additional series dynamically:
Html:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="btn">Add series</button>
JS:
let data = [{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}, {
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
}, {
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
}, {
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
}];
let btn = document.querySelector('#btn');
let i = 1;
btn.addEventListener('click', () => {
if (i < data.length) {
chart.addSeries(data[i]);
i++;
}
});
let chart = Highcharts.chart('container', {
chart: {
type: 'spline'
},
plotOptions: {
series: {
marker: {
enabled: false
},
pointStart: 2010
}
},
series: [
data[0]
]
});
Demo:
https://jsfiddle.net/BlackLabel/rtsznykp/3/
You can use Highcharts.Chart.addSeries() method to add additional series dynamically:
Html:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="btn">Add series</button>
JS:
let data = [{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}, {
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
}, {
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
}, {
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
}];
let btn = document.querySelector('#btn');
let i = 1;
btn.addEventListener('click', () => {
if (i < data.length) {
chart.addSeries(data[i]);
i++;
}
});
let chart = Highcharts.chart('container', {
chart: {
type: 'spline'
},
plotOptions: {
series: {
marker: {
enabled: false
},
pointStart: 2010
}
},
series: [
data[0]
]
});
Demo:
https://jsfiddle.net/BlackLabel/rtsznykp/3/
answered Nov 15 '18 at 7:46
Wojciech ChmielWojciech Chmiel
1,310129
1,310129
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.
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%2f53308314%2fwanted-to-plot-only-one-spline-at-the-chart-load-and-further-add-other-splines-a%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