Changing Value Label's Font Size, Weight And Rotation
Updated 07-22-2024
Hi SiftHealthcare, I wanted to follow up on my previous comment. The script I sent in that comment is limited to just positive values and classic (non stacked) chart. Please use the updated script below instead.
This script works for:
/*** This script is for increasing the y-axis max value by adding a percent of the highest value in the series to the y-axis max value.
Similarly, in cases where the minimum value is negative, it also decreases the y-axis min value by subtracting a percent of the lowest value in the series from the y-axis min value. ***/
//Set the offset percent to add/subtract to/from the y-axis max/min value here
var percentToAdd = 20;
widget.on('processresult', function(se,ev){
var numberOfSeries = ev.result.series.length;
var seriesData = [];
var dataPoints = [];
for(i=0; i < numberOfSeries; i++) {
seriesData[i] = ev.result.series[i].data;
var numOfDataPoints = seriesData[i].length;
if(widget.subtype.includes('stacked')) {
if(i==0) {
for(j=0; j < numOfDataPoints; j++) {
var dataToPush = seriesData[i][j].y;
dataPoints.push(dataToPush);
}
}
else {
for(j=0; j < numOfDataPoints; j++) {
dataPoints[j] = dataPoints[j] + seriesData[i][j].y;
}
}
}
else if(widget.subtype.includes('classic') || widget.subtype.includes('basic')) {
for(j=0; j < numOfDataPoints; j++) {
var dataToPush = seriesData[i][j].y;
dataPoints.push(dataToPush);
}
}
}
var maxValue = Math.max.apply(Math, dataPoints);
var minValue = Math.min.apply(Math, dataPoints);
if(ev.result.yAxis[0].max <= 0) {
ev.result.yAxis[0].max = 0
}
else {
ev.result.yAxis[0].max = maxValue * (1 + percentToAdd/100);
}
if(ev.result.yAxis[0].min >= 0) {
ev.result.yAxis[0].min = 0;
}
else {
ev.result.yAxis[0].min = minValue * (1 + percentToAdd/100);
}
})