график

This commit is contained in:
iriska-gri committed 2023-12-28 09:10:44 +03:00
1 parent f699b4ffef
commit cbc4bca374
2 files changed
+47 -22

No files matched your search

@@ -0,0 +1,16 @@
export const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'Data One',
backgroundColor: '#f87979',
data: [40, 39, 10, 40, 39, 80, 40]
}
]
}
export const options = {
responsive: true,
maintainAspectRatio: false
}
+31 -22
View File
@@ -1,31 +1,40 @@
<script> <template>
<Line :data="data" :options="options" />
</template>
<script lang="ts">
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
} from 'chart.js'
import { Line } from 'vue-chartjs' import { Line } from 'vue-chartjs'
import { onMounted } from 'vue' import * as chartConfig from './chartConfig.js'
ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
)
export default { export default {
name: 'lineGraph', name: 'App',
components: { components: {
Line Line
}, },
data() {
props: { return chartConfig
data: { }
type: Object,
default: null
},
options: {
type: Object,
default: null
}
},
setup() {
onMounted(() => {
this.renderChart(this.data, this.options)
})
}
} }
</script> </script>