Highcharts JS- add third variable to tooltip for two series Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Display tooltip for invisible series in Highchartsmaking series in Highcharts clickableHow do I hide a Highcharts series from the chart, but always show it in the tooltip?Format tooltip according to series in HighchartsModify value shown in tooltip in highchartsAppend to default highcharts tooltipHighchart tooltip hover not working properlyShow Data For Grouped Series in ToolTip HighchartsTabular tooltip in highchartsHighcharts synchronize tooltip on multiple charts with multiple series
What order were files/directories output in dir?
Most bit efficient text communication method?
Project Euler #1 in C++
Getting prompted for verification code but where do I put it in?
In musical terms, what properties are varied by the human voice to produce different words / syllables?
A term for a woman complaining about things/begging in a cute/childish way
How does light 'choose' between wave and particle behaviour?
Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?
Do I really need to have a message in a novel to appeal to readers?
1-probability to calculate two events in a row
The test team as an enemy of development? And how can this be avoided?
Why weren't discrete x86 CPUs ever used in game hardware?
Co-worker has annoying ringtone
Karn the great creator - 'card from outside the game' in sealed
Putting class ranking in CV, but against dept guidelines
Why do aircraft stall warning systems use angle-of-attack vanes rather than detecting airflow separation directly?
Can a sorcerer use careful spell on himself?
How can I set the aperture on my DSLR when it's attached to a telescope instead of a lens?
How do living politicians protect their readily obtainable signatures from misuse?
What to do with repeated rejections for phd position
Why do early math courses focus on the cross sections of a cone and not on other 3D objects?
preposition before coffee
What do you call the main part of a joke?
The Nth Gryphon Number
Highcharts JS- add third variable to tooltip for two series
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Display tooltip for invisible series in Highchartsmaking series in Highcharts clickableHow do I hide a Highcharts series from the chart, but always show it in the tooltip?Format tooltip according to series in HighchartsModify value shown in tooltip in highchartsAppend to default highcharts tooltipHighchart tooltip hover not working properlyShow Data For Grouped Series in ToolTip HighchartsTabular tooltip in highchartsHighcharts synchronize tooltip on multiple charts with multiple series
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've already figured out how to make a chart using highcharts where there are three variables- one on the X axis, one on the Y axis, and one on the tooltip. The way to do this is to add the following to the tooltip:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
See this fiddle for the full code:
https://jsfiddle.net/m9e6thwn/
I would simply like to do the same, but with two series instead of one. I can't get it to work. I tried this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData1.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
const pointData2 = chartData2.find(row => row.timestamp === this.point.x)
return pointData2.somethingElse
Here is the fiddle of the above: https://jsfiddle.net/hdeg9x02/ As you can see, the third variable only appears on one of the two series. What am I getting wrong?
javascript highcharts
add a comment |
I've already figured out how to make a chart using highcharts where there are three variables- one on the X axis, one on the Y axis, and one on the tooltip. The way to do this is to add the following to the tooltip:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
See this fiddle for the full code:
https://jsfiddle.net/m9e6thwn/
I would simply like to do the same, but with two series instead of one. I can't get it to work. I tried this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData1.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
const pointData2 = chartData2.find(row => row.timestamp === this.point.x)
return pointData2.somethingElse
Here is the fiddle of the above: https://jsfiddle.net/hdeg9x02/ As you can see, the third variable only appears on one of the two series. What am I getting wrong?
javascript highcharts
add a comment |
I've already figured out how to make a chart using highcharts where there are three variables- one on the X axis, one on the Y axis, and one on the tooltip. The way to do this is to add the following to the tooltip:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
See this fiddle for the full code:
https://jsfiddle.net/m9e6thwn/
I would simply like to do the same, but with two series instead of one. I can't get it to work. I tried this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData1.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
const pointData2 = chartData2.find(row => row.timestamp === this.point.x)
return pointData2.somethingElse
Here is the fiddle of the above: https://jsfiddle.net/hdeg9x02/ As you can see, the third variable only appears on one of the two series. What am I getting wrong?
javascript highcharts
I've already figured out how to make a chart using highcharts where there are three variables- one on the X axis, one on the Y axis, and one on the tooltip. The way to do this is to add the following to the tooltip:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
See this fiddle for the full code:
https://jsfiddle.net/m9e6thwn/
I would simply like to do the same, but with two series instead of one. I can't get it to work. I tried this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
const pointData = chartData1.find(row => row.timestamp === this.point.x)
return pointData.somethingElse
const pointData2 = chartData2.find(row => row.timestamp === this.point.x)
return pointData2.somethingElse
Here is the fiddle of the above: https://jsfiddle.net/hdeg9x02/ As you can see, the third variable only appears on one of the two series. What am I getting wrong?
javascript highcharts
javascript highcharts
edited Mar 22 at 11:25
ewolden
4,71541326
4,71541326
asked Mar 22 at 11:01
mcplumsmcplums
395
395
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are some issues with the way you are using the formatter now. For one, you cannot have two return
s in the same function without any if clauses. That will mean that only the first return
will be used.
Anyway, here are some improvements I suggest you do for your code.
Add the extra information for each point to highcharts, that makes it a lot easier to access this information through highcharts. E.g. in a tooltip. You can set the data like this:
chartData1.map(function(row)
return
x: row.timestamp,
y: row.value,
somethingElse: row.somethingElse
)
If you do that, then returning the correct tooltip for each series is a simple matter of doing this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/6/
If you wanted more info in the tooltip you could then do:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse + ", time: " + str(this.x) + ", value: " + str(this.y)
Addtionally, you need to ensure that xAxis elements, i.e. your timestamps are sorted. This is a requirement for highcharts to function properly. As it is, your example is reporting
Highcharts error #15: www.highcharts.com/errors/15
in console, because chartData2 is in reverse order. It looks okay for this example, but more complicated examples can lead to the chart not looking as you expect it to.
For this example using reverse is easy enough: data: chartData2.
reverse()
.map(function(row) return x: row.timestamp, y: row.value, somethingElse: row.somethingElse)
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/7/
1
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
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%2f55298217%2fhighcharts-js-add-third-variable-to-tooltip-for-two-series%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
There are some issues with the way you are using the formatter now. For one, you cannot have two return
s in the same function without any if clauses. That will mean that only the first return
will be used.
Anyway, here are some improvements I suggest you do for your code.
Add the extra information for each point to highcharts, that makes it a lot easier to access this information through highcharts. E.g. in a tooltip. You can set the data like this:
chartData1.map(function(row)
return
x: row.timestamp,
y: row.value,
somethingElse: row.somethingElse
)
If you do that, then returning the correct tooltip for each series is a simple matter of doing this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/6/
If you wanted more info in the tooltip you could then do:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse + ", time: " + str(this.x) + ", value: " + str(this.y)
Addtionally, you need to ensure that xAxis elements, i.e. your timestamps are sorted. This is a requirement for highcharts to function properly. As it is, your example is reporting
Highcharts error #15: www.highcharts.com/errors/15
in console, because chartData2 is in reverse order. It looks okay for this example, but more complicated examples can lead to the chart not looking as you expect it to.
For this example using reverse is easy enough: data: chartData2.
reverse()
.map(function(row) return x: row.timestamp, y: row.value, somethingElse: row.somethingElse)
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/7/
1
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
add a comment |
There are some issues with the way you are using the formatter now. For one, you cannot have two return
s in the same function without any if clauses. That will mean that only the first return
will be used.
Anyway, here are some improvements I suggest you do for your code.
Add the extra information for each point to highcharts, that makes it a lot easier to access this information through highcharts. E.g. in a tooltip. You can set the data like this:
chartData1.map(function(row)
return
x: row.timestamp,
y: row.value,
somethingElse: row.somethingElse
)
If you do that, then returning the correct tooltip for each series is a simple matter of doing this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/6/
If you wanted more info in the tooltip you could then do:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse + ", time: " + str(this.x) + ", value: " + str(this.y)
Addtionally, you need to ensure that xAxis elements, i.e. your timestamps are sorted. This is a requirement for highcharts to function properly. As it is, your example is reporting
Highcharts error #15: www.highcharts.com/errors/15
in console, because chartData2 is in reverse order. It looks okay for this example, but more complicated examples can lead to the chart not looking as you expect it to.
For this example using reverse is easy enough: data: chartData2.
reverse()
.map(function(row) return x: row.timestamp, y: row.value, somethingElse: row.somethingElse)
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/7/
1
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
add a comment |
There are some issues with the way you are using the formatter now. For one, you cannot have two return
s in the same function without any if clauses. That will mean that only the first return
will be used.
Anyway, here are some improvements I suggest you do for your code.
Add the extra information for each point to highcharts, that makes it a lot easier to access this information through highcharts. E.g. in a tooltip. You can set the data like this:
chartData1.map(function(row)
return
x: row.timestamp,
y: row.value,
somethingElse: row.somethingElse
)
If you do that, then returning the correct tooltip for each series is a simple matter of doing this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/6/
If you wanted more info in the tooltip you could then do:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse + ", time: " + str(this.x) + ", value: " + str(this.y)
Addtionally, you need to ensure that xAxis elements, i.e. your timestamps are sorted. This is a requirement for highcharts to function properly. As it is, your example is reporting
Highcharts error #15: www.highcharts.com/errors/15
in console, because chartData2 is in reverse order. It looks okay for this example, but more complicated examples can lead to the chart not looking as you expect it to.
For this example using reverse is easy enough: data: chartData2.
reverse()
.map(function(row) return x: row.timestamp, y: row.value, somethingElse: row.somethingElse)
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/7/
There are some issues with the way you are using the formatter now. For one, you cannot have two return
s in the same function without any if clauses. That will mean that only the first return
will be used.
Anyway, here are some improvements I suggest you do for your code.
Add the extra information for each point to highcharts, that makes it a lot easier to access this information through highcharts. E.g. in a tooltip. You can set the data like this:
chartData1.map(function(row)
return
x: row.timestamp,
y: row.value,
somethingElse: row.somethingElse
)
If you do that, then returning the correct tooltip for each series is a simple matter of doing this:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/6/
If you wanted more info in the tooltip you could then do:
tooltip:
formatter ()
// this.point.x is the timestamp in my original chartData array
return this.point.somethingElse + ", time: " + str(this.x) + ", value: " + str(this.y)
Addtionally, you need to ensure that xAxis elements, i.e. your timestamps are sorted. This is a requirement for highcharts to function properly. As it is, your example is reporting
Highcharts error #15: www.highcharts.com/errors/15
in console, because chartData2 is in reverse order. It looks okay for this example, but more complicated examples can lead to the chart not looking as you expect it to.
For this example using reverse is easy enough: data: chartData2.
reverse()
.map(function(row) return x: row.timestamp, y: row.value, somethingElse: row.somethingElse)
Working JSFiddle example: https://jsfiddle.net/ewolden/dq7L64jg/7/
edited Mar 22 at 12:13
answered Mar 22 at 11:24
ewoldenewolden
4,71541326
4,71541326
1
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
add a comment |
1
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
1
1
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
Thanks very much for your help dude :) Check out what I made, with your help! I combined the order books of multiple cryptocurrency exchanges to show arbitrage opportunities drewsreviews.co.uk/arb/Graph.html
– mcplums
Mar 22 at 18:18
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%2f55298217%2fhighcharts-js-add-third-variable-to-tooltip-for-two-series%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