1+ <script setup>
2+ import { ref , computed } from " vue" ;
3+ import LocalVueUiDumbbell from ' ../src/components/vue-ui-dumbbell.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 dataset = ref ([
9+ { name: ' Sweden' , start: 5000 , end: 7100 },
10+ { name: ' Korea, Rep.' , start: 4900 , end: 7050 },
11+ { name: ' Iceland' , start: 6500 , end: 8000 },
12+ { name: ' Finland' , start: 6400 , end: 7600 },
13+ { name: ' Norway' , start: 5400 , end: 6050 },
14+ { name: ' Ireland' , start: 3000 , end: 2000 }
15+ ])
16+
17+ const model = ref ([
18+ { key: ' useAnimation' , def: true , type: ' checkbox' },
19+ { key: ' animationSpeed' , def: 2 , type: ' number' , min: 1 , max: 10 },
20+ { key: ' userOptions.show' , def: true , type: ' checkbox' },
21+ { key: ' style.fontFamily' , def: ' inherit' , type: ' text' },
22+ { key: ' style.chart.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
23+ { key: ' style.chart.color' , def: ' #1A1A1A' , type: ' color' },
24+ { key: ' style.chart.width' , def: 600 , type: ' number' , min: 300 , max: 1000 },
25+ { key: ' style.chart.rowHeight' , def: 40 , type: ' number' , min: 40 , max: 100 },
26+ { key: ' style.chart.padding.top' , def: 12 , type: ' number' , min: 0 , max: 100 },
27+ { key: ' style.chart.padding.left' , def: 100 , type: ' number' , min: 0 , max: 100 },
28+ { key: ' style.chart.padding.right' , def: 24 , type: ' number' , min: 0 , max: 100 },
29+ { key: ' style.chart.padding.bottom' , def: 12 , type: ' number' , min: 0 , max: 100 },
30+ { key: ' style.chart.plots.startColor' , def: ' #FF6400' , type: ' color' },
31+ { key: ' style.chart.plots.endColor' , def: ' #5F8BEE' , type: ' color' },
32+ { key: ' style.chart.plots.radius' , def: 6 , type: ' number' , min: 2 , max: 40 },
33+ { key: ' style.chart.plots.stroke' , def: ' #FFFFFF' , type: ' color' },
34+ { key: ' style.chart.plots.strokeWidth' , def: 1 , type: ' number' , min: 0 , max: 12 },
35+ { key: ' style.chart.plots.link.strokeWidth' , def: 2 , type: ' number' , min: 0 , max: 12 },
36+ { key: ' style.chart.plots.link.type' , def: ' curved' , type: ' select' , options: [' curved' , ' line' ]},
37+ { key: ' style.chart.plots.gradient.show' , def: true , type: ' checkbox' },
38+ { key: ' style.chart.plots.gradient.intensity' , def: 40 , type: ' range' , min: 0 , max: 100 },
39+ { key: ' style.chart.grid.strokeWidth' , def: 1 , type: ' number' , min: 0 , max: 12 },
40+ { key: ' style.chart.grid.scaleSteps' , def: 10 , type: ' number' , min: 2 , max: 20 },
41+ { key: ' style.chart.grid.horizontalGrid.show' , def: true , type: ' checkbox' },
42+ { key: ' style.chart.grid.horizontalGrid.stroke' , def: ' #CCCCCC' , type: ' color' },
43+ { key: ' style.chart.grid.horizontalGrid.strokeWidth' , def: 0.5 , type: ' number' , min: 0 , max: 12 , step: 0.5 },
44+ { key: ' style.chart.grid.horizontalGrid.strokeDasharray' , def: 4 , type: ' number' , min: 0 , max: 100 },
45+ { key: ' style.chart.grid.verticalGrid.show' , def: true , type: ' checkbox' },
46+ { key: ' style.chart.grid.verticalGrid.stroke' , def: ' #CCCCCC' , type: ' color' },
47+ { key: ' style.chart.grid.verticalGrid.strokeWidth' , def: 0.5 , type: ' number' , min: 0 , max: 12 , step: 0.5 },
48+ { key: ' style.chart.grid.verticalGrid.strokeDasharray' , def: 0 , type: ' number' , min: 0 , max: 100 },
49+ { key: ' style.chart.labels.prefix' , def: ' P' , type: ' text' },
50+ { key: ' style.chart.labels.suffix' , def: ' S' , type: ' text' },
51+ { key: ' style.chart.labels.yAxisLabels.show' , def: true , type: ' checkbox' },
52+ { key: ' style.chart.labels.yAxisLabels.fontSize' , def: 14 , type: ' number' , min: 8 , max: 48 },
53+ { key: ' style.chart.labels.yAxisLabels.color' , def: ' #1A1A1A' , type: ' color' },
54+ { key: ' style.chart.labels.yAxisLabels.offsetX' , def: 0 , type: ' number' , min: - 100 , max: 100 },
55+ { key: ' style.chart.labels.yAxisLabels.bold' , def: true , type: ' checkbox' },
56+ { key: ' style.chart.labels.yAxisLabels.showProgression' , def: true , type: ' checkbox' },
57+ { key: ' style.chart.labels.yAxisLabels.rounding' , def: 1 , type: ' number' , min: 0 , max: 12 },
58+ { key: ' style.chart.labels.xAxisLabels.show' , def: true , type: ' checkbox' },
59+ { key: ' style.chart.labels.xAxisLabels.fontSize' , def: 14 , type: ' number' , min: 8 , max: 48 },
60+ { key: ' style.chart.labels.xAxisLabels.color' , def: ' #1A1A1A' , type: ' color' },
61+ { key: ' style.chart.labels.xAxisLabels.offsetY' , def: 0 , type: ' number' , min: - 100 , max: 100 },
62+ { key: ' style.chart.labels.xAxisLabels.bold' , def: false , type: ' checkbox' },
63+ { key: ' style.chart.labels.xAxisLabels.rounding' , def: 2 , type: ' number' , min: 0 , max: 12 },
64+ { key: ' style.chart.labels.startLabels.show' , def: true , type: ' checkbox' },
65+ { key: ' style.chart.labels.startLabels.fontSize' , def: 10 , type: ' number' , min: 8 , max: 24 },
66+ { key: ' style.chart.labels.startLabels.color' , def: ' #1A1A1A' , type: ' color' },
67+ { key: ' style.chart.labels.startLabels.offsetY' , def: 0 , type: ' number' , min: - 100 , max: 100 },
68+ { key: ' style.chart.labels.startLabels.rounding' , def: 2 , type: ' number' , min: 0 , max: 12 },
69+ { key: ' style.chart.labels.startLabels.useStartColor' , def: true , type: ' checkbox' },
70+ { key: ' style.chart.labels.xAxisLabels.rounding' , def: 2 , type: ' number' , min: 0 , max: 12 },
71+ { key: ' style.chart.labels.endLabels.show' , def: true , type: ' checkbox' },
72+ { key: ' style.chart.labels.endLabels.fontSize' , def: 10 , type: ' number' , min: 8 , max: 24 },
73+ { key: ' style.chart.labels.endLabels.color' , def: ' #1A1A1A' , type: ' color' },
74+ { key: ' style.chart.labels.endLabels.offsetY' , def: 0 , type: ' number' , min: - 100 , max: 100 },
75+ { key: ' style.chart.labels.endLabels.rounding' , def: 2 , type: ' number' , min: 0 , max: 12 },
76+ { key: ' style.chart.labels.endLabels.useEndColor' , def: true , type: ' checkbox' },
77+ { key: ' style.chart.legend.show' , def: true , type: ' checkbox' },
78+ { key: ' style.chart.legend.labelStart' , def: ' start' , type: ' text' },
79+ { key: ' style.chart.legend.labelEnd' , def: ' end' , type: ' text' },
80+ { key: ' style.chart.legend.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
81+ { key: ' style.chart.legend.color' , def: ' #1A1A1A' , type: ' color' },
82+ { key: ' style.chart.legend.fontSize' , def: 14 , type: ' number' , min: 8 , max: 48 },
83+ { key: ' style.chart.legend.bold' , def: false , type: ' checkbox' },
84+ { key: ' style.chart.title.text' , def: ' Lorem ipsum dolor sit amet' , type: ' text' },
85+ { key: ' style.chart.title.color' , def: ' #1A1A1A' , type: ' color' },
86+ { key: ' style.chart.title.fontSize' , def: 20 , type: ' number' , min: 8 , max: 48 },
87+ { key: ' style.chart.title.bold' , def: true , type: ' checkbox' },
88+ { key: ' style.chart.title.subtitle.color' , def: ' #CCCCCC' , type: ' color' },
89+ { key: ' style.chart.title.subtitle.text' , def: ' Lorem ipsum dolor sit amet' , type: ' text' },
90+ { key: ' style.chart.title.subtitle.fontSize' , def: 16 , type: ' number' , min: 8 , max: 48 },
91+ { key: ' style.chart.title.subtitle.bold' , def: false , type: ' checkbox' },
92+ { key: ' table.show' , def: false , type: ' checkbox' },
93+ { key: ' table.responsiveBreakpoint' , def: 300 , type: ' number' , min: 300 , max: 800 },
94+ { key: ' table.columnNames.series' , def: ' Series' , type: ' text' },
95+ { key: ' table.columnNames.start' , def: ' Start value' , type: ' text' },
96+ { key: ' table.columnNames.end' , def: ' End value' , type: ' text' },
97+ { key: ' table.columnNames.progression' , def: ' Progression' , type: ' text' },
98+ { key: ' table.th.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
99+ { key: ' table.th.color' , def: ' #1A1A1A' , type: ' color' },
100+ { key: ' table.th.outline' , def: ' none' , type: ' text' },
101+ { key: ' table.td.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
102+ { key: ' table.td.color' , def: ' #1A1A1A' , type: ' color' },
103+ { key: ' table.td.outline' , def: ' none' , type: ' text' },
104+ { key: ' table.td.roundingValue' , def: 2 , type: ' number' , min: 0 , max: 12 },
105+ { key: ' table.td.roundingPercentage' , def: 2 , type: ' number' , min: 0 , max: 12 },
106+ ])
107+
108+ const config = computed (() => {
109+ return convertArrayToObject (model .value )
110+ })
111+
112+ const step = ref (0 );
113+
114+ </script >
115+
116+ <template >
117+ <Box >
118+ <template #title >VueUiDumbbell</template >
119+
120+ <template #local >
121+ <LocalVueUiDumbbell :dataset =" dataset" :config =" config" :key =" `local_${step}`" >
122+ <template #svg =" { svg } " >
123+ <circle :cx =" 30" :cy =" 30" :r =" 30" fill =" #42d392" />
124+ <text :x =" 30" :y =" 30" text-anchor =" middle" >#SVG</text >
125+ </template >
126+ <template #legend =" { legend } " >
127+ #LEGEND
128+ <div style =" font-size : 8px " >
129+ {{ legend }}
130+ </div >
131+ </template >
132+ </LocalVueUiDumbbell >
133+ </template >
134+
135+ <template #VDUI-local >
136+ <LocalVueDataUi component =" VueUiDumbbell" :dataset =" dataset" :config =" config" :key =" `vdui_local_${step}`" >
137+ <template #svg =" { svg } " >
138+ <circle :cx =" 30" :cy =" 30" :r =" 30" fill =" #42d392" />
139+ <text :x =" 30" :y =" 30" text-anchor =" middle" >#SVG</text >
140+ </template >
141+ <template #legend =" { legend } " >
142+ #LEGEND
143+ <div style =" font-size : 8px " >
144+ {{ legend }}
145+ </div >
146+ </template >
147+ </LocalVueDataUi >
148+ </template >
149+
150+ <template #build >
151+ <VueUiDumbbell :dataset =" dataset" :config =" config" :key =" `build_${step}`" >
152+ <template #svg =" { svg } " >
153+ <circle :cx =" 30" :cy =" 30" :r =" 30" fill =" #42d392" />
154+ <text :x =" 30" :y =" 30" text-anchor =" middle" >#SVG</text >
155+ </template >
156+ <template #legend =" { legend } " >
157+ #LEGEND
158+ <div style =" font-size : 8px " >
159+ {{ legend }}
160+ </div >
161+ </template >
162+ </VueUiDumbbell >
163+ </template >
164+
165+ <template #VDUI-build >
166+ <VueDataUi component =" VueUiDumbbell" :dataset =" dataset" :config =" config" :key =" `vdui_build_${step}`" >
167+ <template #svg =" { svg } " >
168+ <circle :cx =" 30" :cy =" 30" :r =" 30" fill =" #42d392" />
169+ <text :x =" 30" :y =" 30" text-anchor =" middle" >#SVG</text >
170+ </template >
171+ <template #legend =" { legend } " >
172+ #LEGEND
173+ <div style =" font-size : 8px " >
174+ {{ legend }}
175+ </div >
176+ </template >
177+ </VueDataUi >
178+ </template >
179+
180+ <template #knobs >
181+ <div
182+ style =" display : flex ; flex-direction : row ; flex-wrap :wrap ; align-items :center ; width : 100% ; color : #CCCCCC ; gap :24px ;" >
183+ <div v-for =" knob in model" >
184+ <label style =" font-size : 10px " >{{ knob.key }}</label >
185+ <div
186+ style =" display :flex ; flex-direction :row ; flex-wrap : wrap ; align-items :center ; gap :6px ; height : 40px " >
187+ <input v-if =" !['none', 'select'].includes(knob.type)" :step =" knob.step" :type =" knob.type"
188+ :min =" knob.min ?? 0" :max =" knob.max ?? 0" v-model =" knob.def" @change =" step += 1" >
189+ <select v-if =" knob.type === 'select'" v-model =" knob.def" @change =" step += 1" >
190+ <option v-for =" opt in knob.options" >{{ opt }}</option >
191+ </select >
192+ </div >
193+ </div >
194+ </div >
195+ </template >
196+
197+ <template #config >
198+ {{ config }}
199+ </template >
200+ </Box >
201+ </template >
0 commit comments