learntimes commented on issue #18199:
URL: https://github.com/apache/echarts/issues/18199#issuecomment-2065613418
// Temporarily override getContext method to set willReadFrequently
// Use this method with caution to ensure it does not interfere with other
parts of your application.
const originalGetContext = HTMLCanvasElement.prototype.getContext
HTMLCanvasElement.prototype.getContext = function (type, attributes) {
if (type === '2d') {
attributes = { ...attributes, willReadFrequently: true }
}
return originalGetContext.call(this, type, attributes)
}
mChart = echarts.init(target.value)
// Restore the getContext method after initialization to avoid affecting
other canvas elements on the page.
// Use setTimeout to ensure that ECharts initialization has completed
setTimeout(() => {
HTMLCanvasElement.prototype.getContext = originalGetContext
}, 1000) // Restore after a delay of 1000 milliseconds, adjust based on
actual situation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]