CoreUI Vue.js wrapper for Chart.js
Explore @coreui/vue-chartjs docs & examples »
Report bug
·
Request feature
·
Blog
Status
install:
npm install @coreui/vue-chartjs
yarn add @coreui/vue-chartjs
import:
import { CChart } from '@coreui/vue-chartjs'
or
import {
CChart,
CChartBar,
CChartHorizontalBar,
CChartLine,
CChartDoughnut,
CChartRadar,
CChartPie,
CChartPolarArea,
} from '@coreui/vue-chartjs'
props:
customTooltips: {
type: Boolean,
default: true,
required: false,
},
data: {
type: [Object, Function] as PropType<ChartData | ((canvas: HTMLCanvasElement) => ChartData)>,
required: true,
},
height: {
type: Number,
default: 150,
required: false,
},
id: {
type: String,
default: undefined,
required: false,
},
options: {
type: Object as PropType<ChartOptions>,
default: undefined,
required: false,
},
plugins: {
type: Array as PropType<Plugin[]>,
default: undefined,
},
redraw: Boolean,
type: {
type: String as PropType<ChartType>,
default: 'bar',
required: false,
},
width: {
type: Number,
default: 300,
required: false,
},
wrapper: {
type: Boolean,
default: true,
required: false,
},
usage:
<CChartLine
:wrapper="false"
:data="{
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'My First dataset',
backgroundColor: 'rgba(220, 220, 220, 0.2)',
borderColor: 'rgba(220, 220, 220, 1)',
pointBackgroundColor: 'rgba(220, 220, 220, 1)',
pointBorderColor: '#fff',
data: [40, 20, 12, 39, 10, 40, 39]
},
{
label: 'My Second dataset',
backgroundColor: 'rgba(151, 187, 205, 0.2)',
borderColor: 'rgba(151, 187, 205, 1)',
pointBackgroundColor: 'rgba(151, 187, 205, 1)',
pointBorderColor: '#fff',
data: [50, 12, 28, 29, 7, 25, 12]
}
]
}"
/>