chartjs/chartjs-chart-financial

How to change candle stick color?

Opened this issue · 1 comments

Hi,
I want to change the candle stick color by up in red and down in green.

I read these articles.
#114
#115
#37

I can not change the candle stick color by the ways these articles suggest.

I notice that these articles use chart.js@2.7.3 and chart.js@2.7.4

Today the chart.js is chart.sj@4.2.0

How do I change the candle stick color by up in red and down in green?

Thank you.

Here's a working sample of reversing the up and down candle colors: jsfiddle

You can use whatever colors you want for the up, down or unchanged candles by specifying the color property like this:

var chart = new Chart(ctx, {
  type: 'candlestick',
  data: {
    datasets: [{
      label: 'CHRT - Chart.js Corporation',
      data: barData,
      color: {
        up: 'rgba(215, 85, 65, 1)',
        down: 'rgba(80, 160, 115, 1)',
        unchanged: 'rgba(90, 90, 90, 1)'
      }
    }]
  }
});