Wednesday, 5 October 2022

In R Highchart how can I color diferent portion of Line Chart with different color

This is my code and highchart chart:

library(tidyverse)
library(gapminder)
library(highchart)

highchart() %>%
  hc_add_series(
    data = gapminder %>% filter(country == 'Chile'),
    hcaes(x = year, y = pop),
    color = 'red',
    type = 'line'
  )

I would like to color blue the the portion of my chart related to years above 1990.

The output should be a chart with red color line from 1952 to 1990 and blue color line from 1990 to 2005.

It would be necessary robust only one hc_add_series function.

Any help?



from In R Highchart how can I color diferent portion of Line Chart with different color

No comments:

Post a Comment