Chartjs-Chart.js โ€“ tooltips issue with multiple charts

4๐Ÿ‘

โœ…

Iโ€™ve solved your problem with clone your config for each chart. Currently, you render charts with one object config, which is shared and when render second chart, the config is changed. So you should clone config for each chart.

This is my solution (forked and edited from your jsfiddle) https://jsfiddle.net/huynhsamha/bdvw1e98/

const clone = (o) => JSON.parse(JSON.stringify(o))

var configs = {
    chart1: clone(config),
    chart2: clone(config)
};
<script async src="//jsfiddle.net/huynhsamha/bdvw1e98/embed/js,html,css,result/dark/"></script>

Leave a comment