score:0
i created a jsfiddle to reproduce what you are trying to do. i can see that the colours are rendering fine after making one small change to your code:
i had to set marksdata.datasets[i] = {}
instead of marksdata.datasets[i] = []
for (i = 0; i < 6; i++){
marksdata.datasets[i] = {};
marksdata.datasets[i].label = domaines[i];
marksdata.datasets[i].data = [{}];
marksdata.datasets[i].backgroundcolor = colors[i];
}
edit: the issue was you were setting dataset as an array, while it should've been an object.
Source: stackoverflow.com
Related Query
- Background color does not work when trying to create my data before using scatter chart with chart.js
- Chart.plugins.register beforeDraw does not work when using ChartsJS 3.x
- Chart.js returns a console error and does not display the chart when using variables as data input
- ng2-charts does not work When data is between 2 and 5
- ChartJS does not display when using local Chart.js file
- Multiple data sets not working when using ChartJS
- Angular6 and ng2-charts does not display any charts when i fill data from webservice
- Trying to create a custom tooltip in a doughnut chart using chartsjs, but it is not working
- Chartjs disable legend click does not work when condition is not evaluated
- Chart.js - Line chart does not render all points when using Point[] format
- Hide Y-axis labels when data is not displayed in Chart.js
- Chart looks only grey, does not show the color - Chartjs,discordjs
- Why can I not see a data value when hovering over a point on the radar chart?
- Uncaught TypeError: Chart is not a constructor when using Chart.js
- Chart.js data background color is overwriting point background color
- unable to add background color to the canvas using jspdf and chartjs
- $(...).getContext("2d") is not a function when using chart.js
- Chart.js click event to open a custom tooltip does not work sometimes
- Chart.js Ionic 2 Angular2: Background color of bar graph not changing
- Chart.js chart does not display when inside an ngIf.
- How to add background color for doughnut mid using chart,js
- Echars can not render a smooth line when it process alot of data
- Chartjs bar-chart does not render when values are equal
- Chartjs and ChartDataLabels does not work in mdb5 pro version 2
- ChartJS not displaying time data using Moment.js
- Chart JS chart not rendering in ArcGIS popup when using navigation arrows
- Change the background color of tooltip dynamically using chart color
- Showing 'undefined%' in the graph if data does not exist
- Chartjs does not show annotations when x axis is of type time
- How to generate color code dynamically by swapping 2 characters within a string using PHP
More Query from same tag
- Chart.js - Uncaught ReferenceError: chart is not defined
- how to set chart.js grid color for line chart
- chart.js Legends issue (not showing)
- ng2-charts - Angular 4 working example
- ChartJS - Highlight Weekends and Lowest and Highest Values
- Chart JS - Bubble Chart is not getting rendered when loaded Dynamically
- React-chartjs-2 - Each dataset needs a unique key
- Can't increase font size in google bar chart
- change date on x-axis dynamically
- How do you plot scatter graph with chart.js
- Unable to display data via Charts.JS
- Chart.js unable to create chart
- Unable to set width and height on canvas in chart js
- Chart.js: Can't get a coordinate for value for x axis unless x axis has the exact same value
- (Typescript) How do you set pointRadius, pointHoverRadius, ect in ChartJs 3.7.0 & react-chart-js-2 4.0.1
- Chart.js how to show cursor pointer for labels & legends in line chart
- Chart.js date x-axis with sparse datapoints
- Chart.js is not working on my Browser
- How to pass an array to chart.js data:[] while creating a chart in php
- Angular 2 & ng2-charts: (SystemJS) Unexpected directive 'BaseChartComponent' imported
- ChartJS custom legend doughnut separate legend from chart area
- Chart.js with Node.js
- Is it possible to change chartjs line value in one column ? No transition
- chart.js line for only part of the labels
- How to align Chart.JS line chart labels to the center
- Plotting objects in Chart.js
- How do I add JSON Data into ChartJS
- JavaScript: Add Event Listener to an Event Listener
- React ChartJS Scatter Plot - cannot plot the data
- How to have solid colored bars in angular-chart bar chart