Je dessine un graphique Highchart Area simple, où je veux afficher/masquer l'info-bulle conditionnellement, basé sur une certaine valeur de la série sous-jacente (dans le cas ci-dessous, il est basé sur la valeur z
)Afficher/masquer conditionnellement Tooltip de Highcharter
Ci-dessous mon code R:
library(highcharter)
highchart() %>%
hc_chart(type = "area", plotBorderWidth = 0.5, plotBorderColor = '#4572A7') %>% # https://gist.github.com/mulhoon/63b5d5a98ef0ab8c2b89
hc_xAxis(categories = as.character(c(1.00, 2.00, 3.00)), lineWidth = 1, gridLineWidth = 0, minorGridLineWidth = 0) %>%
hc_xAxis(lineWidth = 1, gridLineWidth = 0, minorGridLineWidth = 0, labels = list(format = '{value}%')) %>% # https://stackoverflow.com/questions/17246187/displaying-percentage-in-y-axis-of-highcharts-column-chart
hc_add_series(name = 'foo', data = list(list(y = 3, z = 1), list(y = 4, z = 0), list(y = 5, z = 1))) %>%
hc_tooltip(formatter = "function(){
if (this.point.z == 1) {
return 'ON';
}
}") %>%
hc_plotOptions(series = list(marker = list(enabled = 'false', radius = 1, states = list(hover = list(enabled = 'false', radius = .1, color = '#4572A7')))))
Fondamentalement, ce que je veux est la suivante: Lorsque la valeur de z = 1
montrent alors l'info-bulle, sinon ne montrent pas. Cependant, le code ci-dessus échoue car il ne montre pas du tout l'info-bulle.
Une idée sur la façon d'implémenter ci-dessus show conditionnel de Tooltip?
Merci pour tout pointeur.
Merci. Cela correspond parfaitement à mon intention :) – Bogaso