NodeJS_dev NodeJS_dev - 6 months ago 22
Javascript Question

Changing the color of a background with highcharts.js

I’m trying to change the background colors of a highcharts scatter plot. I can easily change the color of the section with this code below. However, I need change the background to more than one color. Essentially I’m trying shade the area from 60-100 with dark gray and also color the area 100-120 with light gray and than 40-60 with light gray. This is going to be a confidence plot, so I feel as if this is a feature that should be fairly common but I cannot find a solution.

this code adds a light gray background to the plot..

plotBands: [{
from: 60,
to: 100,
color: '#d9d9d9'
}]


Fiddle: Fiddle Here...

Answer

Just pass another object to plotBands array: Updatated fiddle: http://jsfiddle.net/osevj9m3/1/

plotBands: [{
  from: 60,
  to: 100,
  color: '#d9d9d9'
}, 
{
  from: 100,
  to: 120,
  color: '#333'
}]