virendra parade
virendra parade

Reputation: 151

Apex chart fill colors facing issue in Angular

Can anyone please help me out here in bellow code for apex charts with angular:

fill: {
    colors: [function({ value, seriesIndex, w }) {
        if(value < 55) {
            return '#7E36AF'
        } else if (value >= 55 && value < 80) {
            return '#164666'
        } else {
            return '#D9534F'
        }
    }]
}

I my displaying the colors for column chart using apex charts in angular, but facing this error:

**"(local function)({ value, seriesIndex, w }: any): "#7E36AF" | "#164666" | "#D9534F"
Type '({ value, seriesIndex, w }: any) => "#7E36AF" | "#164666" | "#D9534F"' is not assignable to type 'string'.ts(2322)"**

If the same I try in JavaScript, it work's fine.

Upvotes: 1

Views: 1333

Answers (2)

Ritu Pandey
Ritu Pandey

Reputation: 1

Fill color on bar, this will work:

series : [ { x: 'A', value: 10, fill color: '#f000'}]

Upvotes: 0

junedchhipa
junedchhipa

Reputation: 5627

It seems like an issue with the types.

I have updated it on GitHub and a new version of ng-apexcharts will be released soon.

Upvotes: 1

Related Questions