vue-chartjs
Advanced tools
Comparing version 4.1.1 to 4.1.2
@@ -45,4 +45,3 @@ import { Chart, BarController, DoughnutController, LineController, PieController, PolarAreaController, RadarController, BubbleController, ScatterController } from 'chart.js'; | ||
// given the new set, find it's current match | ||
const currentDataset = oldData.datasets.find((dataset)=>dataset[datasetIdKey] === nextDataset[datasetIdKey] | ||
); | ||
const currentDataset = oldData.datasets.find((dataset)=>dataset[datasetIdKey] === nextDataset[datasetIdKey]); | ||
// There is no original to update, so simply add new one | ||
@@ -79,4 +78,3 @@ if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) { | ||
// Check if Labels are equal and if dataset length is equal | ||
return oldData.datasets.length === newData.datasets.length && newDatasetLabels.every((value, index)=>value === oldDatasetLabels[index] | ||
); | ||
return oldData.datasets.length === newData.datasets.length && newDatasetLabels.every((value, index)=>value === oldDatasetLabels[index]); | ||
} | ||
@@ -195,10 +193,6 @@ const templateError = "Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components"; | ||
} | ||
watch(()=>props.chartData | ||
, (newValue, oldValue)=>chartDataHandler(newValue, oldValue) | ||
, { | ||
watch(()=>props.chartData, (newValue, oldValue)=>chartDataHandler(newValue, oldValue), { | ||
deep: true | ||
}); | ||
watch(()=>props.chartOptions | ||
, (newValue)=>chartOptionsHandler(newValue) | ||
, { | ||
watch(()=>props.chartOptions, (newValue)=>chartOptionsHandler(newValue), { | ||
deep: true | ||
@@ -230,4 +224,3 @@ }); | ||
}) | ||
]) | ||
; | ||
]); | ||
} | ||
@@ -234,0 +227,0 @@ }); |
@@ -50,2 +50,3 @@ /** @type Object */ export const Bar: any; | ||
_chart: any; | ||
_id: string; | ||
}; | ||
@@ -52,0 +53,0 @@ computed: { |
@@ -44,4 +44,3 @@ import { Chart, BarController, DoughnutController, LineController, PieController, PolarAreaController, RadarController, BubbleController, ScatterController } from 'chart.js'; | ||
// given the new set, find it's current match | ||
const currentDataset = oldData.datasets.find((dataset)=>dataset[datasetIdKey] === nextDataset[datasetIdKey] | ||
); | ||
const currentDataset = oldData.datasets.find((dataset)=>dataset[datasetIdKey] === nextDataset[datasetIdKey]); | ||
// There is no original to update, so simply add new one | ||
@@ -78,4 +77,3 @@ if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) { | ||
// Check if Labels are equal and if dataset length is equal | ||
return oldData.datasets.length === newData.datasets.length && newDatasetLabels.every((value, index)=>value === oldDatasetLabels[index] | ||
); | ||
return oldData.datasets.length === newData.datasets.length && newDatasetLabels.every((value, index)=>value === oldDatasetLabels[index]); | ||
} | ||
@@ -86,3 +84,3 @@ const templateError = "Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components"; | ||
function generateChart(chartId, chartType, chartController) { | ||
let _chartRef = null; | ||
let _chartRef = {}; | ||
return { | ||
@@ -129,3 +127,4 @@ props: { | ||
return { | ||
_chart: null | ||
_chart: null, | ||
_id: Math.random().toString(36).substring(2) | ||
}; | ||
@@ -144,5 +143,3 @@ }, | ||
mounted () { | ||
_chartRef = { | ||
current: null | ||
}; | ||
_chartRef[this.$data._id] = null; | ||
if ("datasets" in this.chartData && this.chartData.datasets.length > 0) { | ||
@@ -238,6 +235,6 @@ chartCreate(this.renderChart, this.chartData, this.chartOptions); | ||
getCurrentChart () { | ||
return this.hasAnnotationPlugin ? _chartRef.current : this.$data._chart; | ||
return this.hasAnnotationPlugin ? _chartRef[this.$data._id] : this.$data._chart; | ||
}, | ||
setCurrentChart (chart) { | ||
this.hasAnnotationPlugin ? _chartRef.current = chart : this.$data._chart = chart; | ||
this.hasAnnotationPlugin ? _chartRef[this.$data._id] = chart : this.$data._chart = chart; | ||
} | ||
@@ -244,0 +241,0 @@ }, |
{ | ||
"name": "vue-chartjs", | ||
"version": "4.1.1", | ||
"packageManager": "pnpm@6.32.17", | ||
"version": "4.1.2", | ||
"description": "Vue.js wrapper for chart.js for creating beautiful charts.", | ||
@@ -6,0 +5,0 @@ "author": "Jakub Juszczak <jakub@posteo.de>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153834
1171