Hi,
I was wondering if it is possible to add in fields to the PieOptions if I wanted to use it with chartjs-plugin-datalabels extension.
So with Pie Chart, we can do something like this.
PieChart chart = new PieChart();
chart.setData(new PieData())); // Set some data / dataset
chart.setOptions(new PieOptions()); // Set `cutoutPercentage` and `rotation`.
So for the PieOptions, you have specified fields that can be set for Pie Chart options which makes the end result in JSON look like... If I were to set in cutoutPercentage and rotation.
options: {
responsive: true,
cutoutPercentage: 10,
rotation: 10
}
So for the chartjs-plugin-datalabels, they have some additional fields that can be set like this example from their page. *This isn't exactly PieChart, but it doesn't really matter what type of chart here.
options: {
plugins: {
datalabels: {
anchor: 'end',
borderColor: 'white',
borderRadius: 25,
borderWidth: 2,
color: 'white',
font: {
weight: 'bold'
},
}
}
}
So if I mix it up, it would become... (I suppose)
options: {
plugins: {
datalabels: {
anchor: 'end',
borderColor: 'white',
borderRadius: 25,
borderWidth: 2,
color: 'white',
font: {
weight: 'bold'
},
}
},
responsive: true,
cutoutPercentage: 10,
rotation: 10
}
Question is, how can I extend the PieOptions to add in new fields that allow me to set in the
plugins: {
datalabels: {
anchor: 'end',
borderColor: 'white',
borderRadius: 25,
borderWidth: 2,
color: 'white',
font: {
weight: 'bold'
},
}
},
specified portion of the plugin....
Thanks.. And let me know if there is any other better way to do so.
Hi,
I was wondering if it is possible to add in fields to the PieOptions if I wanted to use it with chartjs-plugin-datalabels extension.
So with Pie Chart, we can do something like this.
So for the PieOptions, you have specified fields that can be set for Pie Chart options which makes the end result in JSON look like... If I were to set in
cutoutPercentageandrotation.So for the
chartjs-plugin-datalabels, they have some additional fields that can be set like this example from their page. *This isn't exactly PieChart, but it doesn't really matter what type of chart here.So if I mix it up, it would become... (I suppose)
Question is, how can I extend the PieOptions to add in new fields that allow me to set in the
specified portion of the plugin....
Thanks.. And let me know if there is any other better way to do so.