Skip to content

Commit 3658525

Browse files
committed
release: @coreui/vue-chartjs v2.0.0-rc.2
1 parent 4d96e0a commit 3658525

File tree

3 files changed

+71
-3
lines changed

3 files changed

+71
-3
lines changed

packages/coreui-vue-chartjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@coreui/vue-chartjs",
33
"description": "Vue component wrapper for chart.js",
4-
"version": "2.0.0-rc.1",
4+
"version": "2.0.0-rc.2",
55
"license": "MIT",
66
"main": "dist/index.cjs.js",
77
"module": "dist/index.esm.js",

packages/coreui-vue-chartjs/src/CChart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const CChart = defineComponent({
6464
plugins: {
6565
type: Array as PropType<Plugin[]>,
6666
default: undefined,
67+
required: false,
6768
},
6869
/**
6970
* If true, will tear down and redraw chart on all updates.
@@ -144,7 +145,6 @@ const CChart = defineComponent({
144145
}
145146

146147
const handleOnClick = (e: Event) => {
147-
console.log(chart)
148148
if (!chart) return
149149

150150
emit(

packages/coreui-vue-chartjs/src/index.ts

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,109 @@
1-
import { App, defineComponent, h } from 'vue'
1+
import { App, defineComponent, h, PropType } from 'vue'
2+
import { ChartData, ChartOptions, Plugin } from 'chart.js/auto'
23
import { CChart } from './CChart'
34

5+
const CChartProps = {
6+
customTooltips: {
7+
type: Boolean,
8+
default: true,
9+
required: false,
10+
},
11+
data: {
12+
type: [Object, Function] as PropType<ChartData | ((canvas: HTMLCanvasElement) => ChartData)>,
13+
required: true,
14+
},
15+
height: {
16+
type: Number,
17+
default: 150,
18+
required: false,
19+
},
20+
id: {
21+
type: String,
22+
default: undefined,
23+
required: false,
24+
},
25+
options: {
26+
type: Object as PropType<ChartOptions>,
27+
default: undefined,
28+
required: false,
29+
},
30+
plugins: {
31+
type: Array as PropType<Plugin[]>,
32+
default: undefined,
33+
required: false,
34+
},
35+
redraw: Boolean,
36+
width: {
37+
type: Number,
38+
default: 300,
39+
required: false,
40+
},
41+
wrapper: {
42+
type: Boolean,
43+
default: true,
44+
required: false,
45+
},
46+
}
47+
448
const CChartBar = defineComponent({
49+
name: 'CChartBar',
50+
props: CChartProps,
551
setup(props) {
652
return () => h(CChart, { type: 'bar', ...props })
753
},
854
})
955

1056
const CChartBubble = defineComponent({
57+
name: 'CChartBubble',
58+
props: CChartProps,
1159
setup(props) {
1260
return () => h(CChart, { type: 'bubble', ...props })
1361
},
1462
})
1563

1664
const CChartDoughnut = defineComponent({
65+
name: 'CChartDoughnut',
66+
props: CChartProps,
1767
setup(props) {
1868
return () => h(CChart, { type: 'doughnut', ...props })
1969
},
2070
})
2171

2272
const CChartLine = defineComponent({
73+
name: 'CChartLine',
74+
props: CChartProps,
2375
setup(props) {
2476
return () => h(CChart, { type: 'line', ...props })
2577
},
2678
})
2779

80+
const CChartPie = defineComponent({
81+
name: 'CChartPie',
82+
props: CChartProps,
83+
setup(props) {
84+
return () => h(CChart, { type: 'pie', ...props })
85+
},
86+
})
87+
2888
const CChartPolarArea = defineComponent({
89+
name: 'CChartPolarArea',
90+
props: CChartProps,
2991
setup(props) {
3092
return () => h(CChart, { type: 'polarArea', ...props })
3193
},
3294
})
3395

3496
const CChartRadar = defineComponent({
97+
name: 'CChartRadar',
98+
props: CChartProps,
3599
setup(props) {
36100
return () => h(CChart, { type: 'radar', ...props })
37101
},
38102
})
39103

40104
const CChartScatter = defineComponent({
105+
name: 'CChartScatter',
106+
props: CChartProps,
41107
setup(props) {
42108
return () => h(CChart, { type: 'scatter', ...props })
43109
},
@@ -50,6 +116,7 @@ const CChartPlugin = {
50116
app.component('CChartBubble', CChartBubble)
51117
app.component('CChartDoughnut', CChartDoughnut)
52118
app.component('CChartLine', CChartLine)
119+
app.component('CChartPie', CChartPie)
53120
app.component('CChartPolarArea', CChartPolarArea)
54121
app.component('CChartRadar', CChartRadar)
55122
app.component('CChartScatter', CChartScatter)
@@ -64,6 +131,7 @@ export {
64131
CChartBubble,
65132
CChartDoughnut,
66133
CChartLine,
134+
CChartPie,
67135
CChartPolarArea,
68136
CChartRadar,
69137
CChartScatter,

0 commit comments

Comments
 (0)