1- import { App , defineComponent , h } from 'vue'
1+ import { App , defineComponent , h , PropType } from 'vue'
2+ import { ChartData , ChartOptions , Plugin } from 'chart.js/auto'
23import { 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+
448const CChartBar = defineComponent ( {
49+ name : 'CChartBar' ,
50+ props : CChartProps ,
551 setup ( props ) {
652 return ( ) => h ( CChart , { type : 'bar' , ...props } )
753 } ,
854} )
955
1056const CChartBubble = defineComponent ( {
57+ name : 'CChartBubble' ,
58+ props : CChartProps ,
1159 setup ( props ) {
1260 return ( ) => h ( CChart , { type : 'bubble' , ...props } )
1361 } ,
1462} )
1563
1664const CChartDoughnut = defineComponent ( {
65+ name : 'CChartDoughnut' ,
66+ props : CChartProps ,
1767 setup ( props ) {
1868 return ( ) => h ( CChart , { type : 'doughnut' , ...props } )
1969 } ,
2070} )
2171
2272const 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+
2888const CChartPolarArea = defineComponent ( {
89+ name : 'CChartPolarArea' ,
90+ props : CChartProps ,
2991 setup ( props ) {
3092 return ( ) => h ( CChart , { type : 'polarArea' , ...props } )
3193 } ,
3294} )
3395
3496const CChartRadar = defineComponent ( {
97+ name : 'CChartRadar' ,
98+ props : CChartProps ,
3599 setup ( props ) {
36100 return ( ) => h ( CChart , { type : 'radar' , ...props } )
37101 } ,
38102} )
39103
40104const 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