Home > Mobile >  HighChart And R weird Column chart breaks
HighChart And R weird Column chart breaks

Time:12-04

I am trying to figure out how to get rid of these breaks within my chart: enter image description here

Below is the R code to produce that chart. Thank you for your help.

hchart(dfDouble %>% filter(Year == 2021), "column", hcaes(x = Day, y = FC), name = "Current FC", showInLegend = TRUE) %>%
  hc_add_series(dfDouble %>% filter(Year == 2020), "column", hcaes(x = Day, y = FC), name = "Prev FC", showInLegend = TRUE) %>%
  hc_title(text = "Revenue YTD")

CodePudding user response:

Seting plotOptions.column.borderWidth to 0 should help remove breaks between stacked column segments.

According to the documentation: The width of the border surrounding each column or bar. Defaults to 1 when there is room for a border, but to 0 when the columns are so dense that a border would cover the next column.

   plotOptions: {
    column: {
      stacking: 'normal',
      borderWidth: 0,
    },
  },

Live demo: https://jsfiddle.net/BlackLabel/1kut32c8/

API References: https://api.highcharts.com/highcharts/plotOptions.column.borderWidth

CodePudding user response:

Yes, you can set borderWidth and that should fix the problem: https://api.highcharts.com/highcharts/plotOptions.column.borderWidth

Code in R:

library('highcharter')
highchart() %>%
  hc_chart(type = "column") %>% 
  hc_series(
    list(data=list(5, 4, 3, 5)),
    list(data=list(5, 4, 3, 5))
  ) %>% 
  hc_plotOptions(column = list(
    stacking = "normal",
    borderWidth = 0
    )
  ) 
  • Related