Multiple charts on one page
See original GitHub issueExpected Behavior
Interacting with a chart will only affect that specific chart
Actual Behavior
Interacting with a chart affects all charts on a page
Environment
- vue.js version: vue@2.6.11
- vue-chart.js version: vue-chartjs@3.5.0
- chart.js version: chart.js@2.9.3
- npm version: 6.14.7
Here is the code for my chart component:
<script>
import { mixins, Bar } from "vue-chartjs"; // We specify what type of chart we want from vue-chartjs and the mixins module
const { reactiveProp } = mixins;
export default {
extends: Bar, //We are extending the base chart class as mentioned above
mixins: [reactiveProp],
props: {
chartdata: {
type: Object,
default: null,
},
},
data() {
return {
options: {
responsive: true,
animation: {
duration: 0,
},
scales: {
yAxes: [
{
ticks: {
beginAtZero: true,
stepSize: 1,
min: 0,
max: 100,
maxTicksLimit: 5
},
},
],
},
},
};
},
mounted() {
this.renderChart(this.chartData, this.options);
},
};
</script>
Here is the code for the page I’m rendering them on: https://github.com/SelfhostedPro/Yacht/blob/master/frontend/src/views/Home.vue (I would paste it but it’s quite long)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Multiple charts in one page with chart.js - Stack Overflow
When I only have one chart, nothing's gone wrong, but when I try to add one more chart, my charts become so large...
Read more >How to display multiple charts in one chart sheet? - ExtendOffice
You can move and display multiple charts in one chart sheet with following steps: 1. Create a chart sheet that you want to...
Read more >Draw Multiple Charts | Google Developers
This page shows how to draw multiple charts on one web page. Draw Multiple Charts on One Page. If you want to draw...
Read more >Render Multiple Charts in a Page - CanvasJS.com
Step1: Position the chart container wherever the chart is supposed to be rendered in the page, with separate chart-container id for each chart....
Read more >Create and use Multiple charts in one page with chart.js
Create and use Multiple charts in one page with chart.js - Javascript Chart.js · Description · Demo Code · Related Tutorials.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did you try to add a unique ID on the chart? You can use the chartId prop, by default multiple charts on the same page have same id
Well, its hard to reproduce. Multiple charts can be controlled tho: https://codesandbox.io/s/boring-thompson-ddl5g?file=/src/App.vue