ng2-charts
ng2-charts copied to clipboard
Global chart dataoptions cannot be set
The global/default chart dataoption configuration feature of chart.js cannot be set currently.
http://www.chartjs.org/docs/#chart-configuration-global-configuration
I will begin work on this ~April 26th.
Is there any workaround for this right now? I would like to set some global font settings.
yes, i'd love to see a workaround for this
for (let i = 0; i < this.chart.data.datasets.length; i++) {
this.chart.data.datasets[i].borderWidth = 2;
}
Came across this issue and it made me look at .ts source code. Here is how you can set default for the charts.
// Import
import Chart from "chart.js";
// ngOnInit() method
ngOnInit() {
// Set default font size to 10 pixel
Chart.defaults.global.defaultFontSize = 10;
}
I use ng2-charts version ^2.3.0.
Hope this helps :)
Fixed in v3+