vue-chartjs
Advanced tools
Comparing version 4.0.4 to 4.0.5
@@ -78,3 +78,3 @@ import { Chart, BarController, DoughnutController, LineController, PieController, PolarAreaController, RadarController, BubbleController, ScatterController } from 'chart.js'; | ||
function generateChart(chartId, chartType, chartController) { | ||
let _chart = null; | ||
let _chartRef = null; | ||
return { | ||
@@ -123,2 +123,5 @@ props: { | ||
mounted () { | ||
_chartRef = { | ||
current: null | ||
}; | ||
if ('datasets' in this.chartData && this.chartData.datasets.length > 0) { | ||
@@ -136,4 +139,4 @@ chartCreate(this.renderChart, this.chartData, this.chartOptions); | ||
renderChart (data, options) { | ||
if (_chart !== null) { | ||
chartDestroy(_chart); | ||
if ((_chartRef === null || _chartRef === void 0 ? void 0 : _chartRef.current) !== null) { | ||
chartDestroy(_chartRef.current); | ||
this.$emit(ChartEmits.ChartDestroyed); | ||
@@ -147,3 +150,3 @@ } | ||
if (canvasEl2DContext !== null) { | ||
_chart = new Chart(canvasEl2DContext, { | ||
_chartRef.current = new Chart(canvasEl2DContext, { | ||
type: chartType, | ||
@@ -166,13 +169,13 @@ data: chartData, | ||
const isEqualLabelsAndDatasetsLength = compareData(newData, oldData); | ||
if (isEqualLabelsAndDatasetsLength && _chart !== null) { | ||
setChartDatasets(_chart.data, newData, this.datasetIdKey); | ||
if (isEqualLabelsAndDatasetsLength && (_chartRef === null || _chartRef === void 0 ? void 0 : _chartRef.current) !== null) { | ||
setChartDatasets(_chartRef.current.data, newData, this.datasetIdKey); | ||
if (newData.labels !== undefined) { | ||
setChartLabels(_chart, newData.labels); | ||
setChartLabels(_chartRef.current, newData.labels); | ||
this.$emit(ChartEmits.LabelsUpdated); | ||
} | ||
chartUpdate(_chart); | ||
chartUpdate(_chartRef.current); | ||
this.$emit(ChartEmits.ChartUpdated); | ||
} else { | ||
if (_chart !== null) { | ||
chartDestroy(_chart); | ||
if ((_chartRef === null || _chartRef === void 0 ? void 0 : _chartRef.current) !== null) { | ||
chartDestroy(_chartRef.currentt); | ||
this.$emit(ChartEmits.ChartDestroyed); | ||
@@ -184,4 +187,4 @@ } | ||
} else { | ||
if (_chart !== null) { | ||
chartDestroy(_chart); | ||
if ((_chartRef === null || _chartRef === void 0 ? void 0 : _chartRef.current) !== null) { | ||
chartDestroy(_chartRef.current); | ||
this.$emit(ChartEmits.ChartDestroyed); | ||
@@ -195,4 +198,4 @@ } | ||
beforeDestroy () { | ||
if (_chart !== null) { | ||
chartDestroy(_chart); | ||
if ((_chartRef === null || _chartRef === void 0 ? void 0 : _chartRef.current) !== null) { | ||
chartDestroy(_chartRef.current); | ||
this.$emit(ChartEmits.ChartDestroyed); | ||
@@ -199,0 +202,0 @@ } |
{ | ||
"name": "vue-chartjs", | ||
"version": "4.0.4", | ||
"packageManager": "pnpm@6.32.2", | ||
"version": "4.0.5", | ||
"packageManager": "pnpm@6.32.4", | ||
"description": "Vue.js wrapper for chart.js for creating beautiful charts.", | ||
@@ -6,0 +6,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
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
130970
950