@@ -159,78 +159,36 @@ const pieChart = new Chart(ctx, {
159159});
160160```
161161
162- ### Morris.js Charts
162+ ### ECharts
163163
164- #### Line Charts
165- ``` javascript
166- Morris .Line ({
167- element: ' line-chart' ,
168- data: [
169- { y: ' 2023-01' , a: 100 , b: 90 },
170- { y: ' 2023-02' , a: 75 , b: 65 },
171- { y: ' 2023-03' , a: 50 , b: 40 }
172- ],
173- xkey: ' y' ,
174- ykeys: [' a' , ' b' ],
175- labels: [' Series A' , ' Series B' ]
176- });
177- ```
178-
179- #### Area Charts
180164``` javascript
181- Morris .Area ({
182- element: ' area-chart' ,
183- data: [
184- { period: ' 2023-01' , sales: 2666 , downloads: 2647 },
185- { period: ' 2023-02' , sales: 2778 , downloads: 2294 }
186- ],
187- xkey: ' period' ,
188- ykeys: [' sales' , ' downloads' ],
189- labels: [' Sales' , ' Downloads' ]
165+ import * as echarts from ' echarts' ;
166+
167+ const chart = echarts .init (document .getElementById (' echart-line' ));
168+ chart .setOption ({
169+ xAxis: { type: ' category' , data: [' Jan' , ' Feb' , ' Mar' , ' Apr' , ' May' ] },
170+ yAxis: { type: ' value' },
171+ series: [{
172+ data: [820 , 932 , 901 , 934 , 1290 ],
173+ type: ' line' ,
174+ smooth: true
175+ }]
190176});
191177```
192178
193- ### Sparkline Charts
179+ #### Gauge Charts
194180
195181``` javascript
196- $ (' .sparkline' ).sparkline ([5 ,6 ,7 ,2 ,0 ,- 4 ,- 2 ,4 ], {
197- type: ' line' ,
198- width: ' 100%' ,
199- height: ' 30' ,
200- lineColor: ' #26B99A' ,
201- fillColor: ' rgba(38, 185, 154, 0.3)'
182+ const gauge = echarts .init (document .getElementById (' echart-gauge' ));
183+ gauge .setOption ({
184+ series: [{
185+ type: ' gauge' ,
186+ detail: { formatter: ' {value}%' },
187+ data: [{ value: 67 , name: ' Progress' }]
188+ }]
202189});
203190```
204191
205- ### Gauge Charts
206-
207- ``` javascript
208- import Gauge from ' gauge.js' ;
209-
210- const gauge = new Gauge (document .getElementById (' gauge' )).setOptions ({
211- angle: 0.15 ,
212- lineWidth: 0.2 ,
213- radiusScale: 1 ,
214- pointer: {
215- length: 0.6 ,
216- strokeWidth: 0.035 ,
217- color: ' #000000'
218- },
219- limitMax: false ,
220- limitMin: false ,
221- colorStart: ' #6FADCF' ,
222- colorStop: ' #8FC0DA' ,
223- strokeColor: ' #E0E0E0' ,
224- generateGradient: true ,
225- highDpiSupport: true
226- });
227-
228- gauge .maxValue = 100 ;
229- gauge .setMinValue (0 );
230- gauge .animationSpeed = 32 ;
231- gauge .set (67 );
232- ```
233-
234192---
235193
236194## Form Components
@@ -263,21 +221,24 @@ gauge.set(67);
263221
264222### Advanced Form Components
265223
266- #### Select2 Enhanced Dropdowns
224+ #### Choices.js Enhanced Dropdowns
225+
267226``` html
268- <select class =" form-control select2 " multiple = " multiple " >
227+ <select class =" form-control choices-select " multiple >
269228 <option value =" AK" >Alaska</option >
270229 <option value =" HI" >Hawaii</option >
271230 <option value =" CA" >California</option >
272231</select >
273232```
274233
275234``` javascript
276- // Initialize Select2
277- $ (' .select2' ).select2 ({
278- theme: ' bootstrap-5' ,
279- width: ' 100%' ,
280- placeholder: ' Select options...'
235+ import Choices from ' choices.js' ;
236+
237+ new Choices (' .choices-select' , {
238+ removeItemButton: true ,
239+ searchEnabled: true ,
240+ placeholder: true ,
241+ placeholderValue: ' Select options...'
281242});
282243```
283244
@@ -669,58 +630,40 @@ animateProgress('.progress-bar', 85);
669630
670631## Map Components
671632
672- ### jVectorMap Integration
633+ ### Leaflet Maps
634+
635+ #### Basic Map
673636
674- #### World Map
675637``` html
676- <div id =" world- map" style =" height : 400px ;" ></div >
638+ <div id =" map" style =" height : 400px ;" ></div >
677639```
678640
679641``` javascript
680- $ (' #world-map' ).vectorMap ({
681- map: ' world_mill' ,
682- backgroundColor: ' transparent' ,
683- regionStyle: {
684- initial: {
685- fill: ' #73879C' ,
686- " fill-opacity" : 1 ,
687- stroke: ' #fff' ,
688- " stroke-width" : 1 ,
689- " stroke-opacity" : 1
690- }
691- },
692- series: {
693- regions: [{
694- values: {
695- " US" : 298 ,
696- " SA" : 200 ,
697- " AU" : 760 ,
698- " IN" : 2000000 ,
699- " GB" : 120
700- },
701- scale: [' #26B99A' , ' #E74C3C' ],
702- normalizeFunction: ' polynomial'
703- }]
704- }
705- });
642+ import L from ' leaflet' ;
643+
644+ const map = L .map (' map' ).setView ([51.505 , - 0.09 ], 13 );
645+
646+ L .tileLayer (' https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' , {
647+ attribution: ' © OpenStreetMap contributors'
648+ }).addTo (map);
649+
650+ L .marker ([51.5 , - 0.09 ]).addTo (map)
651+ .bindPopup (' Hello from Leaflet!' )
652+ .openPopup ();
706653```
707654
708- #### Regional Map
655+ #### Map with Multiple Markers
656+
709657``` javascript
710- $ (' #usa-map' ).vectorMap ({
711- map: ' us_aea' ,
712- backgroundColor: ' transparent' ,
713- regionsSelectable: true ,
714- series: {
715- regions: [{
716- values: {
717- " US-CA" : 200 ,
718- " US-TX" : 300 ,
719- " US-NY" : 250
720- },
721- scale: [' #3498DB' , ' #E74C3C' ]
722- }]
723- }
658+ const locations = [
659+ { lat: 40.7128 , lng: - 74.006 , label: ' New York' },
660+ { lat: 34.0522 , lng: - 118.2437 , label: ' Los Angeles' },
661+ { lat: 41.8781 , lng: - 87.6298 , label: ' Chicago' }
662+ ];
663+
664+ locations .forEach (loc => {
665+ L .marker ([loc .lat , loc .lng ]).addTo (map)
666+ .bindPopup (loc .label );
724667});
725668```
726669
0 commit comments