Skip to content

Possible to create area chart with negative value and color change? #4295

Closed Answered by rosco54
logemann asked this question in Q&A
Discussion options

You must be logged in to vote

Here is a starting point at least, based on what I just scraped together from Googling. Not sure it's satisfactory though.

var options = {
chart: {
height: 380,
type: "area"
},
series: [
{
name: "Series 1",
data: [23, -7, -45, -8, 32, 45,20, 23, -7, -45, -8, -32, 45,-20, -23, -7, -45, -8, 32, 45,]
}
],
plotOptions: {
area: {
fillTo: origin,
}
},
colors: ['#00FFAF'], // Starting color greenish
fill: {
type: 'gradient',
gradient: {
gradientToColors: ['#FF0000'], // Finishing color red
opacityFrom: 1,
opacityTo: 1,
stops: [0,100,100,100]
}
},
stroke: {
width: 0
},
xaxis: {
categories: [
"01 Jan",
"02 Jan",
"03 Jan",
"04 Jan",
"05 Jan",
"06 Jan",
"07 Jan"
]
}
};

var chart = new ApexCharts(doc…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@logemann
Comment options

@logemann
Comment options

@Crakenar
Comment options

Answer selected by logemann
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants