@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
|
@@ -1,59 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Chart
|
|
3
|
-
|
|
4
|
-
:options="
|
|
5
|
-
chart: {
|
|
6
|
-
type: 'area',
|
|
7
|
-
sparkline: {
|
|
8
|
-
enabled: true
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
fill: {
|
|
12
|
-
gradient: {
|
|
13
|
-
enabled: true,
|
|
14
|
-
opacityFrom: 0.5,
|
|
15
|
-
opacityTo: 0
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
grid: {
|
|
19
|
-
show: true,
|
|
20
|
-
clipMarkers: false
|
|
21
|
-
},
|
|
22
|
-
legend: {
|
|
23
|
-
show: false
|
|
24
|
-
},
|
|
25
|
-
stroke: {
|
|
26
|
-
curve: 'smooth',
|
|
27
|
-
width: 2
|
|
28
|
-
}
|
|
29
|
-
}, options)"
|
|
30
|
-
:series="translatedSeries"/>
|
|
3
|
+
ref="chartRef"
|
|
4
|
+
:options="mergedOptions"/>
|
|
31
5
|
</template>
|
|
32
6
|
|
|
33
7
|
<script
|
|
34
8
|
lang="ts"
|
|
35
9
|
setup>
|
|
36
|
-
import type {
|
|
37
|
-
import { merge } from 'lodash-es';
|
|
10
|
+
import type { FluxStatisticsChartAreaSeries } from '@flux-ui/types';
|
|
38
11
|
import { computed } from 'vue';
|
|
39
|
-
import {
|
|
12
|
+
import { useChartSeriesSetup, type EChartsOption } from '~flux/statistics/composable';
|
|
13
|
+
import { buildAreaChartOptions, type ChartTooltipValueFormatter } from '~flux/statistics/util';
|
|
40
14
|
import Chart from './FluxStatisticsChart.vue';
|
|
15
|
+
import $style from '~flux/statistics/css/Chart.module.scss';
|
|
41
16
|
|
|
42
17
|
const {
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
advancedOptions,
|
|
19
|
+
labels,
|
|
20
|
+
series,
|
|
21
|
+
splitLines = false,
|
|
22
|
+
tooltip = false,
|
|
23
|
+
tooltipValueFormatter,
|
|
24
|
+
xAxisLabels = false,
|
|
25
|
+
yAxisLabels = false
|
|
45
26
|
} = defineProps<{
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly series:
|
|
27
|
+
readonly advancedOptions?: EChartsOption;
|
|
28
|
+
readonly labels?: readonly string[];
|
|
29
|
+
readonly series: readonly FluxStatisticsChartAreaSeries[];
|
|
30
|
+
readonly splitLines?: boolean;
|
|
31
|
+
readonly tooltip?: boolean;
|
|
32
|
+
readonly tooltipValueFormatter?: ChartTooltipValueFormatter;
|
|
33
|
+
readonly xAxisLabels?: boolean;
|
|
34
|
+
readonly yAxisLabels?: boolean;
|
|
49
35
|
}>();
|
|
50
36
|
|
|
51
|
-
const {t} =
|
|
37
|
+
const { t, palette } = useChartSeriesSetup(() => series);
|
|
52
38
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
const mergedOptions = computed(() => buildAreaChartOptions({
|
|
40
|
+
series,
|
|
41
|
+
labels,
|
|
42
|
+
palette: palette.value,
|
|
43
|
+
t,
|
|
44
|
+
styles: $style,
|
|
45
|
+
tooltip,
|
|
46
|
+
tooltipValueFormatter,
|
|
47
|
+
xAxisLabels,
|
|
48
|
+
yAxisLabels,
|
|
49
|
+
splitLines,
|
|
50
|
+
advancedOptions
|
|
51
|
+
}));
|
|
59
52
|
</script>
|
|
@@ -1,51 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Chart
|
|
3
|
-
|
|
4
|
-
:options="
|
|
5
|
-
chart: {
|
|
6
|
-
type: 'bar'
|
|
7
|
-
},
|
|
8
|
-
grid: {
|
|
9
|
-
show: true,
|
|
10
|
-
clipMarkers: false,
|
|
11
|
-
padding: {
|
|
12
|
-
top: 18,
|
|
13
|
-
left: 9,
|
|
14
|
-
right: 9
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
tooltip: {
|
|
18
|
-
shared: true,
|
|
19
|
-
intersect: false
|
|
20
|
-
}
|
|
21
|
-
}, options)"
|
|
22
|
-
:series="translatedSeries"/>
|
|
3
|
+
ref="chartRef"
|
|
4
|
+
:options="mergedOptions"/>
|
|
23
5
|
</template>
|
|
24
6
|
|
|
25
7
|
<script
|
|
26
8
|
lang="ts"
|
|
27
9
|
setup>
|
|
28
|
-
import type {
|
|
29
|
-
import { merge } from 'lodash-es';
|
|
10
|
+
import type { FluxStatisticsChartBarSeries } from '@flux-ui/types';
|
|
30
11
|
import { computed } from 'vue';
|
|
31
|
-
import {
|
|
12
|
+
import { useChartSeriesSetup, type EChartsOption } from '~flux/statistics/composable';
|
|
13
|
+
import { buildBarChartOptions, type ChartTooltipValueFormatter } from '~flux/statistics/util';
|
|
32
14
|
import Chart from './FluxStatisticsChart.vue';
|
|
15
|
+
import $style from '~flux/statistics/css/Chart.module.scss';
|
|
33
16
|
|
|
34
17
|
const {
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
advancedOptions,
|
|
19
|
+
labels,
|
|
20
|
+
series,
|
|
21
|
+
splitLines = false,
|
|
22
|
+
tooltip = false,
|
|
23
|
+
tooltipValueFormatter,
|
|
24
|
+
xAxisLabels = false,
|
|
25
|
+
yAxisLabels = false
|
|
37
26
|
} = defineProps<{
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly series:
|
|
27
|
+
readonly advancedOptions?: EChartsOption;
|
|
28
|
+
readonly labels?: readonly string[];
|
|
29
|
+
readonly series: readonly FluxStatisticsChartBarSeries[];
|
|
30
|
+
readonly splitLines?: boolean;
|
|
31
|
+
readonly tooltip?: boolean;
|
|
32
|
+
readonly tooltipValueFormatter?: ChartTooltipValueFormatter;
|
|
33
|
+
readonly xAxisLabels?: boolean;
|
|
34
|
+
readonly yAxisLabels?: boolean;
|
|
41
35
|
}>();
|
|
42
36
|
|
|
43
|
-
const {t} =
|
|
37
|
+
const { t, palette } = useChartSeriesSetup(() => series);
|
|
44
38
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
const mergedOptions = computed(() => buildBarChartOptions({
|
|
40
|
+
series,
|
|
41
|
+
labels,
|
|
42
|
+
palette: palette.value,
|
|
43
|
+
t,
|
|
44
|
+
styles: $style,
|
|
45
|
+
tooltip,
|
|
46
|
+
tooltipValueFormatter,
|
|
47
|
+
xAxisLabels,
|
|
48
|
+
yAxisLabels,
|
|
49
|
+
splitLines,
|
|
50
|
+
advancedOptions
|
|
51
|
+
}));
|
|
51
52
|
</script>
|
|
@@ -7,6 +7,18 @@
|
|
|
7
7
|
{{ title }}
|
|
8
8
|
</span>
|
|
9
9
|
|
|
10
|
+
<FluxTooltip
|
|
11
|
+
v-if="slots.info"
|
|
12
|
+
direction="vertical">
|
|
13
|
+
<template #content>
|
|
14
|
+
<slot name="info"/>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<FluxIcon
|
|
18
|
+
:class="$style.statisticsBaseHeaderInfo"
|
|
19
|
+
name="circle-info"/>
|
|
20
|
+
</FluxTooltip>
|
|
21
|
+
|
|
10
22
|
<FluxIcon
|
|
11
23
|
v-if="icon"
|
|
12
24
|
:class="$style.statisticsBaseHeaderIcon"
|
|
@@ -26,7 +38,7 @@
|
|
|
26
38
|
<script
|
|
27
39
|
lang="ts"
|
|
28
40
|
setup>
|
|
29
|
-
import { FluxIcon, FluxPane } from '@flux-ui/components';
|
|
41
|
+
import { FluxIcon, FluxPane, FluxTooltip } from '@flux-ui/components';
|
|
30
42
|
import type { FluxIconName } from '@flux-ui/types';
|
|
31
43
|
import $style from '~flux/statistics/css/Base.module.scss';
|
|
32
44
|
|
|
@@ -39,5 +51,6 @@
|
|
|
39
51
|
const slots = defineSlots<{
|
|
40
52
|
content?(): any;
|
|
41
53
|
default?(): any;
|
|
54
|
+
info?(): any;
|
|
42
55
|
}>();
|
|
43
56
|
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Chart
|
|
3
|
+
ref="chartRef"
|
|
4
|
+
:options="mergedOptions"/>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script
|
|
8
|
+
lang="ts"
|
|
9
|
+
setup>
|
|
10
|
+
import type { FluxStatisticsChartBoxPlotSeries } from '@flux-ui/types';
|
|
11
|
+
import { computed } from 'vue';
|
|
12
|
+
import { useChartSeriesSetup, type EChartsOption } from '~flux/statistics/composable';
|
|
13
|
+
import { buildBoxPlotChartOptions } from '~flux/statistics/util';
|
|
14
|
+
import Chart from './FluxStatisticsChart.vue';
|
|
15
|
+
import $style from '~flux/statistics/css/Chart.module.scss';
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
advancedOptions,
|
|
19
|
+
labels,
|
|
20
|
+
series,
|
|
21
|
+
splitLines = false,
|
|
22
|
+
tooltip = false,
|
|
23
|
+
xAxisLabels = false,
|
|
24
|
+
yAxisLabels = false
|
|
25
|
+
} = defineProps<{
|
|
26
|
+
readonly advancedOptions?: EChartsOption;
|
|
27
|
+
readonly labels?: readonly string[];
|
|
28
|
+
readonly series: readonly FluxStatisticsChartBoxPlotSeries[];
|
|
29
|
+
readonly splitLines?: boolean;
|
|
30
|
+
readonly tooltip?: boolean;
|
|
31
|
+
readonly xAxisLabels?: boolean;
|
|
32
|
+
readonly yAxisLabels?: boolean;
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const { t, palette } = useChartSeriesSetup(() => series);
|
|
36
|
+
|
|
37
|
+
const mergedOptions = computed(() => buildBoxPlotChartOptions({
|
|
38
|
+
series,
|
|
39
|
+
labels,
|
|
40
|
+
palette: palette.value,
|
|
41
|
+
t,
|
|
42
|
+
styles: $style,
|
|
43
|
+
tooltip,
|
|
44
|
+
xAxisLabels,
|
|
45
|
+
yAxisLabels,
|
|
46
|
+
splitLines,
|
|
47
|
+
advancedOptions
|
|
48
|
+
}));
|
|
49
|
+
</script>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Chart
|
|
3
|
+
ref="chartRef"
|
|
4
|
+
:options="mergedOptions"/>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script
|
|
8
|
+
lang="ts"
|
|
9
|
+
setup>
|
|
10
|
+
import type { FluxStatisticsChartBubbleSeries } from '@flux-ui/types';
|
|
11
|
+
import { computed } from 'vue';
|
|
12
|
+
import { useChartSeriesSetup, type EChartsOption } from '~flux/statistics/composable';
|
|
13
|
+
import { buildBubbleChartOptions } from '~flux/statistics/util';
|
|
14
|
+
import Chart from './FluxStatisticsChart.vue';
|
|
15
|
+
import $style from '~flux/statistics/css/Chart.module.scss';
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
advancedOptions,
|
|
19
|
+
series,
|
|
20
|
+
splitLines = false,
|
|
21
|
+
tooltip = false,
|
|
22
|
+
xAxisLabels = false,
|
|
23
|
+
yAxisLabels = false
|
|
24
|
+
} = defineProps<{
|
|
25
|
+
readonly advancedOptions?: EChartsOption;
|
|
26
|
+
readonly series: readonly FluxStatisticsChartBubbleSeries[];
|
|
27
|
+
readonly splitLines?: boolean;
|
|
28
|
+
readonly tooltip?: boolean;
|
|
29
|
+
readonly xAxisLabels?: boolean;
|
|
30
|
+
readonly yAxisLabels?: boolean;
|
|
31
|
+
}>();
|
|
32
|
+
|
|
33
|
+
const { t, palette } = useChartSeriesSetup(() => series);
|
|
34
|
+
|
|
35
|
+
const mergedOptions = computed(() => buildBubbleChartOptions({
|
|
36
|
+
series,
|
|
37
|
+
palette: palette.value,
|
|
38
|
+
t,
|
|
39
|
+
styles: $style,
|
|
40
|
+
tooltip,
|
|
41
|
+
xAxisLabels,
|
|
42
|
+
yAxisLabels,
|
|
43
|
+
splitLines,
|
|
44
|
+
advancedOptions
|
|
45
|
+
}));
|
|
46
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Chart
|
|
3
|
+
ref="chartRef"
|
|
4
|
+
:options="mergedOptions"/>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script
|
|
8
|
+
lang="ts"
|
|
9
|
+
setup>
|
|
10
|
+
import type { FluxStatisticsChartCandlestickSeries } from '@flux-ui/types';
|
|
11
|
+
import { computed } from 'vue';
|
|
12
|
+
import { useChartSeriesSetup, type EChartsOption } from '~flux/statistics/composable';
|
|
13
|
+
import { buildCandlestickChartOptions, candlestickLegendItemBuilder } from '~flux/statistics/util';
|
|
14
|
+
import Chart from './FluxStatisticsChart.vue';
|
|
15
|
+
import $style from '~flux/statistics/css/Chart.module.scss';
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
advancedOptions,
|
|
19
|
+
labels,
|
|
20
|
+
series,
|
|
21
|
+
splitLines = false,
|
|
22
|
+
tooltip = false,
|
|
23
|
+
xAxisLabels = false,
|
|
24
|
+
yAxisLabels = false
|
|
25
|
+
} = defineProps<{
|
|
26
|
+
readonly advancedOptions?: EChartsOption;
|
|
27
|
+
readonly labels?: readonly string[];
|
|
28
|
+
readonly series: readonly FluxStatisticsChartCandlestickSeries[];
|
|
29
|
+
readonly splitLines?: boolean;
|
|
30
|
+
readonly tooltip?: boolean;
|
|
31
|
+
readonly xAxisLabels?: boolean;
|
|
32
|
+
readonly yAxisLabels?: boolean;
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const { t } = useChartSeriesSetup(() => series, {
|
|
36
|
+
getLegendItem: candlestickLegendItemBuilder
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const mergedOptions = computed(() => buildCandlestickChartOptions({
|
|
40
|
+
series,
|
|
41
|
+
labels,
|
|
42
|
+
t,
|
|
43
|
+
styles: $style,
|
|
44
|
+
tooltip,
|
|
45
|
+
xAxisLabels,
|
|
46
|
+
yAxisLabels,
|
|
47
|
+
splitLines,
|
|
48
|
+
advancedOptions
|
|
49
|
+
}));
|
|
50
|
+
</script>
|
|
@@ -1,193 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:class="$style.statisticsChartElement"
|
|
6
|
-
width="100%"
|
|
7
|
-
height="100%"
|
|
8
|
-
:options="merge({
|
|
9
|
-
chart: {
|
|
10
|
-
height: '100%',
|
|
11
|
-
width: '100%',
|
|
12
|
-
offsetX: 0,
|
|
13
|
-
offsetY: 0,
|
|
14
|
-
parentHeightOffset: 0,
|
|
15
|
-
redrawOnParentResize: false,
|
|
16
|
-
redrawOnWindowResize: false,
|
|
17
|
-
animations: {
|
|
18
|
-
enabled: true,
|
|
19
|
-
speed: 300,
|
|
20
|
-
animateGradually: {
|
|
21
|
-
enabled: false,
|
|
22
|
-
delay: 150
|
|
23
|
-
},
|
|
24
|
-
dynamicAnimation: {
|
|
25
|
-
enabled: true,
|
|
26
|
-
speed: 150
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
toolbar: {
|
|
30
|
-
show: false
|
|
31
|
-
},
|
|
32
|
-
zoom: {
|
|
33
|
-
enabled: false
|
|
34
|
-
},
|
|
35
|
-
events: {
|
|
36
|
-
mounted: (context: any) => {
|
|
37
|
-
const svg = context.el.querySelector('svg');
|
|
38
|
-
svg?.querySelectorAll('title').forEach((t: HTMLTitleElement) => t.remove());
|
|
39
|
-
},
|
|
40
|
-
updated: (context: any) => {
|
|
41
|
-
const svg = context.el.querySelector('svg');
|
|
42
|
-
svg?.querySelectorAll('title').forEach((t: HTMLTitleElement) => t.remove());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
colors: [
|
|
47
|
-
'var(--chart-1)',
|
|
48
|
-
'var(--chart-2)',
|
|
49
|
-
'var(--chart-3)',
|
|
50
|
-
'var(--chart-4)'
|
|
51
|
-
],
|
|
52
|
-
dataLabels: {
|
|
53
|
-
enabled: false
|
|
54
|
-
},
|
|
55
|
-
grid: {
|
|
56
|
-
borderColor: 'var(--stroke)',
|
|
57
|
-
padding: {
|
|
58
|
-
top: 0,
|
|
59
|
-
left: -3,
|
|
60
|
-
right: -3,
|
|
61
|
-
bottom: 0
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
legend: {
|
|
65
|
-
show: false
|
|
66
|
-
},
|
|
67
|
-
plotOptions: {
|
|
68
|
-
bar: {
|
|
69
|
-
borderRadius: 6,
|
|
70
|
-
columnWidth: '75%'
|
|
71
|
-
},
|
|
72
|
-
donut: {
|
|
73
|
-
expandOnClick: false
|
|
74
|
-
},
|
|
75
|
-
pie: {
|
|
76
|
-
expandOnClick: false
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
states: {
|
|
80
|
-
hover: {
|
|
81
|
-
filter: {
|
|
82
|
-
type: 'none'
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
title: {
|
|
87
|
-
text: undefined
|
|
88
|
-
},
|
|
89
|
-
tooltip: {
|
|
90
|
-
custom: generateTooltip,
|
|
91
|
-
followCursor: false,
|
|
92
|
-
hideEmptySeries: true,
|
|
93
|
-
onDatasetHover: {
|
|
94
|
-
highlightDataSeries: true
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
xaxis: {
|
|
98
|
-
labels: { show: false },
|
|
99
|
-
axisBorder: { show: false },
|
|
100
|
-
axisTicks: { show: false },
|
|
101
|
-
crosshairs: { show: true },
|
|
102
|
-
tooltip: { enabled: false }
|
|
103
|
-
},
|
|
104
|
-
yaxis: {
|
|
105
|
-
show: false,
|
|
106
|
-
labels: { show: false }
|
|
107
|
-
}
|
|
108
|
-
}, options, {series})"
|
|
109
|
-
:series="series"/>
|
|
110
|
-
</div>
|
|
2
|
+
<div
|
|
3
|
+
ref="chart"
|
|
4
|
+
:class="$style.statisticsChart"/>
|
|
111
5
|
</template>
|
|
112
6
|
|
|
113
7
|
<script
|
|
114
8
|
lang="ts"
|
|
115
9
|
setup>
|
|
116
|
-
import { useResizeObserver } from '@basmilius/common';
|
|
117
|
-
import { formatNumber } from '@basmilius/utils';
|
|
118
|
-
import type { ApexOptions } from 'apexcharts';
|
|
119
10
|
import { merge } from 'lodash-es';
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import
|
|
11
|
+
import { computed, useTemplateRef } from 'vue';
|
|
12
|
+
import { type EChartsOption, useECharts } from '~flux/statistics/composable';
|
|
13
|
+
import { buildBaseOptions, deepResolveCssVars } from '~flux/statistics/util';
|
|
123
14
|
import $style from '~flux/statistics/css/Chart.module.scss';
|
|
124
15
|
|
|
125
16
|
const {
|
|
126
17
|
options = {}
|
|
127
18
|
} = defineProps<{
|
|
128
|
-
readonly options?:
|
|
129
|
-
readonly series: ApexOptions['series'];
|
|
19
|
+
readonly options?: EChartsOption;
|
|
130
20
|
}>();
|
|
131
21
|
|
|
132
22
|
const chart = useTemplateRef('chart');
|
|
133
|
-
const {t} = useI18n({useScope: 'parent'});
|
|
134
23
|
|
|
135
|
-
|
|
136
|
-
const _chart = unref(chart);
|
|
24
|
+
const defaults = buildBaseOptions();
|
|
137
25
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// @ts-ignore Update exists.
|
|
143
|
-
_chart.chart?.update();
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
function generateTooltip({dataPointIndex, w}: { dataPointIndex: number | null; w: any; }): string {
|
|
147
|
-
w = toRaw(w);
|
|
26
|
+
const mergedOptions = computed<EChartsOption>(() => {
|
|
27
|
+
const merged = merge({}, defaults, options) as EChartsOption & { color?: unknown; series?: unknown };
|
|
148
28
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (w.globals.categoryLabels && w.globals.categoryLabels.length > 0) {
|
|
152
|
-
labels = w.globals.categoryLabels;
|
|
153
|
-
} else if (w.globals.labels && w.globals.labels.length > 0) {
|
|
154
|
-
labels = w.globals.labels;
|
|
29
|
+
if (options && (options as { color?: unknown }).color !== undefined) {
|
|
30
|
+
merged.color = (options as { color: unknown }).color;
|
|
155
31
|
}
|
|
156
32
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
${t(labels[dataPointIndex])}
|
|
160
|
-
</div>
|
|
161
|
-
` : ''}
|
|
162
|
-
|
|
163
|
-
<div class="${$style.statisticsChartTooltipBody}">
|
|
164
|
-
${w.globals.series.map((_: any, index: number) => `
|
|
165
|
-
<div class="${$style.statisticsChartTooltipSeriesColor}" style="background: ${w.globals.seriesColors[index] ?? w.globals.colors[index]}"></div>
|
|
166
|
-
|
|
167
|
-
<div class="${$style.statisticsChartTooltipSeriesName}">
|
|
168
|
-
${w.globals.seriesNames[index]}
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div class="${$style.statisticsChartTooltipSeriesValue}">
|
|
172
|
-
${formatSeriesValue(w, dataPointIndex, index)}
|
|
173
|
-
</div>
|
|
174
|
-
`).join('')}
|
|
175
|
-
</div>`;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function formatSeriesValue(w: any, dataPointIndex: number | null, seriesIndex: number): string {
|
|
179
|
-
const value = dataPointIndex !== null
|
|
180
|
-
? w.globals.series[seriesIndex][dataPointIndex]
|
|
181
|
-
: w.globals.series[seriesIndex];
|
|
182
|
-
|
|
183
|
-
if (w.config.tooltip.y.formatter) {
|
|
184
|
-
return w.config.tooltip.y.formatter(value, {dataPointIndex, seriesIndex});
|
|
33
|
+
if (options && (options as { series?: unknown }).series !== undefined) {
|
|
34
|
+
merged.series = (options as { series: unknown }).series;
|
|
185
35
|
}
|
|
186
36
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
37
|
+
return deepResolveCssVars(merged);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const {chartInstance} = useECharts(chart, mergedOptions);
|
|
190
41
|
|
|
191
|
-
|
|
192
|
-
}
|
|
42
|
+
defineExpose({chartInstance});
|
|
193
43
|
</script>
|
|
@@ -7,19 +7,28 @@
|
|
|
7
7
|
'--aspect-ratio': aspectRatio,
|
|
8
8
|
'--max-height': maxHeight && `${maxHeight}px`,
|
|
9
9
|
'--min-height': minHeight && `${minHeight}px`
|
|
10
|
-
}"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
}">
|
|
11
|
+
<template
|
|
12
|
+
v-if="slots.info"
|
|
13
|
+
#info>
|
|
14
|
+
<slot name="info"/>
|
|
15
|
+
</template>
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
<template #content>
|
|
18
|
+
<FluxStatisticsLegendScope>
|
|
19
|
+
<div :class="$style.statisticsChartPaneBody">
|
|
20
|
+
<div :class="$style.statisticsChartPaneContainer">
|
|
21
|
+
<slot/>
|
|
22
|
+
</div>
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
<slot name="legend"/>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<FluxToolbar v-if="slots.toolbar">
|
|
28
|
+
<slot name="toolbar"/>
|
|
29
|
+
</FluxToolbar>
|
|
30
|
+
</FluxStatisticsLegendScope>
|
|
31
|
+
</template>
|
|
23
32
|
</Base>
|
|
24
33
|
</template>
|
|
25
34
|
|
|
@@ -29,6 +38,7 @@
|
|
|
29
38
|
import { FluxToolbar } from '@flux-ui/components';
|
|
30
39
|
import type { FluxIconName } from '@flux-ui/types';
|
|
31
40
|
import Base from './FluxStatisticsBase.vue';
|
|
41
|
+
import FluxStatisticsLegendScope from './FluxStatisticsLegendScope.vue';
|
|
32
42
|
import $style from '~flux/statistics/css/ChartPane.module.scss';
|
|
33
43
|
|
|
34
44
|
defineProps<{
|
|
@@ -41,6 +51,7 @@
|
|
|
41
51
|
|
|
42
52
|
const slots = defineSlots<{
|
|
43
53
|
default(): any;
|
|
54
|
+
info?(): any;
|
|
44
55
|
legend?(): any;
|
|
45
56
|
toolbar?(): any;
|
|
46
57
|
}>();
|