tooltip non risvolto al passaggio del mouse in Highcharts
-
26-10-2019 - |
Domanda
hanno un'occhiata a questo, il suggerimento non mostra affatto. i Donno se suggerimento dataFormat sia scavalcate da qualche altra funzione. e anche la data in asse x quando ingrandita non mostra minuti, che cosa devo fare per questo?
Soluzione
In Firefox, posso vedere che il vostro errore JavaScript nel formattatore tooltip è:
Uncaught TypeError: Cannot read property 'name' of undefined
Questo sembra in contrasto con la docs (forse perché non è condivisa?). Trovo che usando
this.points[0].series.name
corregge questo. Nota, si dovrà anche cambiare il vostro this.y a qualcosa di simile this.points[0].y
per questo al lavoro.
Altri suggerimenti
From a completely different perspective - I was also having problems with Highcharts tooltips using Chrome on my Ultrabook. This problem was not occurring in IE or FireFox.
I was not using shared series, so the solution above did not apply.
Turns out the problem is that Chrome recognizes the Ultrabook has a touchscreen, and enables the touch events. Highcharts (v2.2.5) does not enable the 'mouseover' event for devices that support touch, but instead enables the 'touchstart' event. As the 'touchstart' was not occuring when my mouse hovered over the icon, the tooltip never appeared.
This is the line in Highcharts that adds the handler based on the device type:
.on(hasTouch ? 'touchstart' : 'mouseover', function (e) {
series.onMouseOver();
if (e.target._i !== UNDEFINED) { // undefined on graph in scatterchart
points[e.target._i].onMouseOver();
}
})
Thus, it would probably work to explicitly add a 'mouseover' handler and trigger a 'touchstart' in these cases.
Highcharts checks for the existence of ontouchstart to determine touch-enabled devices:
hasTouch = doc.documentElement.ontouchstart !== UNDEFINED,
Try this:
formatter: function() {
var point = this.points[0],
x = point.x,
y = point.y,
seriesName = point.series.name;
return Highcharts.dateFormat('%A,%b %e,%Y, %H:%M', x) +'<br/> '+'<strong>'+ seriesName +'</strong>'+ y;
}
I have been using Highcharts a lot but have never used Highstock but like Mark said this goes against the docs. Looks like a bug.