File tree Expand file tree Collapse file tree 3 files changed +60
-46
lines changed
src/components/sections/marketplace/MarketplaceDetails/MarketplaceDetailsChart Expand file tree Collapse file tree 3 files changed +60
-46
lines changed Original file line number Diff line number Diff line change 25
25
"clsx" : " ^2.1.1" ,
26
26
"dayjs" : " ^1.11.18" ,
27
27
"docusaurus-plugin-sass" : " ^0.2.6" ,
28
- "echarts" : " ^5.6 .0" ,
28
+ "echarts" : " ^6.0 .0" ,
29
29
"embla-carousel-auto-scroll" : " ^8.6.0" ,
30
30
"embla-carousel-react" : " ^8.6.0" ,
31
31
"fetch-jsonp" : " ^1.3.0" ,
57
57
},
58
58
"engines" : {
59
59
"node" : " >=20.0"
60
+ },
61
+ "overrides" : {
62
+ "@kbox-labs/react-echarts" : {
63
+ "echarts" : " $echarts"
64
+ }
60
65
}
61
66
}
Original file line number Diff line number Diff line change
1
+ import type { SeriesOption } from 'echarts' ;
1
2
import type { ModuleDownloadsChart } from '@site/src/types/marketplace' ;
2
- import { EChart } from '@kbox-labs/react-echarts' ;
3
+ import { useMemo } from 'react' ;
4
+ import { EChart , EChartProps } from '@kbox-labs/react-echarts' ;
5
+
6
+ const eChartStaticProps : EChartProps = {
7
+ renderer : 'svg' ,
8
+ style : {
9
+ height : '300px' ,
10
+ width : '100%' ,
11
+ } ,
12
+ grid : {
13
+ left : 40 ,
14
+ top : 40 ,
15
+ right : 0 ,
16
+ bottom : 40 ,
17
+ } ,
18
+ xAxis : {
19
+ type : 'category' ,
20
+ axisLabel : {
21
+ color : '#fff' ,
22
+ } ,
23
+ boundaryGap : false ,
24
+ } ,
25
+ yAxis : {
26
+ type : 'value' ,
27
+ axisLabel : {
28
+ color : '#fff' ,
29
+ } ,
30
+ } ,
31
+ } ;
3
32
4
33
type Props = {
5
34
downloads : ModuleDownloadsChart [ ] ;
@@ -8,42 +37,22 @@ type Props = {
8
37
export default function MarketplaceDetailsChart ( { downloads } : Props ) {
9
38
if ( ! downloads . length ) return null ;
10
39
11
- return (
12
- < EChart
13
- renderer = { 'svg' }
14
- style = { {
15
- height : '300px' ,
16
- width : '100%' ,
17
- } }
18
- grid = { {
19
- left : 40 ,
20
- top : 40 ,
21
- right : 0 ,
22
- bottom : 40 ,
23
- } }
24
- xAxis = { {
25
- type : 'category' ,
26
- boundaryGap : false ,
27
- } }
28
- yAxis = { {
29
- type : 'value' ,
30
- } }
31
- textStyle = { {
32
- color : '#fff' ,
33
- } }
34
- series = { [
35
- {
36
- type : 'line' ,
37
- data : downloads ,
38
- lineStyle : {
39
- color : 'var(--ifm-color-primary-darkest)' ,
40
- } ,
41
- areaStyle : {
42
- color : 'var(--ifm-color-primary-darkest)' ,
43
- } ,
44
- silent : true ,
40
+ const eChartSeries : SeriesOption [ ] = useMemo (
41
+ ( ) => [
42
+ {
43
+ type : 'line' ,
44
+ data : downloads ,
45
+ lineStyle : {
46
+ color : 'var(--ifm-color-primary-darkest)' ,
45
47
} ,
46
- ] }
47
- />
48
+ areaStyle : {
49
+ color : 'var(--ifm-color-primary-darkest)' ,
50
+ } ,
51
+ silent : true ,
52
+ } ,
53
+ ] ,
54
+ [ ] ,
48
55
) ;
56
+
57
+ return < EChart { ...eChartStaticProps } series = { eChartSeries } /> ;
49
58
}
You can’t perform that action at this time.
0 commit comments