-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One Dataset with multiple columns/rows are all same colour #11
Comments
|
Sorry I am confused by your screenshot. Are you saying it is possible with one dataset or confirming that it isn't? |
I am sorry to make you confused
actually i confirming that i have the same problem
*Best Regards*
…On Mon, Jul 8, 2019 at 12:14 AM Robin Wilson ***@***.***> wrote:
Sorry I am confused by your screenshot. Are you saying it is possible with
one dataset or confirming that it isn't?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11?email_source=notifications&email_token=ACQ2YPUVZXOCC6NOOMC3K7LP6JMEDA5CNFSM4H2RXEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZLTHCQ#issuecomment-509031306>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACQ2YPSWD5E6MKQC5PNTI3DP6JMEDANCNFSM4H2RXEIA>
.
|
Oh right sorry. I did find a way around it actually which was to use a palette.js script I found instead: Now I load in my data using Ajax and count the number of bars/records in order to use the .js file to generate colours for all bars. This code works:
Hope it helps. |
I think it will not be bad idea to store some pallets hardcoded in json objects and use it... |
I had the same problem, but I got it working after adding
on the switch case, it's now like this:
|
Based on a workaround from this reply to another issue: It is possible to access the underlying arrays of colours in the plugin. So you can directly apply the colours to a single dataset. var myChart = new Chart(document.getElementById('myChart'), {
type: 'bar',
data: {
labels: ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven'],
datasets: [{
label: '# of things',
data: [12, 19, 3, 5, 2, 3, 4],
backgroundColor: Chart['colorschemes'].tableau.Tableau10,
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
}); As the palettes are simple arrays of hex strings they can be manipulated and extended to suit your data. |
I have spotted an issue and not sure if there is a way around it.
If one dataset has multiple rows, lines, columns then the bars/lines are all coloured the same colour:
e.g.
Is there a way around this or do I need to design my charts differently or find another solution to colour the bars?
I can colour them by specifying an array of background colours.
Thanks
Robin
The text was updated successfully, but these errors were encountered: