Last active
September 11, 2024 08:10
-
-
Save iamrealfarhanbd/66ca87c0448e0a323b1afb6613b364cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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