score:18
You need to use fillColor
property in your datasets
array like this -
(and instead of borderColor
, try strokeColor
like below)
datasets: [{
label: label,
data: data,
fillColor: "rgba(14,72,100,1)", //version >2 useus background color
strokeColor: "brown",
borderWidth: 1
}]
A full working example can be seen from one of the demos of chartjs here
score:0
On the latest version, I used backgroundColor
instead of fillColor
score:1
You have used an array of colors. Chart.js can use that, but will then use a color per bar. If you want to have all bars in the same color, don't use an array, but a single value. Like this:
backgroundColor: "#33AEEF",
If you want each bar to have a different color, use the array instead, like this:
backgroundColor: ["#FF0000", "#00FF00", "#0000FF", "#33AEEF"],
I've also set the border to 0, but that's a personal preference, like this:
borderWidth: 0,
Source: stackoverflow.com
Related Query
- How to set default colour for bars in Chart.js
- How to set percentage value by default on each bars in horizontal bar chart js
- how to set chart.js grid color for line chart
- How do I set a bar chart to default to a suggested maximum in chart.js v1.01?
- How to use set the color for each bar in a bar chart using chartjs?
- How to set X coordinate for each bar with react chart js 2?
- How do you set x and y axis and Title for a line chart using charts.js?
- How to set default callback for tooltip title with chart.js
- How to set minimal value for bar chart in Chart.js? (ver. 2.0.2)
- How to set up an initial Zoom value for a chart (ChartJS + ChartJS Zoom plugin)?
- How to set minimum height for bars graph
- chartjs: set default min for the line chart
- How to draw bars of a chart for a chart to full height?
- How to set max and min value for Y axis
- Chart.js - How to set a line chart dataset as disabled on load
- chart js 2 how to set bar width
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- How to prevent first/last bars from being cut off in a chart with time scale
- How set color family to pie chart in chart.js
- How to create rounded bars for Bar Chart.js v2?
- Chart.js Bar Chart - how to chart bars from 0
- Chart.js how to show cursor pointer for labels & legends in line chart
- chartjs : how to set custom scale in bar chart
- chart js how to fill legend box with colour
- How to add second Y-axis for Bar and Line chart in Chart.js?
- ng2-charts: How to set fixed range for y axis
- Chart JS - set start of week for x axis time series
- Chart js. How to change font styles for "labels" array?
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- How to have solid colored bars in angular-chart bar chart
More Query from same tag
- Vue-Chartjs onComplete custom labels - prevent blinking
- ChartJs in ionic Framework
- Can't render two charts on the same page from chart.js
- I can't change the color of the grids in Chart.js
- Chart.js yAxes Ticks stepSize not working (fiddle)
- How to hide row in chartJS when filtering?
- How to update a chart using VueJS and ChartJS
- Reactjs- Bar Graph-chartjs- Data not coming in individual blocks
- can't set ChartJS canvas width
- (Chart.js) Is there a way to compare one chart with another so as not to have this inconsistent effect of small values being as big as big values?
- How can I user microseconds in ChartJs?
- Chartjs with Backbone
- Stacked bar chart starting from 0 - ChartJS React
- Chartjs adding icon to tooltip and label
- How to only have a Y axes representing data in chart.js
- Is there any way to display float bar in chart.js?
- Stack grouped xAxes in bar chart
- "Inline" labels in ChartJS
- Trying to display different types of charts using select/option tag
- Is it possible to create context menu with chart.js?
- How to apply data dynamically on initialisation for chart.js in angular?
- Convert FirestoreCollection into an array?
- Getting access to already created Chart.js chart
- generating a Chart.js chart with python data
- ChartJS - why is there a visual difference when displaying the same dataset alone or with more datasets?
- Vue ChartKick - different colours for bar chart
- Small value in doughnut chart is not visible - Chartjs
- chart.js mix chart (bar + line): get lines to start at x = 0
- How to change the Y-axis values from numbers to strings in Chart.js?
- Understanding Chart.js and Adding Legends to Pie Charts