chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
743 stars 199 forks source link

Allow borderColor to be customized through border options #37

Closed pateketrueke closed 6 years ago

pateketrueke commented 6 years ago

Thanks for contributing.

Description

Add a new border option to customize borderColor through, similar to color.

Testing

Now we're able to do this:

new Chart(ctx, {
  type: 'candlestick',
  data: {
    datasets: [{
      color: {
        up: 'rgba(52, 207, 51, 0.5)',
        down: 'rgba(173, 0, 44, 0.5)',
        unchanged: '#747f89',
      },
      border: {
        up: '#34CF33',
        down: '#AD002C',
        unchanged: '#747f89',
      },
      borderWidth: 1.5,
      // more options & data
    }],
  },
});

And colourfully we got this:

captura de pantalla 2018-05-28 a la s 23 52 56

benmccann commented 6 years ago

Cool!

I would suggest we still use the borderColor attribute instead of having border and borderColor. We could check if it's a string or object. If it's a string we use it for up, down, and unchanged. If it's an object we use the corresponding attributes inside. We should support the same syntax for color as well for consistency

pateketrueke commented 6 years ago

Hi, I just applied the changes as you told me.

Thanks for your feedback! 🎉