график
This commit is contained in:
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
|
||||
}
|
||||
|
||||
@@ -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 { onMounted } from 'vue'
|
||||
import * as chartConfig from './chartConfig.js'
|
||||
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
LineElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend
|
||||
)
|
||||
|
||||
export default {
|
||||
name: 'lineGraph',
|
||||
components: {
|
||||
name: 'App',
|
||||
components: {
|
||||
Line
|
||||
},
|
||||
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
|
||||
setup() {
|
||||
onMounted(() => {
|
||||
this.renderChart(this.data, this.options)
|
||||
})
|
||||
}
|
||||
data() {
|
||||
return chartConfig
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user