linuxoid
linuxoid

Reputation: 1447

Chartist.js: how to set pie chart slice colors

I have a variable length series array which I feed to the Chartist.js pie chart. It draws slices in terrible red colors.

There is an HSL color example in the Documentation, but it starts from red too. How do I start with a color #0099ff for the max value and then set different tints to the rest?

The slice color can be set by:

.on('draw', function(data) {
    if (data.type === 'slice') {
        data.element.attr({
            style: 'fill: hsl(?,?,?);'
        });
    }
})

I can't figure out how to manipulate the hsl() string to start with #0099ff and then change the max color tint based on the value.

Upvotes: 0

Views: 242

Answers (0)

Related Questions