Changing Value Label's Font Size, Weight And Rotation
Updated 07-22-2024
Hi SiftHealthcare,
Apologies for the delay here.
Below is the updated script. This script iterates through the series, so there is no need to specify a series name in the code. Let me know if you'd like a version of the script that formats only certain series in the widget, excluding the others.
//Customize value labels formatting
widget.on('processresult', function(w, e) {
// Iterate through each series in the chart data
e.result.series.forEach(function(series) {
// Check if the data labels object exists for the current series
if (!series.dataLabels) {
series.dataLabels = {};
}
// Enable the data labels
series.dataLabels.enabled = true;
series.dataLabels.style = {
// Change the labels color
color: "#000000",
// Change the labels size
fontSize: "25px",
// Change the labels weight
fontWeight: "bold"
};
// Change the labels rotation
series.dataLabels.rotation = 350;
// Change the y position offset of the labels
series.dataLabels.y = 40;
});
});