Got chart defined in html:
<div class="chart">
<canvas
baseChart
[chartType]="'line'"
[datasets]="chartData"
[labels]="chartLabels"
[options]="chartOptions"
[legend]="true"
(chartClick)="onChartClick($event)">
</canvas>
</div>
How can I change color of label in html?
You can change the font color of legend's label, in the following way ... In ts set
chartOptions.options.legend.labels.fontColor= 'white'; //set your desired color
In your case:
chartOptions = {
responsive: true,
maintainAspectRatio: false,
fontColor: 'red',
options:{
legend:{
labels:{
fontColor:'white';//change the color
}
}
}
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.