Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamrealfarhanbd/66ca87c0448e0a323b1afb6613b364cd to your computer and use it in GitHub Desktop.
Save iamrealfarhanbd/66ca87c0448e0a323b1afb6613b364cd to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($) {
// Use a delay to ensure the chart is fully rendered
setTimeout(function() {
// Find the canvas element dynamically
var canvas = $('#ninja-charts-container canvas').first();
var canvasId = canvas.attr('id');
// Get the Chart.js instance
var chart = Chart.getChart(canvasId);
// Ensure the chart instance exists
if (chart) {
// Update the chart options to remove thousand separators from Y-axis
chart.options.scales.y.ticks.callback = function(value) {
return value; // Remove thousand separators
};
// Update tooltip callbacks to remove thousand separators
chart.options.plugins.tooltip.callbacks.label = function(context) {
var label = context.dataset.label || '';
var value = context.raw;
return label + ': ' + value;
};
chart.update(); // Apply the changes
console.log("Chart updated to remove thousand separators from Y-axis and tooltip.");
} else {
console.error("Chart instance not found for canvas ID: " + canvasId);
}
}, 100); // Adjust the delay as needed
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment