series: [
{
name: 'Order Data',
lineWidth: 4,
data: [
5,
50,
10,
45,
10,
30,
{
y: 40,
marker: {
enabled: true,
symbol: 'circle',
radius: 1,
lineWidth: 10,
lineColor: 'var(--green100)',
},
},
],
color:"var(--green100)",
fillColor: {
linearGradient: { x1: 1, y1: 2, x2: 0, y2: 1 },
stops: [
[0, '#86CB62'],
[1, 'var(--green50)'],
],
},
dashStyle: 'solid',
},
],
plotOptions: {
spline: {
marker: {
enabled: false,
},
},
area :{
stacking:'normal'
}
},
i tried all ways to make my chart data background linear gradient,above code for my react application but the linear gradient background not showing
You haven't said what is the
typeof your series. By the fact that yourplotOptionshas the propertiessplineandarea, but there's only one series, I presume that you intended to have thetype: areaspline(type: areadoesn't support spline smoothing nor doestype: splinesupport color filling), but itsplotOptionsare combined:The only other problem in your code is that the four coordinates (
x1,x2,y1,y2) of thelinearGradientobject, should be in the interval [0, 1], as per the docs on colors or on LinearGradientColorObject:Thus, I changed your values to
for a bottom-left to top-right gradient.
Here's a vanilla js snippet with your code. I don't know where do you have the
--green100and--green50color variables from, I defined them explicitly to some rather bluish shades to get a good contrast; in any case, there's no problem with using cssvarcolors if they are defined in the scope where they are used; otherwise they are replaced with black.The same with React, in a stackblitz that's a fork of the highcharts starter example with typescript.