1+ <script setup>
2+ import { ref , computed } from " vue" ;
3+ import LocalVueUi3dBar from ' ../src/components/vue-ui-3d-bar.vue' ;
4+ import LocalVueDataUi from ' ../src/components/vue-data-ui.vue' ;
5+ import Box from " ./Box.vue" ;
6+ import convertArrayToObject from " ./convertModel" ;
7+
8+ const datasets = ref ({
9+ simple: {
10+ percentage: 66.666
11+ },
12+ stacked: {
13+ series: [
14+ {
15+ name: ' Serie 1 with a long name that should be shorter but we do not have the choice' ,
16+ value: 256 ,
17+ breakdown: [
18+ {
19+ name: ' Sub serie 1' ,
20+ value: 100
21+ },
22+ {
23+ name: ' Sub serie 2' ,
24+ value: 90
25+ },
26+ {
27+ name: ' Sub serie 3' ,
28+ value: 66
29+ }
30+ ]
31+ },
32+ {
33+ name: ' Serie 2' ,
34+ value: 128
35+ },
36+ {
37+ name: ' Serie 3' ,
38+ value: 64
39+ },
40+ {
41+ name: ' Serie 4' ,
42+ value: 32
43+ },
44+ {
45+ name: ' Serie 5' ,
46+ value: 16
47+ },
48+ {
49+ name: ' Serie 6' ,
50+ value: 8
51+ }
52+ ]
53+ }
54+ })
55+
56+ const model = ref ([
57+ { key: ' style.fontFamily' , def: ' inherit' , type: ' text' },
58+ { key: ' style.shape' , def: ' bar' , type: ' select' , options: [' bar' , ' tube' ]},
59+ { key: ' style.chart.animation.use' , def: true , type: ' checkbox' },
60+ { key: ' style.chart.animation.speed' , def: 1 , type: ' number' , min: 0.1 , max: 2 , step: 0.1 },
61+ { key: ' style.chart.animation.acceleration' , def: 1 , type: ' number' , min: 0.1 , max: 10 , step: 0.1 },
62+ { key: ' style.chart.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
63+ { key: ' style.chart.color' , def: ' #1A1A1A' , type: ' color' },
64+ { key: ' style.chart.bar.color' , def: ' #6376DD' , type: ' color' },
65+ { key: ' style.chart.bar.stroke' , def: ' #6376DD' , type: ' color' },
66+ { key: ' style.chart.bar.strokeWidth' , def: 1 , type: ' number' , min: 0 , max: 12 , step: 0.5 },
67+ { key: ' style.chart.bar.shadeColor' , def: ' #1A1A1A' , type: ' color' },
68+ { key: ' style.chart.box.stroke' , def: ' #CCCCCC' , type: ' color' },
69+ { key: ' style.chart.box.strokeWidth' , def: 1 , type: ' number' , min: 0 , max: 12 , step: 0.5 },
70+ { key: ' style.chart.box.strokeDasharray' , def: 2 , type: ' number' , min: 0 , max: 100 },
71+ { key: ' style.chart.box.dimensions.width' , def: 128 , type: ' number' , min: 64 , max: 300 },
72+ { key: ' style.chart.box.dimensions.height' , def: 256 , type: ' number' , min: 64 , max: 600 },
73+ { key: ' style.chart.box.dimensions.top' , def: 27 , type: ' number' , min: 0 , max: 100 },
74+ { key: ' style.chart.box.dimensions.bottom' , def: 9 , type: ' number' , min: 0 , max: 100 },
75+ { key: ' style.chart.box.dimensions.left' , def: 24 , type: ' number' , min: 0 , max: 100 },
76+ { key: ' style.chart.box.dimensions.right' , def: 24 , type: ' number' , min: 0 , max: 100 },
77+ { key: ' style.chart.box.dimensions.perspective' , def: 18 , type: ' number' , min: 0 , max: 100 },
78+ { key: ' style.chart.title.text' , def: ' Lorem ipsum dolor sit amet' , type: ' text' },
79+ { key: ' style.chart.title.color' , def: ' #1A1A1A' , type: ' color' },
80+ { key: ' style.chart.title.fontSize' , def: 20 , type: ' number' , min: 8 , max: 48 },
81+ { key: ' style.chart.title.bold' , def: true , type: ' checkbox' },
82+ { key: ' style.chart.title.subtitle.color' , def: ' #CCCCCC' , type: ' color' },
83+ { key: ' style.chart.title.subtitle.text' , def: ' Lorem ipsum dolor sit amet' , type: " text" },
84+ { key: ' style.chart.title.subtitle.fontSize' , def: 16 , type: ' number' , min: 8 , max: 48 },
85+ { key: ' style.chart.title.subtitle.bold' , def: false , type: ' checkbox' },
86+ { key: ' style.chart.legend.showDefault' , def: true , type: ' checkbox' },
87+ { key: ' style.chart.legend.fontSize' , def: 10 , type: ' number' , min: 8 , max: 48 },
88+ { key: ' style.chart.legend.color' , def: ' #1A1A1A' , type: ' color' },
89+ { key: ' style.chart.legend.bold' , def: false , type: ' checkbox' },
90+ { key: ' style.chart.legend.roundingValue' , def: 2 , type: ' number' , min: 0 , max: 12 },
91+ { key: ' style.chart.legend.roundingPercentage' , def: 2 , type: ' number' , min: 0 , max: 12 },
92+ { key: ' style.chart.legend.prefix' , def: ' P' , type: ' text' },
93+ { key: ' style.chart.legend.suffix' , def: ' S' , type: ' text' },
94+ { key: ' style.chart.legend.hideUnderPercentage' , def: 3 , type: ' number' , min: 1 , max: 20 },
95+ { key: ' style.chart.dataLabel.show' , def: true , type: ' checkbox' },
96+ { key: ' style.chart.dataLabel.bold' , def: true , type: ' checkbox' },
97+ { key: ' style.chart.dataLabel.color' , def: ' #1A1A1A' , type: ' color' },
98+ { key: ' style.chart.dataLabel.fontSize' , def: 12 , type: ' number' },
99+ { key: ' style.chart.dataLabel.rounding' , def: 1 , type: ' number' , min: 0 , max: 12 },
100+ { key: ' userOptions.show' , def: true , type: ' checkbox' },
101+ { key: ' table.show' , def: false , type: ' checkbox' },
102+ { key: ' table.responsiveBreakpoint' , def: 300 , type: ' number' , min: 300 , max: 800 },
103+ { key: ' table.ccolumnNames.series' , def: ' Series' , type: ' text' },
104+ { key: ' table.ccolumnNames.value' , def: ' Value' , type: ' text' },
105+ { key: ' table.ccolumnNames.percentage' , def: ' Percentage' , type: ' text' },
106+ { key: ' table.th.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
107+ { key: ' table.th.color' , def: ' #1A1A1A' , type: ' color' },
108+ { key: ' table.th.outline' , def: ' none' , type: ' text' },
109+ { key: ' table.td.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
110+ { key: ' table.td.color' , def: ' #1A1A1A' , type: ' color' },
111+ { key: ' table.td.outline' , def: ' none' , type: ' text' },
112+ { key: ' table.td.roundingValue' , def: 2 , type: ' number' , min: 0 , max: 12 },
113+ { key: ' table.td.roundingPercentage' , def: 2 , type: ' number' , min: 0 , max: 12 },
114+ ])
115+
116+ const config = computed (() => convertArrayToObject (model .value ))
117+
118+ const step = ref (0 )
119+
120+ const selectedDataset = ref (' stacked' )
121+
122+ const dataset = computed (() => datasets .value [selectedDataset .value ])
123+
124+ </script >
125+
126+ <template >
127+ <select v-model =" selectedDataset" @change =" step += 1" ><option >simple</option ><option >stacked</option ></select >
128+ <Box >
129+ <template #title >VueUi3dBar</template >
130+
131+ <template #local >
132+ <LocalVueUi3dBar :dataset =" dataset" :config =" config" :key =" `local_${step}`" >
133+ </LocalVueUi3dBar >
134+ </template >
135+
136+ <template #VDUI-local >
137+ <LocalVueDataUi component =" VueUi3dBar" :dataset =" dataset" :config =" config" :key =" `vdui_local_${step}`" >
138+ </LocalVueDataUi >
139+ </template >
140+
141+ <template #build >
142+ <VueUi3dBar :dataset =" dataset" :config =" config" :key =" `build_${step}`" >
143+ </VueUi3dBar >
144+ </template >
145+
146+ <template #VDUI-build >
147+ <VueDataUi component =" VueUi3dBar" :dataset =" dataset" :config =" config" :key =" `vdui_build_${step}`" >
148+ </VueDataUi >
149+ </template >
150+
151+ <template #knobs >
152+ <div
153+ style =" display : flex ; flex-direction : row ; flex-wrap :wrap ; align-items :center ; width : 100% ; color : #CCCCCC ; gap :24px ;" >
154+ <div v-for =" knob in model" >
155+ <label style =" font-size : 10px " >{{ knob.key }}</label >
156+ <div
157+ style =" display :flex ; flex-direction :row ; flex-wrap : wrap ; align-items :center ; gap :6px ; height : 40px " >
158+ <input v-if =" !['none', 'select'].includes(knob.type)" :step =" knob.step" :type =" knob.type"
159+ :min =" knob.min ?? 0" :max =" knob.max ?? 0" v-model =" knob.def" @change =" step += 1" >
160+ <select v-if =" knob.type === 'select'" v-model =" knob.def" @change =" step += 1" >
161+ <option v-for =" opt in knob.options" >{{ opt }}</option >
162+ </select >
163+ </div >
164+ </div >
165+ </div >
166+ </template >
167+
168+ <template #config >
169+ {{ config }}
170+ </template >
171+ </Box >
172+ </template >
0 commit comments