vue-chartjs
Advanced tools
Comparing version
import { Chart as Chart$1, BarController, DoughnutController, LineController, PieController, PolarAreaController, RadarController, BubbleController, ScatterController } from 'chart.js'; | ||
import { version, isProxy, toRaw, defineComponent, ref, shallowRef, onMounted, onBeforeUnmount, watch, nextTick, h } from 'vue'; | ||
import { version, isProxy, toRaw, defineComponent, ref, shallowRef, onMounted, onUnmounted, watch, nextTick, h } from 'vue'; | ||
@@ -39,2 +39,6 @@ const CommonProps = { | ||
}, | ||
destroyDelay: { | ||
type: Number, | ||
default: 0 // No delay by default | ||
}, | ||
...CommonProps, | ||
@@ -145,4 +149,11 @@ ...A11yProps | ||
if (chart) { | ||
chart.destroy(); | ||
chartRef.value = null; | ||
if (props.destroyDelay > 0) { | ||
setTimeout(()=>{ | ||
chart.destroy(); | ||
chartRef.value = null; | ||
}, props.destroyDelay); | ||
} else { | ||
chart.destroy(); | ||
chartRef.value = null; | ||
} | ||
} | ||
@@ -154,3 +165,3 @@ }; | ||
onMounted(renderChart); | ||
onBeforeUnmount(destroyChart); | ||
onUnmounted(destroyChart); | ||
watch([ | ||
@@ -157,0 +168,0 @@ ()=>props.options, |
@@ -64,3 +64,7 @@ import type { PropType } from 'vue'; | ||
}; | ||
readonly destroyDelay: { | ||
readonly type: NumberConstructor; | ||
readonly default: 0; | ||
}; | ||
}; | ||
//# sourceMappingURL=props.d.ts.map |
import type { ChartType, ChartComponentLike, DefaultDataPoint } from 'chart.js'; | ||
import type { TypedChartComponent } from './types.js'; | ||
export declare function createTypedChart<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown>(type: TType, registerables: ChartComponentLike): TypedChartComponent<TType, TData, TLabel>; | ||
export declare const Bar: TypedChartComponent<"bar", (number | [number, number] | null)[], unknown>; | ||
interface ExtendedDataPoint { | ||
[key: string]: string | number | null | ExtendedDataPoint; | ||
} | ||
export declare const Bar: TypedChartComponent<"bar", (number | [number, number] | null)[] | ExtendedDataPoint[], unknown>; | ||
export declare const Doughnut: TypedChartComponent<"doughnut", number[], unknown>; | ||
@@ -12,2 +15,3 @@ export declare const Line: TypedChartComponent<"line", (number | import("chart.js").Point | null)[], unknown>; | ||
export declare const Scatter: TypedChartComponent<"scatter", (number | import("chart.js").Point | null)[], unknown>; | ||
export {}; | ||
//# sourceMappingURL=typedCharts.d.ts.map |
{ | ||
"name": "vue-chartjs", | ||
"type": "module", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"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
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
76031
3.71%670
4.69%