const origColors = Highcharts.getOptions().colors
const colors = origColors.map((color) => {
const c = Highcharts.color(color)
c.setOpacity(0.2)
return c
})
const options = {
chart: {
events: {
load () {
const chart = this
const series = this.series
series.forEach((s, i) => {
if (i < 3) s.update({ color: colors[i].get() })
else s.update(Object.assign({ data: chart.options.series[i - 3].data, color: origColors[i - 3] }))
})
}
}
},
series: [{
name: 's1',
showInLegend: false,
data: [...Array(5)].map(Math.random)
}, {
name: 's2',
showInLegend: false,
data: [...Array(5)].map(Math.random)
}, {
name: 's3',
showInLegend: false,
data: [...Array(5)].map(Math.random)
}, { name: 's1', visible: false }, { name: 's2', visible: false }, { name: 's3', visible: false }]
}
const chart = Highcharts.chart('container', options)
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>