Hi all,
I'm currently stuck trying to configure the Y-axis to display only integers (please refer to the image below).
I've already tried several methods, including using JavaScript and the SetHighchartsYAxisConfigs action, but unfortunately, none of them worked.
If anyone has any suggestions or ideas, I would really appreciate your help! I'm using Chart V2
Thank you in advance.
I've attempted two approaches — using JavaScript and the SetHighchartsYAxisConfigs action — but neither worked.
Both approaches resulted in errors saying the chart could not be found.
🔧 JavaScript Approach
I placed this script after the aggregate fetch and within the block's OnRender event:
javascript
setTimeout(function() {
var chartContainer = document.querySelector("[id$='RequestByMonth_BarChart']");
var chart = Highcharts.charts.find(c => c && c.renderTo === chartContainer);
if (chart) {
chart.update({
yAxis: {
allowDecimals: false,
tickInterval: 1
}
});
} else {
console.warn("Chart not found yet.");
}, 3000);
However, it throws a warning: "Chart not found yet."
🛠 SetHighchartsYAxisConfigs Approach
I also tried using SetHighchartsYAxisConfigs with the same settings (allowDecimals: false, tickInterval: 1), but it had no effect. It seems the chart instance may not be available when the config is applied.
Hi,
I’ve figured it out!
To make it work, we need to set it up during the Initialize event. In the SetHighchartsYAxisConfigs action, we must pass the ID of the Y-axis, not the chart ID.
So, we’ll need to name the Y-axis explicitly in the chart configuration in order to retrieve and use its ID correctly.
Hi @Cuong Su ,
You'll need to use the client action that sets the chart properties as the handler of the chart's Initialized event. Make sure to use input parameter ChartWidgetId as well.
Hi @Mihai Melencu,
I tried place in initialized action and use ChartWidgetId but it still throw me the error that could not find the chart
Here is the error: Code: AXIS-API-12003 The AddOnAxis with id:'0.2gnillkpva8' was not found