fix(@omiu/chart-card): fix chart label color error

This commit is contained in:
dntzhang 2021-08-01 19:18:22 +08:00
parent 6c4f1b4ef3
commit b7d35c7067
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@omiu/chart-card",
"version": "0.0.1",
"version": "0.0.2",
"main": "dist/index.es.js",
"exports": {
".": "./dist/index.es.js"

View File

@ -35,6 +35,7 @@ export default class ChartCard extends WeElement<Props> {
segment: {
borderColor: 'white',
},
backgroundColor: [],
borderColor: ['white', 'white', 'white', 'white', 'white', 'white'],
borderWidth: 1
}]
@ -57,6 +58,10 @@ export default class ChartCard extends WeElement<Props> {
render(props: Props) {
props.labels.forEach(_ => {
this.chartData.datasets[0].backgroundColor.push(props.color)
})
this.chartData.labels = props.labels
this.chartData.datasets[0].data = props.data
return <div class="card text-white" style={{ backgroundColor: props.color }}>