import type { PluginOptionsByType } from 'chart.js' import { CategoryScale, Chart as ChartJS, Legend, LineElement, LinearScale, PointElement, Title, Tooltip } from 'chart.js' import type { PropType } from 'vue' import { defineComponent } from 'vue' import { Line } from 'vue-chartjs' ChartJS.register(Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale) export default defineComponent({ name: 'LineChart', props: { chartId: { type: String, default: 'line-chart', }, width: { type: Number, default: 400, }, height: { type: Number, default: 400, }, cssClasses: { default: '', type: String, }, styles: { type: Object as PropType>, default: () => ({}), }, plugins: { type: Array as PropType[]>, default: () => [], }, chartData: { type: Object, default: () => ({}), }, chartOptions: { type: Object, default: () => ({}), }, }, setup(props) { return () => h(h(Line), { chartId: props.chartId, width: props.width, height: props.height, cssClasses: props.cssClasses, styles: props.styles, plugins: props.plugins, options: props.chartOptions, data: props.chartData, }) }, })