@flux-ui/statistics 3.0.0-next.67 → 3.0.0-next.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/component/FluxStatisticsAreaChart.vue.d.ts +11 -4
- package/dist/component/FluxStatisticsBarChart.vue.d.ts +11 -4
- package/dist/component/FluxStatisticsBase.vue.d.ts +1 -0
- package/dist/component/FluxStatisticsBoxPlotChart.vue.d.ts +15 -0
- package/dist/component/FluxStatisticsBubbleChart.vue.d.ts +14 -0
- package/dist/component/FluxStatisticsCandlestickChart.vue.d.ts +15 -0
- package/dist/component/FluxStatisticsChart.vue.d.ts +7 -5
- package/dist/component/FluxStatisticsChartPane.vue.d.ts +1 -0
- package/dist/component/FluxStatisticsComparison.vue.d.ts +16 -0
- package/dist/component/FluxStatisticsDonutChart.vue.d.ts +8 -4
- package/dist/component/FluxStatisticsEmpty.vue.d.ts +19 -0
- package/dist/component/FluxStatisticsHeatmapChart.vue.d.ts +15 -0
- package/dist/component/FluxStatisticsLegendItem.vue.d.ts +1 -0
- package/dist/component/FluxStatisticsLegendScope.vue.d.ts +13 -0
- package/dist/component/FluxStatisticsLineChart.vue.d.ts +11 -4
- package/dist/component/FluxStatisticsMixedChart.vue.d.ts +17 -0
- package/dist/component/FluxStatisticsPercentageBar.vue.d.ts +8 -0
- package/dist/component/FluxStatisticsPieChart.vue.d.ts +8 -4
- package/dist/component/FluxStatisticsPolarAreaChart.vue.d.ts +14 -0
- package/dist/component/FluxStatisticsRadarChart.vue.d.ts +12 -0
- package/dist/component/FluxStatisticsRadialBar.vue.d.ts +11 -0
- package/dist/component/FluxStatisticsScatterChart.vue.d.ts +14 -0
- package/dist/component/FluxStatisticsSparkline.vue.d.ts +13 -0
- package/dist/component/FluxStatisticsTreemapChart.vue.d.ts +11 -0
- package/dist/component/index.d.ts +15 -0
- package/dist/composable/index.d.ts +12 -0
- package/dist/composable/useChartBaseSetup.d.ts +8 -0
- package/dist/composable/useChartHoverSync.d.ts +9 -0
- package/dist/composable/useChartLegend.d.ts +14 -0
- package/dist/composable/useChartSeriesSetup.d.ts +23 -0
- package/dist/composable/useChartSlicesSetup.d.ts +14 -0
- package/dist/composable/useECharts.d.ts +9 -0
- package/dist/echarts.d.ts +1 -0
- package/dist/index.css +262 -34
- package/dist/index.d.ts +5 -2
- package/dist/index.js +9176 -6895
- package/dist/index.js.map +1 -1
- package/dist/util/colors.d.ts +4 -0
- package/dist/util/icons.d.ts +2 -0
- package/dist/util/index.d.ts +6 -0
- package/dist/util/options/buildBaseOptions.d.ts +2 -0
- package/dist/util/options/buildCartesianBaseOptions.d.ts +13 -0
- package/dist/util/options/buildCircularBaseOptions.d.ts +2 -0
- package/dist/util/options/cartesian/buildAreaChartOptions.d.ts +17 -0
- package/dist/util/options/cartesian/buildBarChartOptions.d.ts +17 -0
- package/dist/util/options/cartesian/buildBoxPlotChartOptions.d.ts +16 -0
- package/dist/util/options/cartesian/buildBubbleChartOptions.d.ts +15 -0
- package/dist/util/options/cartesian/buildCandlestickChartOptions.d.ts +17 -0
- package/dist/util/options/cartesian/buildHeatmapChartOptions.d.ts +15 -0
- package/dist/util/options/cartesian/buildLineChartOptions.d.ts +17 -0
- package/dist/util/options/cartesian/buildMixedChartOptions.d.ts +17 -0
- package/dist/util/options/cartesian/buildScatterChartOptions.d.ts +15 -0
- package/dist/util/options/cartesian/index.d.ts +18 -0
- package/dist/util/options/circular/buildDonutChartOptions.d.ts +15 -0
- package/dist/util/options/circular/buildGaugeChartOptions.d.ts +14 -0
- package/dist/util/options/circular/buildPieChartOptions.d.ts +15 -0
- package/dist/util/options/circular/buildPolarAreaChartOptions.d.ts +15 -0
- package/dist/util/options/circular/buildRadarChartOptions.d.ts +13 -0
- package/dist/util/options/circular/buildTreemapChartOptions.d.ts +12 -0
- package/dist/util/options/circular/index.d.ts +12 -0
- package/dist/util/options/index.d.ts +6 -0
- package/dist/util/series/chartColors.d.ts +3 -0
- package/dist/util/series/converters.d.ts +17 -0
- package/dist/util/series/defaults.d.ts +15 -0
- package/dist/util/series/index.d.ts +4 -0
- package/dist/util/series/labels.d.ts +5 -0
- package/dist/util/sparkline.d.ts +7 -0
- package/dist/util/tooltips/buildBoxPlotTooltip.d.ts +22 -0
- package/dist/util/tooltips/buildCartesianTooltip.d.ts +10 -0
- package/dist/util/tooltips/buildGaugeTooltip.d.ts +14 -0
- package/dist/util/tooltips/buildHeatmapTooltip.d.ts +17 -0
- package/dist/util/tooltips/buildRadarTooltip.d.ts +11 -0
- package/dist/util/tooltips/buildSharedItemTooltip.d.ts +10 -0
- package/dist/util/tooltips/buildTreemapTooltip.d.ts +12 -0
- package/dist/util/tooltips/index.d.ts +15 -0
- package/dist/util/tooltips/render.d.ts +4 -0
- package/dist/util/tooltips/types.d.ts +24 -0
- package/package.json +14 -15
- package/src/component/FluxStatisticsAreaChart.vue +36 -43
- package/src/component/FluxStatisticsBarChart.vue +36 -35
- package/src/component/FluxStatisticsBase.vue +14 -1
- package/src/component/FluxStatisticsBoxPlotChart.vue +49 -0
- package/src/component/FluxStatisticsBubbleChart.vue +46 -0
- package/src/component/FluxStatisticsCandlestickChart.vue +50 -0
- package/src/component/FluxStatisticsChart.vue +19 -169
- package/src/component/FluxStatisticsChartPane.vue +22 -11
- package/src/component/FluxStatisticsComparison.vue +113 -0
- package/src/component/FluxStatisticsDonutChart.vue +31 -19
- package/src/component/FluxStatisticsEmpty.vue +44 -0
- package/src/component/FluxStatisticsHeatmapChart.vue +47 -0
- package/src/component/FluxStatisticsLegend.vue +33 -1
- package/src/component/FluxStatisticsLegendItem.vue +3 -1
- package/src/component/FluxStatisticsLegendScope.vue +16 -0
- package/src/component/FluxStatisticsLineChart.vue +36 -43
- package/src/component/FluxStatisticsMixedChart.vue +52 -0
- package/src/component/FluxStatisticsPercentageBar.vue +90 -0
- package/src/component/FluxStatisticsPieChart.vue +31 -19
- package/src/component/FluxStatisticsPolarAreaChart.vue +44 -0
- package/src/component/FluxStatisticsRadarChart.vue +40 -0
- package/src/component/FluxStatisticsRadialBar.vue +39 -0
- package/src/component/FluxStatisticsScatterChart.vue +46 -0
- package/src/component/FluxStatisticsSparkline.vue +67 -0
- package/src/component/FluxStatisticsTreemapChart.vue +35 -0
- package/src/component/index.ts +15 -0
- package/src/composable/index.ts +12 -0
- package/src/composable/useChartBaseSetup.ts +16 -0
- package/src/composable/useChartHoverSync.ts +92 -0
- package/src/composable/useChartLegend.ts +23 -0
- package/src/composable/useChartSeriesSetup.ts +75 -0
- package/src/composable/useChartSlicesSetup.ts +58 -0
- package/src/composable/useECharts.ts +55 -0
- package/src/css/Base.module.scss +28 -1
- package/src/css/Chart.module.scss +59 -30
- package/src/css/ChartPane.module.scss +20 -12
- package/src/css/Comparison.module.scss +52 -0
- package/src/css/Empty.module.scss +39 -0
- package/src/css/Grid.module.scss +1 -0
- package/src/css/Legend.module.scss +22 -4
- package/src/css/Meter.module.scss +1 -0
- package/src/css/Metric.module.scss +6 -0
- package/src/css/PercentageBar.module.scss +36 -0
- package/src/css/Sparkline.module.scss +13 -0
- package/src/echarts.ts +47 -0
- package/src/index.ts +7 -3
- package/src/util/colors.ts +86 -0
- package/src/util/icons.ts +20 -0
- package/src/util/index.ts +6 -0
- package/src/util/options/buildBaseOptions.ts +31 -0
- package/src/util/options/buildCartesianBaseOptions.ts +67 -0
- package/src/util/options/buildCircularBaseOptions.ts +10 -0
- package/src/util/options/cartesian/buildAreaChartOptions.ts +44 -0
- package/src/util/options/cartesian/buildBarChartOptions.ts +44 -0
- package/src/util/options/cartesian/buildBoxPlotChartOptions.ts +63 -0
- package/src/util/options/cartesian/buildBubbleChartOptions.ts +48 -0
- package/src/util/options/cartesian/buildCandlestickChartOptions.ts +77 -0
- package/src/util/options/cartesian/buildHeatmapChartOptions.ts +72 -0
- package/src/util/options/cartesian/buildLineChartOptions.ts +44 -0
- package/src/util/options/cartesian/buildMixedChartOptions.ts +44 -0
- package/src/util/options/cartesian/buildScatterChartOptions.ts +48 -0
- package/src/util/options/cartesian/index.ts +18 -0
- package/src/util/options/circular/buildDonutChartOptions.ts +31 -0
- package/src/util/options/circular/buildGaugeChartOptions.ts +45 -0
- package/src/util/options/circular/buildPieChartOptions.ts +31 -0
- package/src/util/options/circular/buildPolarAreaChartOptions.ts +31 -0
- package/src/util/options/circular/buildRadarChartOptions.ts +52 -0
- package/src/util/options/circular/buildTreemapChartOptions.ts +28 -0
- package/src/util/options/circular/index.ts +12 -0
- package/src/util/options/index.ts +6 -0
- package/src/util/series/chartColors.ts +20 -0
- package/src/util/series/converters.ts +318 -0
- package/src/util/series/defaults.ts +210 -0
- package/src/util/series/index.ts +4 -0
- package/src/util/series/labels.ts +30 -0
- package/src/util/sparkline.ts +67 -0
- package/src/util/tooltips/buildBoxPlotTooltip.ts +66 -0
- package/src/util/tooltips/buildCartesianTooltip.ts +44 -0
- package/src/util/tooltips/buildGaugeTooltip.ts +49 -0
- package/src/util/tooltips/buildHeatmapTooltip.ts +57 -0
- package/src/util/tooltips/buildRadarTooltip.ts +53 -0
- package/src/util/tooltips/buildSharedItemTooltip.ts +38 -0
- package/src/util/tooltips/buildTreemapTooltip.ts +49 -0
- package/src/util/tooltips/index.ts +15 -0
- package/src/util/tooltips/render.ts +66 -0
- package/src/util/tooltips/types.ts +29 -0
package/src/css/Base.module.scss
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
.statisticsBaseHeader {
|
|
19
19
|
display: flex;
|
|
20
20
|
padding: 18px 18px 0;
|
|
21
|
+
gap: 9px;
|
|
21
22
|
align-items: flex-start;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -29,10 +30,31 @@
|
|
|
29
30
|
word-break: break-word;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
.statisticsBaseHeaderIcon,
|
|
34
|
+
.statisticsBaseHeaderInfo {
|
|
35
|
+
font-size: 20px;
|
|
36
|
+
line-height: 24px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.statisticsBaseHeaderInfo {
|
|
40
|
+
margin-left: auto;
|
|
41
|
+
color: var(--foreground-secondary);
|
|
42
|
+
cursor: help;
|
|
43
|
+
scale: .75;
|
|
44
|
+
transition: color .2s var(--swift-out);
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
color: var(--foreground-prominent);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.statisticsBaseHeaderInfo + .statisticsBaseHeaderIcon {
|
|
52
|
+
margin-left: 6px;
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
.statisticsBaseHeaderIcon {
|
|
33
56
|
margin-left: auto;
|
|
34
57
|
color: var(--primary-600);
|
|
35
|
-
font-size: 20px;
|
|
36
58
|
}
|
|
37
59
|
|
|
38
60
|
.statisticsBaseSmall .statisticsBaseHeaderTitle {
|
|
@@ -41,6 +63,11 @@
|
|
|
41
63
|
line-height: 18px;
|
|
42
64
|
}
|
|
43
65
|
|
|
66
|
+
.statisticsBaseSmall .statisticsBaseHeaderInfo {
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
}
|
|
70
|
+
|
|
44
71
|
.statisticsBaseSmall .statisticsBaseHeaderIcon {
|
|
45
72
|
font-size: 18px;
|
|
46
73
|
}
|
|
@@ -20,42 +20,20 @@
|
|
|
20
20
|
position: absolute;
|
|
21
21
|
display: block;
|
|
22
22
|
inset: 0;
|
|
23
|
-
//inset: -3px -2px -4px -2px;
|
|
24
23
|
height: unset;
|
|
25
24
|
width: unset;
|
|
26
25
|
|
|
27
|
-
:global(svg) {
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
--stroke: rgb(from var(--surface-stroke) r g b / .5);
|
|
32
|
-
|
|
33
|
-
:global(.apexcharts-canvas) {
|
|
34
|
-
:global(.apexcharts-grid-borders) {
|
|
35
|
-
display: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:global(.apexcharts-yaxis-texts-g) {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
:global(.apexcharts-tooltip) {
|
|
43
|
-
background: rgb(from var(--surface) r g b / .975);
|
|
44
|
-
background-clip: padding-box;
|
|
45
|
-
backdrop-filter: blur(3px) saturate(180%);
|
|
46
|
-
border: 1px solid var(--surface-stroke-out-hover);
|
|
47
|
-
border-radius: var(--radius-double);
|
|
48
|
-
box-shadow: var(--shadow-lg);
|
|
49
|
-
color: var(--foreground);
|
|
50
|
-
contain: paint;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
27
|
}
|
|
54
28
|
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
.statisticsChartTooltip {
|
|
30
|
+
background: rgb(from var(--surface) r g b / .975);
|
|
31
|
+
background-clip: padding-box;
|
|
32
|
+
backdrop-filter: blur(3px) saturate(180%);
|
|
33
|
+
border: 1px solid var(--surface-stroke-out-hover);
|
|
34
|
+
border-radius: var(--radius-double);
|
|
35
|
+
box-shadow: var(--shadow-lg);
|
|
36
|
+
color: var(--foreground);
|
|
59
37
|
}
|
|
60
38
|
|
|
61
39
|
.statisticsChartTooltipTitle {
|
|
@@ -81,13 +59,64 @@
|
|
|
81
59
|
border-radius: 6px;
|
|
82
60
|
}
|
|
83
61
|
|
|
62
|
+
.statisticsChartTooltipSeriesIcon {
|
|
63
|
+
display: flex;
|
|
64
|
+
height: 14px;
|
|
65
|
+
width: 14px;
|
|
66
|
+
color: var(--danger-600);
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
|
|
70
|
+
& > svg {
|
|
71
|
+
height: 100%;
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
84
76
|
.statisticsChartTooltipSeriesName {
|
|
77
|
+
color: var(--foreground-secondary);
|
|
85
78
|
font-size: 14px;
|
|
86
79
|
font-weight: 700;
|
|
80
|
+
transition: color .15s ease-out;
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
.statisticsChartTooltipSeriesValue {
|
|
84
|
+
color: var(--foreground-secondary);
|
|
90
85
|
font-size: 14px;
|
|
91
86
|
font-weight: 500;
|
|
92
87
|
text-align: right;
|
|
88
|
+
transition: color .15s ease-out;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.statisticsChartTooltipSeriesName.isActive,
|
|
92
|
+
.statisticsChartTooltipSeriesValue.isActive {
|
|
93
|
+
color: var(--foreground-prominent);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.statisticsChartTooltipSection {
|
|
97
|
+
padding: 12px 18px;
|
|
98
|
+
transition: opacity .15s ease-out;
|
|
99
|
+
|
|
100
|
+
& + & {
|
|
101
|
+
border-top: 1px solid var(--surface-stroke);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.statisticsChartTooltipSection.isDimmed {
|
|
106
|
+
opacity: .55;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.statisticsChartTooltipSectionTitle {
|
|
110
|
+
color: var(--foreground-prominent);
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
font-weight: 700;
|
|
113
|
+
line-height: 1;
|
|
114
|
+
margin-bottom: 9px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.statisticsChartTooltipSectionBody {
|
|
118
|
+
display: grid;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 6px 15px;
|
|
121
|
+
grid-template-columns: repeat(3, auto);
|
|
93
122
|
}
|
|
@@ -3,34 +3,42 @@
|
|
|
3
3
|
.statisticsChartPane {
|
|
4
4
|
--aspect-ratio: unset;
|
|
5
5
|
|
|
6
|
+
container: chart-pane / inline-size;
|
|
6
7
|
max-width: 100%;
|
|
7
|
-
|
|
8
|
+
contain: paint;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.statisticsChartPaneBody {
|
|
11
12
|
display: grid;
|
|
13
|
+
align-content: start;
|
|
12
14
|
flex-grow: 1;
|
|
13
15
|
grid-template-columns: 1fr;
|
|
14
16
|
grid-template-rows: 1fr;
|
|
15
17
|
|
|
18
|
+
.statisticsChartPaneContainer {
|
|
19
|
+
height: calc(100cqw / var(--aspect-ratio, 1));
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
&:has(.statisticsLegend) {
|
|
17
|
-
|
|
23
|
+
align-items: center;
|
|
24
|
+
grid-template-columns: .4fr .6fr;
|
|
25
|
+
|
|
26
|
+
@container chart-pane (max-width: 390px) {
|
|
27
|
+
align-items: stretch;
|
|
28
|
+
grid-template-columns: 1fr;
|
|
29
|
+
grid-template-rows: auto auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.statisticsChartPaneContainer {
|
|
33
|
+
height: calc(40cqw / var(--aspect-ratio, 1));
|
|
34
|
+
}
|
|
18
35
|
}
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
.statisticsChartPaneContainer {
|
|
22
39
|
position: relative;
|
|
23
40
|
display: block;
|
|
24
|
-
|
|
25
|
-
&:first-child :global(svg) {
|
|
26
|
-
border-top-left-radius: var(--radius);
|
|
27
|
-
border-top-right-radius: var(--radius);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&:last-child :global(svg) {
|
|
31
|
-
border-bottom-left-radius: var(--radius);
|
|
32
|
-
border-bottom-right-radius: var(--radius);
|
|
33
|
-
}
|
|
41
|
+
align-self: center;
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
:local(.paneHeader) + .statisticsChartPaneContainer {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.statisticsComparison {
|
|
2
|
+
display: grid;
|
|
3
|
+
margin-top: 18px;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
grid-template-columns: 1fr auto 1fr;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.statisticsComparisonDivider {
|
|
10
|
+
width: 1px;
|
|
11
|
+
height: 36px;
|
|
12
|
+
background: var(--stroke);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.statisticsComparisonItem {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-flow: column;
|
|
18
|
+
gap: 3px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.statisticsComparisonItemLabel {
|
|
22
|
+
color: var(--foreground-secondary);
|
|
23
|
+
font-size: 13px;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.statisticsComparisonItemValue {
|
|
28
|
+
color: var(--foreground-prominent);
|
|
29
|
+
font-size: 21px;
|
|
30
|
+
font-weight: 800;
|
|
31
|
+
line-height: 28px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.statisticsComparisonItemValueMuted {
|
|
35
|
+
color: var(--foreground-secondary);
|
|
36
|
+
font-size: 18px;
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
line-height: 28px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.statisticsComparisonBottom {
|
|
42
|
+
display: flex;
|
|
43
|
+
margin-top: 9px;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 9px;
|
|
46
|
+
line-height: 18px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.statisticsComparisonFooter {
|
|
50
|
+
color: var(--foreground-secondary);
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.statisticsEmpty {
|
|
2
|
+
display: flex;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
padding: 24px 18px;
|
|
6
|
+
flex-flow: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
text-align: center;
|
|
10
|
+
gap: 9px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.statisticsEmptyIcon {
|
|
14
|
+
color: var(--foreground-secondary);
|
|
15
|
+
font-size: 32px;
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.statisticsEmptyTitle {
|
|
20
|
+
color: var(--foreground-prominent);
|
|
21
|
+
font-size: 16px;
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
line-height: 24px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.statisticsEmptyDescription {
|
|
27
|
+
max-width: 320px;
|
|
28
|
+
color: var(--foreground-secondary);
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.statisticsEmptyActions {
|
|
35
|
+
display: flex;
|
|
36
|
+
margin-top: 9px;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 9px;
|
|
39
|
+
}
|
package/src/css/Grid.module.scss
CHANGED
|
@@ -3,23 +3,36 @@
|
|
|
3
3
|
.statisticsLegend {
|
|
4
4
|
display: flex;
|
|
5
5
|
min-width: 0;
|
|
6
|
-
padding:
|
|
7
|
-
align-self: center;
|
|
6
|
+
padding: 0 9px;
|
|
8
7
|
flex-flow: column;
|
|
9
8
|
flex-grow: 1;
|
|
9
|
+
gap: 3px;
|
|
10
|
+
user-select: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:local(.statisticsChartPaneBody) .statisticsLegend {
|
|
14
|
+
padding: 9px 36px 9px 18px;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
.statisticsLegendItem {
|
|
13
18
|
--color: var(--primary-600);
|
|
14
19
|
|
|
20
|
+
position: relative;
|
|
15
21
|
display: flex;
|
|
16
|
-
padding: 6px
|
|
22
|
+
padding: 6px;
|
|
23
|
+
margin: 0 -9px;
|
|
17
24
|
align-items: flex-start;
|
|
18
25
|
flex-flow: row nowrap;
|
|
19
26
|
gap: 9px;
|
|
20
27
|
font-size: 14px;
|
|
21
28
|
line-height: 20px;
|
|
22
29
|
white-space: nowrap;
|
|
30
|
+
border-radius: var(--radius-half);
|
|
31
|
+
transition: background 120ms var(--swift-out);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.statisticsLegendItem.isHovered {
|
|
35
|
+
background: var(--surface-active);
|
|
23
36
|
}
|
|
24
37
|
|
|
25
38
|
.statisticsLegendItemColor {
|
|
@@ -47,6 +60,11 @@
|
|
|
47
60
|
text-align: right;
|
|
48
61
|
}
|
|
49
62
|
|
|
50
|
-
.statisticsLegendItem + .statisticsLegendItem {
|
|
63
|
+
.statisticsLegendItem + .statisticsLegendItem::before {
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: -2px;
|
|
66
|
+
left: 0;
|
|
67
|
+
right: 0;
|
|
68
|
+
content: '';
|
|
51
69
|
border-top: 1px dashed var(--surface-stroke);
|
|
52
70
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.statisticsPercentageBar {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-flow: column;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.statisticsPercentageBarTrack {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-flow: row nowrap;
|
|
10
|
+
gap: 3px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.statisticsPercentageBarSegment {
|
|
14
|
+
height: 12px;
|
|
15
|
+
border-radius: calc(var(--radius) / 3);
|
|
16
|
+
transition: var(--transition-default);
|
|
17
|
+
transition-property: height, margin, flex-grow, opacity;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.statisticsPercentageBarSegment:hover,
|
|
21
|
+
.statisticsPercentageBarSegment.isHovered {
|
|
22
|
+
height: 16px;
|
|
23
|
+
margin-top: -2px;
|
|
24
|
+
margin-bottom: -2px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.statisticsPercentageBarTrack.isHoverActive .statisticsPercentageBarSegment:not(.isHovered):not(:hover) {
|
|
28
|
+
opacity: 0.5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.statisticsPercentageBarTooltip {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
flex-flow: row nowrap;
|
|
35
|
+
gap: 9px;
|
|
36
|
+
}
|
package/src/echarts.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BarChart,
|
|
3
|
+
BoxplotChart,
|
|
4
|
+
CandlestickChart,
|
|
5
|
+
GaugeChart,
|
|
6
|
+
HeatmapChart,
|
|
7
|
+
LineChart,
|
|
8
|
+
PieChart,
|
|
9
|
+
RadarChart,
|
|
10
|
+
ScatterChart,
|
|
11
|
+
TreemapChart
|
|
12
|
+
} from 'echarts/charts';
|
|
13
|
+
import {
|
|
14
|
+
AxisPointerComponent,
|
|
15
|
+
GridComponent,
|
|
16
|
+
LegendComponent,
|
|
17
|
+
RadarComponent,
|
|
18
|
+
TitleComponent,
|
|
19
|
+
TooltipComponent,
|
|
20
|
+
VisualMapComponent
|
|
21
|
+
} from 'echarts/components';
|
|
22
|
+
import { use } from 'echarts/core';
|
|
23
|
+
import { LabelLayout, LegacyGridContainLabel } from 'echarts/features';
|
|
24
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
25
|
+
|
|
26
|
+
use([
|
|
27
|
+
BarChart,
|
|
28
|
+
BoxplotChart,
|
|
29
|
+
CandlestickChart,
|
|
30
|
+
GaugeChart,
|
|
31
|
+
HeatmapChart,
|
|
32
|
+
LineChart,
|
|
33
|
+
PieChart,
|
|
34
|
+
RadarChart,
|
|
35
|
+
ScatterChart,
|
|
36
|
+
TreemapChart,
|
|
37
|
+
AxisPointerComponent,
|
|
38
|
+
GridComponent,
|
|
39
|
+
LegendComponent,
|
|
40
|
+
RadarComponent,
|
|
41
|
+
TitleComponent,
|
|
42
|
+
TooltipComponent,
|
|
43
|
+
VisualMapComponent,
|
|
44
|
+
LabelLayout,
|
|
45
|
+
LegacyGridContainLabel,
|
|
46
|
+
CanvasRenderer
|
|
47
|
+
]);
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { amber500, blue500, cyan500, emerald500, fuchsia500, green500, indigo500, lime500, orange500, pink500, purple500, red500, rose50, sky500, teal500, violet500, yellow500 } from '@flux-ui/internals';
|
|
2
|
+
import type { FluxStatisticsChartColor } from '@flux-ui/types';
|
|
2
3
|
|
|
3
4
|
export * from './component';
|
|
5
|
+
export * from './composable';
|
|
4
6
|
|
|
5
|
-
export
|
|
7
|
+
export type { ChartTooltipValueFormatter, SharedTooltipItem, Translator } from './util';
|
|
8
|
+
|
|
9
|
+
export const CHART_COLORS: readonly FluxStatisticsChartColor[] = [
|
|
6
10
|
'var(--chart-1)',
|
|
7
11
|
'var(--chart-2)',
|
|
8
12
|
'var(--chart-3)',
|
|
9
13
|
'var(--chart-4)'
|
|
10
14
|
];
|
|
11
15
|
|
|
12
|
-
export const CHART_COLORFUL_COLORS = [
|
|
16
|
+
export const CHART_COLORFUL_COLORS: readonly FluxStatisticsChartColor[] = [
|
|
13
17
|
red500,
|
|
14
18
|
orange500,
|
|
15
19
|
amber500,
|
|
@@ -27,4 +31,4 @@ export const CHART_COLORFUL_COLORS = [
|
|
|
27
31
|
fuchsia500,
|
|
28
32
|
pink500,
|
|
29
33
|
rose50
|
|
30
|
-
];
|
|
34
|
+
] as FluxStatisticsChartColor[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
const CSS_VAR_PATTERN = /var\((--[^,)]+)(?:,\s*([^)]+))?\)/g;
|
|
4
|
+
|
|
5
|
+
const themeVersion = ref(0);
|
|
6
|
+
|
|
7
|
+
if (typeof document !== 'undefined') {
|
|
8
|
+
new MutationObserver(() => themeVersion.value++).observe(
|
|
9
|
+
document.documentElement,
|
|
10
|
+
{ attributes: true, attributeFilter: ['class', 'data-theme'] }
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function useCssVarVersion() {
|
|
15
|
+
return themeVersion;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function resolveCssVar(input: string, root?: HTMLElement): string {
|
|
19
|
+
if (typeof document === 'undefined' || !input.includes('var(')) {
|
|
20
|
+
return input;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const target = root ?? document.documentElement;
|
|
24
|
+
|
|
25
|
+
return input.replace(CSS_VAR_PATTERN, (match, name: string, fallback?: string) => {
|
|
26
|
+
const value = getComputedStyle(target).getPropertyValue(name).trim();
|
|
27
|
+
|
|
28
|
+
if (value) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return fallback ? resolveCssVar(fallback.trim(), target) : match;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
37
|
+
if (value === null || typeof value !== 'object') {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const proto = Object.getPrototypeOf(value);
|
|
42
|
+
return proto === Object.prototype || proto === null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function deepResolveCssVars<T>(value: T, root?: HTMLElement): T {
|
|
46
|
+
if (typeof value === 'string') {
|
|
47
|
+
return (value.includes('var(') ? resolveCssVar(value, root) : value) as T;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (Array.isArray(value)) {
|
|
51
|
+
let changed = false;
|
|
52
|
+
const out: unknown[] = new Array(value.length);
|
|
53
|
+
|
|
54
|
+
for (let i = 0; i < value.length; i++) {
|
|
55
|
+
const resolved = deepResolveCssVars(value[i], root);
|
|
56
|
+
|
|
57
|
+
if (resolved !== value[i]) {
|
|
58
|
+
changed = true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
out[i] = resolved;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (changed ? out : value) as T;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!isPlainObject(value)) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let changed = false;
|
|
72
|
+
const out: Record<string, unknown> = {};
|
|
73
|
+
|
|
74
|
+
for (const key of Object.keys(value)) {
|
|
75
|
+
const original = value[key];
|
|
76
|
+
const resolved = deepResolveCssVars(original, root);
|
|
77
|
+
|
|
78
|
+
if (resolved !== original) {
|
|
79
|
+
changed = true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
out[key] = resolved;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (changed ? out : value) as T;
|
|
86
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { iconRegistry } from '@flux-ui/components';
|
|
2
|
+
import type { FluxIconName } from '@flux-ui/types';
|
|
3
|
+
|
|
4
|
+
export function renderIconSvg(name: FluxIconName | undefined, color: string, size: number = 14): string {
|
|
5
|
+
if (!name) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const icon = iconRegistry[name];
|
|
10
|
+
|
|
11
|
+
if (!icon) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const [width, height, , , pathData] = icon;
|
|
16
|
+
const paths = Array.isArray(pathData) ? pathData : [pathData];
|
|
17
|
+
const pathElements = paths.map(d => `<path d="${d}" fill="${color}"/>`).join('');
|
|
18
|
+
|
|
19
|
+
return `<svg viewBox="0 0 ${width} ${height}" width="${size}" height="${size}" focusable="false" aria-hidden="true">${pathElements}</svg>`;
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EChartsOption } from '~flux/statistics/composable';
|
|
2
|
+
|
|
3
|
+
export function buildBaseOptions(): EChartsOption {
|
|
4
|
+
return {
|
|
5
|
+
color: [
|
|
6
|
+
'var(--chart-1)',
|
|
7
|
+
'var(--chart-2)',
|
|
8
|
+
'var(--chart-3)',
|
|
9
|
+
'var(--chart-4)'
|
|
10
|
+
],
|
|
11
|
+
animation: true,
|
|
12
|
+
animationDuration: 1000,
|
|
13
|
+
animationDurationUpdate: 400,
|
|
14
|
+
animationEasing: 'cubicOut',
|
|
15
|
+
animationEasingUpdate: 'cubicInOut',
|
|
16
|
+
tooltip: {
|
|
17
|
+
show: false,
|
|
18
|
+
backgroundColor: 'transparent',
|
|
19
|
+
borderWidth: 0,
|
|
20
|
+
padding: 0,
|
|
21
|
+
extraCssText: 'box-shadow: none;',
|
|
22
|
+
axisPointer: {
|
|
23
|
+
appendTo: 'body',
|
|
24
|
+
snap: true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
legend: {
|
|
28
|
+
show: false
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|