Highcharts

Use highcharter inside a function

蹲街弑〆低调 提交于 2020-07-19 04:23:12
问题 How do I use highcharter::hchart inside a function? Here is a simple line graph using the hchart function. library(tidyverse) library(lubridate) library(highcharter) library(nycflights13) flights_2 <- flights %>% mutate(dep_mo = ymd(str_c(year, month, "01", sep = "-"))) %>% group_by(dep_mo) %>% summarize(arr_delay = mean(arr_delay, na.rm = TRUE)) hchart(flights_2, type = "line", hcaes(x = dep_mo, y = arr_delay), name = "Average Arrival Delay") When I try to write a function to create the same

use a service inside a funcion

末鹿安然 提交于 2020-07-10 07:00:12
问题 I'm using highcharts and angular. At this moment I want to use translateService inside the point formatter function: constructor(private translateService: TranslateService) { } private getOptions() { return { name: this.name, color: this.color, tooltip: { pointFormatter: function () { /* this line is my problem, how to use this.translateService here! */ const myTranslation = translateService.instant('KEY', {value:this.y}); return `<span>\u25CF</span> ${myTranslation}`; } }, }; } 回答1: You can

use a service inside a funcion

邮差的信 提交于 2020-07-10 07:00:11
问题 I'm using highcharts and angular. At this moment I want to use translateService inside the point formatter function: constructor(private translateService: TranslateService) { } private getOptions() { return { name: this.name, color: this.color, tooltip: { pointFormatter: function () { /* this line is my problem, how to use this.translateService here! */ const myTranslation = translateService.instant('KEY', {value:this.y}); return `<span>\u25CF</span> ${myTranslation}`; } }, }; } 回答1: You can

add vertical and horizontal lines in hplot (rcharts)

↘锁芯ラ 提交于 2020-07-07 14:28:16
问题 I'm trying to add horizontal and vertical lines in a highchart (rcharts) in a revealjs presentation. I tried to modify the code of this post in this way: require(xlsx) library(rCharts) Perhplot.df <-read.xlsx("C:\\RDirectory\\AREALAVORO\\JOB\\RISULTATI2.xlsx", sheetName="completo2") lDf <- split(Perhplot.df, Perhplot.df$variable) h16 <- hPlot(protection ~ days, data = lDf$Exposure, type = "bubble", group = "label", title = "By Days of Exposure", subtitle = "Move the mouse pointer on the

Highcharts - handle click on overlapping areaspline point

无人久伴 提交于 2020-07-03 23:55:33
问题 I need to get the point details every time I click on a certain point of a series, but clicking on a areaspline overlapped point doesn't trigger the 'click' event. It triggers only if the points of the series are in front. plotOptions: { series: { events: { click: function(event) { alert(this.name); } } } }, I made a small fiddle showing it. Thanks. 回答1: If you set trackByArea option to true it will enable catching click events even if the series is behind another series. plotOptions: {

Highcharts network graph custom link labels

隐身守侯 提交于 2020-06-29 04:45:47
问题 i'm trying to implement a network graph, and in my case the edges must be labeld. For example, i'm fetching data like this [{from: "A", to: "B", "label":"text1"},{from: "B", to: "C", "label": "text2"}] so in the graph it must be like this: A-----text1------B--------text2--------C I've read the docs and there's the linkFormatter that can help me do this but i can't figure it out. I've tried to memic this question's answer highchart network network-graph that shows label on tooltip not the

How to change the color of marker-points dynamically based on y-position

£可爱£侵袭症+ 提交于 2020-06-29 04:16:23
问题 I have below interactive plot using highchart js library in R library(highcharter) hchart(data.frame('Date' = seq(Sys.Date(), Sys.Date() - 10, by = '-1 day'), 'Value' = sample(c(-1, 1), 11, replace = T), 'variable' = 'aa') %>% mutate(color = ifelse(Value < 0, "#41c83b", "#E0245E")), "line", zIndex = 1, opacity = 0.9, hcaes(x = Date, y = Value, group = variable), zones = list(list(value = 0, color = hex_to_rgba("#41c83b", 1)), list(color = hex_to_rgba("#E0245E", 1))), marker = list(fillColor =

Highcharts Stacked Column chart from JSON not charting correct values

拟墨画扇 提交于 2020-06-28 09:54:39
问题 I am trying to chart a stacked column chart but I am getting the result I am getting is not matching the JSON data. I have 3 categories but the charting does not seem to happen in the last category. Why is that happening? My code: let cat = []; vals = json.map(val => { return val.type; }); console.log(vals); vals.forEach(v=>{ if (cat.indexOf(v) === -1) cat.push(v); }); console.log(cat); const group_data = (array, key) => { return array.reduce((a, c) => { (a[c[key]] = a[c[key]] || []).push(c);

Highcharts Stacked Column chart from JSON not charting correct values

佐手、 提交于 2020-06-28 09:54:33
问题 I am trying to chart a stacked column chart but I am getting the result I am getting is not matching the JSON data. I have 3 categories but the charting does not seem to happen in the last category. Why is that happening? My code: let cat = []; vals = json.map(val => { return val.type; }); console.log(vals); vals.forEach(v=>{ if (cat.indexOf(v) === -1) cat.push(v); }); console.log(cat); const group_data = (array, key) => { return array.reduce((a, c) => { (a[c[key]] = a[c[key]] || []).push(c);

Draw small symmetrical arc line path between two markers on world map in Highmaps

主宰稳场 提交于 2020-06-26 12:27:10
问题 I'm using Highmaps to create a flight path chart, using their demo Simple flight routes (jsfiddle) as a starting point. When I update the code to use a world map the line paths between locations/markers become distorted with an exaggerated curve. See my jsfiddle where I have only modified from the demo to the following: HTML <!-- line 5 --> <script src="https://code.highcharts.com/mapdata/custom/world.js"></script> JavaScript // line 39 mapData: Highcharts.maps['custom/world'], // line 47