Skip to content

Comments

Allow borderColor to be customized through border options#37

Merged
benmccann merged 2 commits intochartjs:masterfrom
pateketrueke:feature/custom_border_colors
Jun 15, 2018
Merged

Allow borderColor to be customized through border options#37
benmccann merged 2 commits intochartjs:masterfrom
pateketrueke:feature/custom_border_colors

Conversation

@pateketrueke
Copy link
Contributor

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
Copy link
Collaborator

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
Copy link
Contributor Author

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

Thanks for your feedback! 🎉

@benmccann benmccann merged commit 90f1c75 into chartjs:master Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants