@techie_doubts/tui.chart.2026 4.6.1
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 +165 -0
- package/dist/esm/animator.d.ts +32 -0
- package/dist/esm/animator.js +102 -0
- package/dist/esm/brushes/axis.d.ts +3 -0
- package/dist/esm/brushes/axis.js +21 -0
- package/dist/esm/brushes/basic.d.ts +9 -0
- package/dist/esm/brushes/basic.js +95 -0
- package/dist/esm/brushes/boxPlot.d.ts +2 -0
- package/dist/esm/brushes/boxPlot.js +22 -0
- package/dist/esm/brushes/circleLegend.d.ts +2 -0
- package/dist/esm/brushes/circleLegend.js +26 -0
- package/dist/esm/brushes/dataLabel.d.ts +6 -0
- package/dist/esm/brushes/dataLabel.js +176 -0
- package/dist/esm/brushes/exportMenu.d.ts +2 -0
- package/dist/esm/brushes/exportMenu.js +55 -0
- package/dist/esm/brushes/gauge.d.ts +2 -0
- package/dist/esm/brushes/gauge.js +39 -0
- package/dist/esm/brushes/label.d.ts +34 -0
- package/dist/esm/brushes/label.js +165 -0
- package/dist/esm/brushes/legend.d.ts +7 -0
- package/dist/esm/brushes/legend.js +162 -0
- package/dist/esm/brushes/lineSeries.d.ts +5 -0
- package/dist/esm/brushes/lineSeries.js +41 -0
- package/dist/esm/brushes/polygon.d.ts +2 -0
- package/dist/esm/brushes/polygon.js +24 -0
- package/dist/esm/brushes/resetButton.d.ts +3 -0
- package/dist/esm/brushes/resetButton.js +112 -0
- package/dist/esm/brushes/scatterSeries.d.ts +2 -0
- package/dist/esm/brushes/scatterSeries.js +125 -0
- package/dist/esm/brushes/sector.d.ts +2 -0
- package/dist/esm/brushes/sector.js +54 -0
- package/dist/esm/brushes/spectrumLegend.d.ts +14 -0
- package/dist/esm/brushes/spectrumLegend.js +199 -0
- package/dist/esm/charts/areaChart.d.ts +254 -0
- package/dist/esm/charts/areaChart.js +358 -0
- package/dist/esm/charts/barChart.d.ts +203 -0
- package/dist/esm/charts/barChart.js +300 -0
- package/dist/esm/charts/boxPlotChart.d.ts +209 -0
- package/dist/esm/charts/boxPlotChart.js +288 -0
- package/dist/esm/charts/bubbleChart.d.ts +188 -0
- package/dist/esm/charts/bubbleChart.js +263 -0
- package/dist/esm/charts/bulletChart.d.ts +199 -0
- package/dist/esm/charts/bulletChart.js +278 -0
- package/dist/esm/charts/chart.d.ts +133 -0
- package/dist/esm/charts/chart.js +484 -0
- package/dist/esm/charts/columnChart.d.ts +205 -0
- package/dist/esm/charts/columnChart.js +299 -0
- package/dist/esm/charts/columnLineChart.d.ts +271 -0
- package/dist/esm/charts/columnLineChart.js +386 -0
- package/dist/esm/charts/gaugeChart.d.ts +191 -0
- package/dist/esm/charts/gaugeChart.js +279 -0
- package/dist/esm/charts/heatmapChart.d.ts +199 -0
- package/dist/esm/charts/heatmapChart.js +292 -0
- package/dist/esm/charts/lineAreaChart.d.ts +271 -0
- package/dist/esm/charts/lineAreaChart.js +374 -0
- package/dist/esm/charts/lineChart.d.ts +253 -0
- package/dist/esm/charts/lineChart.js +360 -0
- package/dist/esm/charts/lineScatterChart.d.ts +200 -0
- package/dist/esm/charts/lineScatterChart.js +285 -0
- package/dist/esm/charts/nestedPieChart.d.ts +192 -0
- package/dist/esm/charts/nestedPieChart.js +268 -0
- package/dist/esm/charts/pieChart.d.ts +156 -0
- package/dist/esm/charts/pieChart.js +224 -0
- package/dist/esm/charts/radarChart.d.ts +169 -0
- package/dist/esm/charts/radarChart.js +240 -0
- package/dist/esm/charts/radialBarChart.d.ts +172 -0
- package/dist/esm/charts/radialBarChart.js +251 -0
- package/dist/esm/charts/scatterChart.d.ts +184 -0
- package/dist/esm/charts/scatterChart.js +279 -0
- package/dist/esm/charts/treemapChart.d.ts +166 -0
- package/dist/esm/charts/treemapChart.js +239 -0
- package/dist/esm/component/areaSeries.d.ts +96 -0
- package/dist/esm/component/areaSeries.js +474 -0
- package/dist/esm/component/axis.d.ts +40 -0
- package/dist/esm/component/axis.js +176 -0
- package/dist/esm/component/axisTitle.d.ts +25 -0
- package/dist/esm/component/axisTitle.js +67 -0
- package/dist/esm/component/axisUsingCenterY.d.ts +32 -0
- package/dist/esm/component/axisUsingCenterY.js +175 -0
- package/dist/esm/component/backButton.d.ts +13 -0
- package/dist/esm/component/backButton.js +26 -0
- package/dist/esm/component/background.d.ts +10 -0
- package/dist/esm/component/background.js +15 -0
- package/dist/esm/component/boxPlotSeries.d.ts +126 -0
- package/dist/esm/component/boxPlotSeries.js +410 -0
- package/dist/esm/component/boxSeries.d.ts +211 -0
- package/dist/esm/component/boxSeries.js +603 -0
- package/dist/esm/component/boxStackSeries.d.ts +62 -0
- package/dist/esm/component/boxStackSeries.js +447 -0
- package/dist/esm/component/bubbleSeries.d.ts +35 -0
- package/dist/esm/component/bubbleSeries.js +174 -0
- package/dist/esm/component/bulletSeries.d.ts +89 -0
- package/dist/esm/component/bulletSeries.js +392 -0
- package/dist/esm/component/circleLegend.d.ts +10 -0
- package/dist/esm/component/circleLegend.js +37 -0
- package/dist/esm/component/component.d.ts +64 -0
- package/dist/esm/component/component.js +170 -0
- package/dist/esm/component/componentManager.d.ts +23 -0
- package/dist/esm/component/componentManager.js +45 -0
- package/dist/esm/component/dataLabels.d.ts +23 -0
- package/dist/esm/component/dataLabels.js +134 -0
- package/dist/esm/component/exportMenu.d.ts +38 -0
- package/dist/esm/component/exportMenu.js +147 -0
- package/dist/esm/component/gaugeSeries.d.ts +160 -0
- package/dist/esm/component/gaugeSeries.js +447 -0
- package/dist/esm/component/heatmapSeries.d.ts +64 -0
- package/dist/esm/component/heatmapSeries.js +152 -0
- package/dist/esm/component/hoveredSeries.d.ts +27 -0
- package/dist/esm/component/hoveredSeries.js +95 -0
- package/dist/esm/component/legend.d.ts +26 -0
- package/dist/esm/component/legend.js +149 -0
- package/dist/esm/component/lineSeries.d.ts +69 -0
- package/dist/esm/component/lineSeries.js +319 -0
- package/dist/esm/component/noDataText.d.ts +9 -0
- package/dist/esm/component/noDataText.js +31 -0
- package/dist/esm/component/pieSeries.d.ts +137 -0
- package/dist/esm/component/pieSeries.js +390 -0
- package/dist/esm/component/plot.d.ts +37 -0
- package/dist/esm/component/plot.js +163 -0
- package/dist/esm/component/radarSeries.d.ts +85 -0
- package/dist/esm/component/radarSeries.js +222 -0
- package/dist/esm/component/radialAxis.d.ts +26 -0
- package/dist/esm/component/radialAxis.js +210 -0
- package/dist/esm/component/radialBarSeries.d.ts +111 -0
- package/dist/esm/component/radialBarSeries.js +349 -0
- package/dist/esm/component/radialPlot.d.ts +55 -0
- package/dist/esm/component/radialPlot.js +188 -0
- package/dist/esm/component/rangeSelection.d.ts +61 -0
- package/dist/esm/component/rangeSelection.js +150 -0
- package/dist/esm/component/resetButton.d.ts +13 -0
- package/dist/esm/component/resetButton.js +26 -0
- package/dist/esm/component/scatterSeries.d.ts +34 -0
- package/dist/esm/component/scatterSeries.js +159 -0
- package/dist/esm/component/selectedSeries.d.ts +26 -0
- package/dist/esm/component/selectedSeries.js +109 -0
- package/dist/esm/component/spectrumLegend.d.ts +15 -0
- package/dist/esm/component/spectrumLegend.js +76 -0
- package/dist/esm/component/title.d.ts +12 -0
- package/dist/esm/component/title.js +53 -0
- package/dist/esm/component/tooltip.d.ts +41 -0
- package/dist/esm/component/tooltip.js +131 -0
- package/dist/esm/component/treemapSeries.d.ts +57 -0
- package/dist/esm/component/treemapSeries.js +191 -0
- package/dist/esm/component/zeroAxis.d.ts +9 -0
- package/dist/esm/component/zeroAxis.js +49 -0
- package/dist/esm/eventEmitter.d.ts +8 -0
- package/dist/esm/eventEmitter.js +15 -0
- package/dist/esm/helpers/arrayUtil.d.ts +10 -0
- package/dist/esm/helpers/arrayUtil.js +54 -0
- package/dist/esm/helpers/axes.d.ts +67 -0
- package/dist/esm/helpers/axes.js +345 -0
- package/dist/esm/helpers/boxSeries.d.ts +5 -0
- package/dist/esm/helpers/boxSeries.js +71 -0
- package/dist/esm/helpers/calculator.d.ts +19 -0
- package/dist/esm/helpers/calculator.js +153 -0
- package/dist/esm/helpers/color.d.ts +153 -0
- package/dist/esm/helpers/color.js +218 -0
- package/dist/esm/helpers/colorSpectrum.d.ts +5 -0
- package/dist/esm/helpers/colorSpectrum.js +17 -0
- package/dist/esm/helpers/coordinate.d.ts +9 -0
- package/dist/esm/helpers/coordinate.js +51 -0
- package/dist/esm/helpers/dataLabels.d.ts +36 -0
- package/dist/esm/helpers/dataLabels.js +405 -0
- package/dist/esm/helpers/dom.d.ts +2 -0
- package/dist/esm/helpers/dom.js +8 -0
- package/dist/esm/helpers/downloader.d.ts +7 -0
- package/dist/esm/helpers/downloader.js +287 -0
- package/dist/esm/helpers/formatDate.d.ts +16 -0
- package/dist/esm/helpers/formatDate.js +140 -0
- package/dist/esm/helpers/geometric.d.ts +3 -0
- package/dist/esm/helpers/geometric.js +35 -0
- package/dist/esm/helpers/googleAnalytics.d.ts +1 -0
- package/dist/esm/helpers/googleAnalytics.js +39 -0
- package/dist/esm/helpers/htmlSanitizer.d.ts +1 -0
- package/dist/esm/helpers/htmlSanitizer.js +86 -0
- package/dist/esm/helpers/legend.d.ts +9 -0
- package/dist/esm/helpers/legend.js +47 -0
- package/dist/esm/helpers/pieSeries.d.ts +15 -0
- package/dist/esm/helpers/pieSeries.js +72 -0
- package/dist/esm/helpers/plot.d.ts +2 -0
- package/dist/esm/helpers/plot.js +4 -0
- package/dist/esm/helpers/radarSeries.d.ts +1 -0
- package/dist/esm/helpers/radarSeries.js +7 -0
- package/dist/esm/helpers/range.d.ts +6 -0
- package/dist/esm/helpers/range.js +16 -0
- package/dist/esm/helpers/responders.d.ts +37 -0
- package/dist/esm/helpers/responders.js +197 -0
- package/dist/esm/helpers/sector.d.ts +55 -0
- package/dist/esm/helpers/sector.js +117 -0
- package/dist/esm/helpers/squarifier.d.ts +8 -0
- package/dist/esm/helpers/squarifier.js +110 -0
- package/dist/esm/helpers/style.d.ts +14 -0
- package/dist/esm/helpers/style.js +48 -0
- package/dist/esm/helpers/theme.d.ts +58 -0
- package/dist/esm/helpers/theme.js +557 -0
- package/dist/esm/helpers/tooltip.d.ts +2 -0
- package/dist/esm/helpers/tooltip.js +18 -0
- package/dist/esm/helpers/tooltipTemplate.d.ts +21 -0
- package/dist/esm/helpers/tooltipTemplate.js +147 -0
- package/dist/esm/helpers/utils.d.ts +42 -0
- package/dist/esm/helpers/utils.js +268 -0
- package/dist/esm/helpers/validation.d.ts +6 -0
- package/dist/esm/helpers/validation.js +16 -0
- package/dist/esm/index.d.ts +40 -0
- package/dist/esm/index.js +75 -0
- package/dist/esm/message.d.ts +11 -0
- package/dist/esm/message.js +11 -0
- package/dist/esm/painter.d.ts +27 -0
- package/dist/esm/painter.js +88 -0
- package/dist/esm/responderDetectors.d.ts +6 -0
- package/dist/esm/responderDetectors.js +124 -0
- package/dist/esm/scale/coordinateScaleCalculator.d.ts +24 -0
- package/dist/esm/scale/coordinateScaleCalculator.js +174 -0
- package/dist/esm/scale/datetimeScaleCalculator.d.ts +20 -0
- package/dist/esm/scale/datetimeScaleCalculator.js +59 -0
- package/dist/esm/store/axes.d.ts +30 -0
- package/dist/esm/store/axes.js +282 -0
- package/dist/esm/store/category.d.ts +4 -0
- package/dist/esm/store/category.js +73 -0
- package/dist/esm/store/colorValueScale.d.ts +3 -0
- package/dist/esm/store/colorValueScale.js +56 -0
- package/dist/esm/store/dataRange.d.ts +4 -0
- package/dist/esm/store/dataRange.js +170 -0
- package/dist/esm/store/gaugeAxes.d.ts +4 -0
- package/dist/esm/store/gaugeAxes.js +175 -0
- package/dist/esm/store/heatmapAxes.d.ts +3 -0
- package/dist/esm/store/heatmapAxes.js +98 -0
- package/dist/esm/store/heatmapSeriesData.d.ts +3 -0
- package/dist/esm/store/heatmapSeriesData.js +34 -0
- package/dist/esm/store/layout.d.ts +12 -0
- package/dist/esm/store/layout.js +487 -0
- package/dist/esm/store/legend.d.ts +3 -0
- package/dist/esm/store/legend.js +435 -0
- package/dist/esm/store/nestedPieSeriesData.d.ts +3 -0
- package/dist/esm/store/nestedPieSeriesData.js +49 -0
- package/dist/esm/store/options.d.ts +3 -0
- package/dist/esm/store/options.js +62 -0
- package/dist/esm/store/plot.d.ts +3 -0
- package/dist/esm/store/plot.js +102 -0
- package/dist/esm/store/radialAxes.d.ts +8 -0
- package/dist/esm/store/radialAxes.js +199 -0
- package/dist/esm/store/reactive.d.ts +11 -0
- package/dist/esm/store/reactive.js +196 -0
- package/dist/esm/store/root.d.ts +3 -0
- package/dist/esm/store/root.js +46 -0
- package/dist/esm/store/scale.d.ts +3 -0
- package/dist/esm/store/scale.js +102 -0
- package/dist/esm/store/seriesData.d.ts +3 -0
- package/dist/esm/store/seriesData.js +299 -0
- package/dist/esm/store/stackSeriesData.d.ts +8 -0
- package/dist/esm/store/stackSeriesData.js +192 -0
- package/dist/esm/store/store.d.ts +20 -0
- package/dist/esm/store/store.js +112 -0
- package/dist/esm/store/theme.d.ts +3 -0
- package/dist/esm/store/theme.js +139 -0
- package/dist/esm/store/treemapSeriesData.d.ts +4 -0
- package/dist/esm/store/treemapSeriesData.js +93 -0
- package/dist/td-chart.css +127 -0
- package/dist/td-chart.js +41463 -0
- package/dist/td-chart.min.css +6 -0
- package/dist/td-chart.min.js +9 -0
- package/package.json +112 -0
- package/types/brushes.d.ts +30 -0
- package/types/charts.d.ts +152 -0
- package/types/components/axis.d.ts +71 -0
- package/types/components/circleLegend.d.ts +9 -0
- package/types/components/dataLabels.d.ts +119 -0
- package/types/components/exportMenu.d.ts +14 -0
- package/types/components/legend.d.ts +27 -0
- package/types/components/plot.d.ts +8 -0
- package/types/components/radialAxis.d.ts +22 -0
- package/types/components/radialPlot.d.ts +11 -0
- package/types/components/rangeSelection.d.ts +3 -0
- package/types/components/resetButton.d.ts +13 -0
- package/types/components/series.d.ts +386 -0
- package/types/components/spectrumLegend.d.ts +25 -0
- package/types/components/tooltip.d.ts +58 -0
- package/types/components/zoom.d.ts +3 -0
- package/types/eventEmitter.d.ts +12 -0
- package/types/index.d.ts +615 -0
- package/types/options.d.ts +833 -0
- package/types/resizeObserver.d.ts +54 -0
- package/types/store/store.d.ts +564 -0
- package/types/theme.d.ts +670 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { getAxisFormatter, getAxisName, getAxisTheme, getInitAxisIntervalData, getLabelsAppliedFormatter, getLabelXMargin, getMaxLabelSize, getRotatableOption, getSizeKey, getViewAxisLabels, getYAxisOption, hasAxesLayoutChanged, hasBoxTypeSeries, isDateType, isLabelAxisOnYAxis, isPointOnColumn, makeRotationData, makeTitleOption, } from "../helpers/axes";
|
|
2
|
+
import { getAxisLabelAnchorPoint, makeLabelsFromLimit } from "../helpers/calculator";
|
|
3
|
+
import { deepMergedCopy, hasNegativeOnly, isNumber, pickProperty } from "../helpers/utils";
|
|
4
|
+
import { isCoordinateSeries } from "../helpers/coordinate";
|
|
5
|
+
import { AxisType } from "../component/axis";
|
|
6
|
+
import { getTitleFontString } from "../helpers/style";
|
|
7
|
+
export function isCenterYAxis(options) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const diverging = !!pickProperty(options, ['series', 'diverging']);
|
|
10
|
+
const alignCenter = ((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.yAxis) === null || _b === void 0 ? void 0 : _b.align) === 'center';
|
|
11
|
+
return diverging && alignCenter;
|
|
12
|
+
}
|
|
13
|
+
function isDivergingBoxSeries(series, options) {
|
|
14
|
+
var _a;
|
|
15
|
+
return hasBoxTypeSeries(series) && !!((_a = options.series) === null || _a === void 0 ? void 0 : _a.diverging);
|
|
16
|
+
}
|
|
17
|
+
function getZeroPosition(limit, axisSize, labelAxisOnYAxis, isDivergingSeries) {
|
|
18
|
+
const { min, max } = limit;
|
|
19
|
+
const hasZeroValue = min <= 0 && max >= 0;
|
|
20
|
+
if (!hasZeroValue || isDivergingSeries) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const position = ((0 - min) / (max - min)) * axisSize;
|
|
24
|
+
return labelAxisOnYAxis ? position : axisSize - position;
|
|
25
|
+
}
|
|
26
|
+
export function getLabelAxisData(stateProp) {
|
|
27
|
+
const { axisSize, categories, series, options, theme, scale, initialAxisData, isCoordinateTypeChart, axisName, } = stateProp;
|
|
28
|
+
const hasLineSeries = !!series.line;
|
|
29
|
+
const pointOnColumn = isPointOnColumn(series, options);
|
|
30
|
+
const dateType = isDateType(options, axisName);
|
|
31
|
+
const labelsBeforeFormatting = isCoordinateTypeChart
|
|
32
|
+
? makeLabelsFromLimit(scale.limit, scale.stepSize, dateType)
|
|
33
|
+
: categories;
|
|
34
|
+
const labels = getLabelsAppliedFormatter(labelsBeforeFormatting, options, dateType, axisName);
|
|
35
|
+
let labelRange;
|
|
36
|
+
if (scale && hasLineSeries) {
|
|
37
|
+
const baseLabels = pointOnColumn ? labelsBeforeFormatting : categories;
|
|
38
|
+
const values = baseLabels.map((value) => (dateType ? Number(new Date(value)) : Number(value)));
|
|
39
|
+
labelRange = { min: Math.min(...values), max: Math.max(...values) };
|
|
40
|
+
}
|
|
41
|
+
const rectResponderCount = categories.length;
|
|
42
|
+
const tickIntervalCount = rectResponderCount - (pointOnColumn ? 0 : 1);
|
|
43
|
+
const tickDistance = tickIntervalCount ? axisSize / tickIntervalCount : axisSize;
|
|
44
|
+
const labelDistance = axisSize / (labels.length - (pointOnColumn ? 0 : 1));
|
|
45
|
+
let tickCount = labels.length;
|
|
46
|
+
if (pointOnColumn && !isCoordinateTypeChart) {
|
|
47
|
+
tickCount += 1;
|
|
48
|
+
}
|
|
49
|
+
const viewLabels = getViewAxisLabels(Object.assign({ labels,
|
|
50
|
+
pointOnColumn,
|
|
51
|
+
tickDistance,
|
|
52
|
+
tickCount,
|
|
53
|
+
scale }, initialAxisData), axisSize);
|
|
54
|
+
const axisLabelMargin = getLabelXMargin(axisName, options);
|
|
55
|
+
return Object.assign(Object.assign({ labels,
|
|
56
|
+
viewLabels,
|
|
57
|
+
pointOnColumn,
|
|
58
|
+
labelDistance,
|
|
59
|
+
tickDistance,
|
|
60
|
+
tickCount,
|
|
61
|
+
labelRange,
|
|
62
|
+
rectResponderCount, isLabelAxis: true }, initialAxisData), getMaxLabelSize(labels, axisLabelMargin, getTitleFontString(theme.label)));
|
|
63
|
+
}
|
|
64
|
+
function getValueAxisData(stateProp) {
|
|
65
|
+
var _a;
|
|
66
|
+
const { scale, axisSize, series, options, centerYAxis, initialAxisData, theme, labelOnYAxis, axisName, } = stateProp;
|
|
67
|
+
const { limit, stepSize } = scale;
|
|
68
|
+
const size = centerYAxis ? (_a = centerYAxis) === null || _a === void 0 ? void 0 : _a.xAxisHalfSize : axisSize;
|
|
69
|
+
const divergingBoxSeries = isDivergingBoxSeries(series, options);
|
|
70
|
+
const formatter = getAxisFormatter(options, axisName);
|
|
71
|
+
const zeroPosition = getZeroPosition(limit, axisSize, isLabelAxisOnYAxis({ series, options }), divergingBoxSeries);
|
|
72
|
+
let valueLabels = makeLabelsFromLimit(limit, stepSize);
|
|
73
|
+
if (!centerYAxis && divergingBoxSeries) {
|
|
74
|
+
valueLabels = getDivergingValues(valueLabels);
|
|
75
|
+
}
|
|
76
|
+
const labels = valueLabels.map((label, index) => formatter(label, { index, labels: valueLabels, axisName }));
|
|
77
|
+
const tickDistance = size / Math.max(valueLabels.length, 1);
|
|
78
|
+
const tickCount = valueLabels.length;
|
|
79
|
+
const pointOnColumn = false;
|
|
80
|
+
const viewLabels = getViewAxisLabels(Object.assign({ labels: labelOnYAxis ? labels : [...labels].reverse(), pointOnColumn,
|
|
81
|
+
tickDistance,
|
|
82
|
+
tickCount }, initialAxisData), size);
|
|
83
|
+
const axisLabelMargin = getLabelXMargin(axisName, options);
|
|
84
|
+
const axisData = Object.assign(Object.assign({ labels,
|
|
85
|
+
viewLabels,
|
|
86
|
+
pointOnColumn, isLabelAxis: false, tickCount,
|
|
87
|
+
tickDistance }, initialAxisData), getMaxLabelSize(labels, axisLabelMargin, getTitleFontString(theme.label)));
|
|
88
|
+
if (isNumber(zeroPosition)) {
|
|
89
|
+
axisData.zeroPosition = zeroPosition;
|
|
90
|
+
}
|
|
91
|
+
return axisData;
|
|
92
|
+
}
|
|
93
|
+
function getDivergingValues(valueLabels) {
|
|
94
|
+
return hasNegativeOnly(valueLabels)
|
|
95
|
+
? valueLabels.reverse().slice(1).concat(valueLabels)
|
|
96
|
+
: valueLabels.slice(1).reverse().concat(valueLabels);
|
|
97
|
+
}
|
|
98
|
+
function makeDefaultAxisData(isLabelAxis, params) {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
const axisData = getInitAxisIntervalData(isLabelAxis, params);
|
|
101
|
+
const title = makeTitleOption((_b = (_a = params) === null || _a === void 0 ? void 0 : _a.axis) === null || _b === void 0 ? void 0 : _b.title);
|
|
102
|
+
if (title) {
|
|
103
|
+
axisData.title = title;
|
|
104
|
+
}
|
|
105
|
+
return axisData;
|
|
106
|
+
}
|
|
107
|
+
function getInitialAxisData(options, labelOnYAxis, categories, layout, isCoordinateTypeChart) {
|
|
108
|
+
var _a, _b, _c;
|
|
109
|
+
const { yAxis, secondaryYAxis } = getYAxisOption(options);
|
|
110
|
+
const shift = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.shift;
|
|
111
|
+
return {
|
|
112
|
+
xAxis: makeDefaultAxisData(!labelOnYAxis, {
|
|
113
|
+
categories,
|
|
114
|
+
axis: (_c = options) === null || _c === void 0 ? void 0 : _c.xAxis,
|
|
115
|
+
layout,
|
|
116
|
+
shift,
|
|
117
|
+
isCoordinateTypeChart,
|
|
118
|
+
}),
|
|
119
|
+
yAxis: makeDefaultAxisData(labelOnYAxis, { axis: yAxis }),
|
|
120
|
+
secondaryYAxis: secondaryYAxis
|
|
121
|
+
? makeDefaultAxisData(labelOnYAxis, { axis: secondaryYAxis })
|
|
122
|
+
: null,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function getSecondaryYAxisData({ state, labelOnYAxis, valueAxisSize, labelAxisSize, initialAxisData, isCoordinateTypeChart, }) {
|
|
126
|
+
var _a, _b;
|
|
127
|
+
const { scale, options, series, theme } = state;
|
|
128
|
+
const categories = state.categories;
|
|
129
|
+
return labelOnYAxis
|
|
130
|
+
? getLabelAxisData({
|
|
131
|
+
scale: scale.secondaryYAxis,
|
|
132
|
+
axisSize: labelAxisSize,
|
|
133
|
+
categories: (_b = (_a = getYAxisOption(options).secondaryYAxis) === null || _a === void 0 ? void 0 : _a.categories, (_b !== null && _b !== void 0 ? _b : categories)),
|
|
134
|
+
options,
|
|
135
|
+
series,
|
|
136
|
+
theme: getAxisTheme(theme, AxisType.SECONDARY_Y),
|
|
137
|
+
initialAxisData,
|
|
138
|
+
isCoordinateTypeChart,
|
|
139
|
+
axisName: AxisType.SECONDARY_Y,
|
|
140
|
+
})
|
|
141
|
+
: getValueAxisData({
|
|
142
|
+
scale: scale.secondaryYAxis,
|
|
143
|
+
axisSize: valueAxisSize,
|
|
144
|
+
options,
|
|
145
|
+
series,
|
|
146
|
+
theme: getAxisTheme(theme, AxisType.SECONDARY_Y),
|
|
147
|
+
centerYAxis: null,
|
|
148
|
+
initialAxisData,
|
|
149
|
+
axisName: AxisType.SECONDARY_Y,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function makeXAxisData({ axisData, axisSize, axisLayout, centerYAxis, rotatable, labelMargin = 0, }) {
|
|
153
|
+
const { viewLabels, pointOnColumn, maxLabelWidth, maxLabelHeight } = axisData;
|
|
154
|
+
const offsetY = getAxisLabelAnchorPoint(maxLabelHeight) + labelMargin;
|
|
155
|
+
const size = centerYAxis ? centerYAxis.xAxisHalfSize : axisSize;
|
|
156
|
+
const distance = size / (viewLabels.length - (pointOnColumn ? 0 : 1));
|
|
157
|
+
const rotationData = makeRotationData(maxLabelWidth, maxLabelHeight, distance, rotatable, axisLayout);
|
|
158
|
+
const { needRotateLabel, rotationHeight } = rotationData;
|
|
159
|
+
const maxHeight = (needRotateLabel ? rotationHeight : maxLabelHeight) + offsetY;
|
|
160
|
+
return Object.assign(Object.assign(Object.assign({}, axisData), rotationData), { maxHeight,
|
|
161
|
+
offsetY });
|
|
162
|
+
}
|
|
163
|
+
function getAxisInfo(labelOnYAxis, plot, series) {
|
|
164
|
+
const { valueAxisName, labelAxisName } = getAxisName(labelOnYAxis, series);
|
|
165
|
+
const { valueSizeKey, labelSizeKey } = getSizeKey(labelOnYAxis);
|
|
166
|
+
const valueAxisSize = plot[valueSizeKey];
|
|
167
|
+
const labelAxisSize = plot[labelSizeKey];
|
|
168
|
+
return { valueAxisName, valueAxisSize, labelAxisName, labelAxisSize };
|
|
169
|
+
}
|
|
170
|
+
function getCategoriesWithTypes(categories, rawCategories) {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
return {
|
|
173
|
+
categories: (_a = categories, (_a !== null && _a !== void 0 ? _a : [])),
|
|
174
|
+
rawCategories: (_b = rawCategories, (_b !== null && _b !== void 0 ? _b : [])),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
const axes = {
|
|
178
|
+
name: 'axes',
|
|
179
|
+
state: ({ series, options }) => {
|
|
180
|
+
const { secondaryYAxis } = getYAxisOption(options);
|
|
181
|
+
const axesState = {
|
|
182
|
+
xAxis: {},
|
|
183
|
+
yAxis: {},
|
|
184
|
+
};
|
|
185
|
+
if (!!series.bar && isCenterYAxis(options)) {
|
|
186
|
+
axesState.centerYAxis = {};
|
|
187
|
+
}
|
|
188
|
+
if (secondaryYAxis) {
|
|
189
|
+
axesState.secondaryYAxis = {};
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
axes: axesState,
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
action: {
|
|
196
|
+
setAxesData({ state, initStoreState }) {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
const { scale, options, series, layout, theme } = state;
|
|
199
|
+
const { xAxis, yAxis, plot } = layout;
|
|
200
|
+
const isCoordinateTypeChart = isCoordinateSeries(initStoreState.series);
|
|
201
|
+
const labelOnYAxis = isLabelAxisOnYAxis({ series, options });
|
|
202
|
+
const { categories } = getCategoriesWithTypes(state.categories, state.rawCategories);
|
|
203
|
+
const { valueAxisName, valueAxisSize, labelAxisName, labelAxisSize } = getAxisInfo(labelOnYAxis, plot, series);
|
|
204
|
+
const hasCenterYAxis = state.axes.centerYAxis;
|
|
205
|
+
const initialAxisData = getInitialAxisData(options, labelOnYAxis, categories, layout, isCoordinateTypeChart);
|
|
206
|
+
const valueAxisData = getValueAxisData({
|
|
207
|
+
scale: scale[valueAxisName],
|
|
208
|
+
axisSize: valueAxisSize,
|
|
209
|
+
options,
|
|
210
|
+
series,
|
|
211
|
+
theme: getAxisTheme(theme, valueAxisName),
|
|
212
|
+
centerYAxis: hasCenterYAxis
|
|
213
|
+
? {
|
|
214
|
+
xAxisHalfSize: (xAxis.width - yAxis.width) / 2,
|
|
215
|
+
}
|
|
216
|
+
: null,
|
|
217
|
+
initialAxisData: initialAxisData[valueAxisName],
|
|
218
|
+
labelOnYAxis,
|
|
219
|
+
axisName: valueAxisName,
|
|
220
|
+
});
|
|
221
|
+
const labelAxisData = getLabelAxisData({
|
|
222
|
+
scale: scale[labelAxisName],
|
|
223
|
+
axisSize: labelAxisSize,
|
|
224
|
+
categories,
|
|
225
|
+
options,
|
|
226
|
+
series,
|
|
227
|
+
theme: getAxisTheme(theme, labelAxisName),
|
|
228
|
+
initialAxisData: initialAxisData[labelAxisName],
|
|
229
|
+
isCoordinateTypeChart,
|
|
230
|
+
labelOnYAxis,
|
|
231
|
+
axisName: labelAxisName,
|
|
232
|
+
});
|
|
233
|
+
let secondaryYAxis, centerYAxis;
|
|
234
|
+
if (state.axes.secondaryYAxis) {
|
|
235
|
+
secondaryYAxis = getSecondaryYAxisData({
|
|
236
|
+
state,
|
|
237
|
+
labelOnYAxis,
|
|
238
|
+
valueAxisSize,
|
|
239
|
+
labelAxisSize,
|
|
240
|
+
labelAxisName,
|
|
241
|
+
valueAxisName,
|
|
242
|
+
initialAxisData: initialAxisData.secondaryYAxis,
|
|
243
|
+
isCoordinateTypeChart,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (hasCenterYAxis) {
|
|
247
|
+
const xAxisHalfSize = (xAxis.width - yAxis.width) / 2;
|
|
248
|
+
centerYAxis = deepMergedCopy(valueAxisData, {
|
|
249
|
+
x: xAxis.x + xAxisHalfSize,
|
|
250
|
+
xAxisHalfSize,
|
|
251
|
+
secondStartX: (xAxis.width + yAxis.width) / 2,
|
|
252
|
+
yAxisLabelAnchorPoint: yAxis.width / 2,
|
|
253
|
+
yAxisHeight: yAxis.height,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
const axesState = {
|
|
257
|
+
xAxis: makeXAxisData({
|
|
258
|
+
axisData: labelOnYAxis ? valueAxisData : labelAxisData,
|
|
259
|
+
axisSize: labelOnYAxis ? valueAxisSize : labelAxisSize,
|
|
260
|
+
axisLayout: layout.xAxis,
|
|
261
|
+
centerYAxis,
|
|
262
|
+
rotatable: getRotatableOption(options),
|
|
263
|
+
labelMargin: (_b = (_a = options.xAxis) === null || _a === void 0 ? void 0 : _a.label) === null || _b === void 0 ? void 0 : _b.margin,
|
|
264
|
+
}),
|
|
265
|
+
yAxis: labelOnYAxis ? labelAxisData : valueAxisData,
|
|
266
|
+
secondaryYAxis,
|
|
267
|
+
centerYAxis,
|
|
268
|
+
};
|
|
269
|
+
if (hasAxesLayoutChanged(state.axes, axesState)) {
|
|
270
|
+
this.notify(state, 'layout');
|
|
271
|
+
}
|
|
272
|
+
state.axes = axesState;
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
computed: {},
|
|
276
|
+
observe: {
|
|
277
|
+
updateAxes() {
|
|
278
|
+
this.dispatch('setAxesData');
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
export default axes;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { StoreModule, RawSeries, Series, Categories } from "../../types/store/store";
|
|
2
|
+
export declare function makeRawCategories(series: RawSeries | Series, categories?: Categories): string[] | import("../../types/options").HeatmapCategoriesType;
|
|
3
|
+
declare const category: StoreModule;
|
|
4
|
+
export default category;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { isNull, isNumber, isUndefined, sortCategories } from "../helpers/utils";
|
|
2
|
+
import { getCoordinateXValue } from "../helpers/coordinate";
|
|
3
|
+
import { getDataInRange } from "../helpers/range";
|
|
4
|
+
export function makeRawCategories(series, categories) {
|
|
5
|
+
if (categories) {
|
|
6
|
+
return categories;
|
|
7
|
+
}
|
|
8
|
+
const firstValues = new Set();
|
|
9
|
+
Object.keys(series).forEach((key) => {
|
|
10
|
+
var _a;
|
|
11
|
+
if (key === 'pie' || key === 'gauge') {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
(_a = series[key].data, (_a !== null && _a !== void 0 ? _a : series[key])).forEach(({ data, name, visible }) => {
|
|
15
|
+
if (Array.isArray(data)) {
|
|
16
|
+
data.forEach((datum) => {
|
|
17
|
+
if (!isNull(datum)) {
|
|
18
|
+
const rawXValue = getCoordinateXValue(datum);
|
|
19
|
+
firstValues.add(isNumber(rawXValue) ? rawXValue : rawXValue.toString());
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else if ((key === 'bullet' && isUndefined(visible)) || visible) {
|
|
24
|
+
firstValues.add(name);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return Array.from(firstValues)
|
|
29
|
+
.sort(sortCategories)
|
|
30
|
+
.map((category) => String(category));
|
|
31
|
+
}
|
|
32
|
+
const category = {
|
|
33
|
+
name: 'category',
|
|
34
|
+
state: ({ categories, series }) => ({
|
|
35
|
+
categories: makeRawCategories(series, categories),
|
|
36
|
+
}),
|
|
37
|
+
action: {
|
|
38
|
+
setCategory({ state, computed }) {
|
|
39
|
+
const { viewRange } = computed;
|
|
40
|
+
let categories = state.rawCategories;
|
|
41
|
+
if (viewRange) {
|
|
42
|
+
if (Array.isArray(categories)) {
|
|
43
|
+
categories = getDataInRange(categories, viewRange);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
categories = Object.assign(Object.assign({}, categories), { x: getDataInRange(categories.x, viewRange) });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
state.categories = categories;
|
|
50
|
+
this.notify(state, 'categories');
|
|
51
|
+
},
|
|
52
|
+
initCategory({ initStoreState, state }) {
|
|
53
|
+
const { zoomRange } = state;
|
|
54
|
+
let categories = makeRawCategories(initStoreState.series);
|
|
55
|
+
if (zoomRange && Array.isArray(categories)) {
|
|
56
|
+
categories = getDataInRange(categories, zoomRange);
|
|
57
|
+
}
|
|
58
|
+
state.categories = categories;
|
|
59
|
+
this.notify(state, 'categories');
|
|
60
|
+
},
|
|
61
|
+
removeCategoryByName({ state }, name) {
|
|
62
|
+
const index = state.categories.findIndex((seriesName) => seriesName === name);
|
|
63
|
+
state.categories.splice(index, 1);
|
|
64
|
+
this.notify(state, 'axes');
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
observe: {
|
|
68
|
+
updateCategory() {
|
|
69
|
+
this.dispatch('setCategory');
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
export default category;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { extend } from "./store";
|
|
2
|
+
import { calculateCoordinateScale } from "../scale/coordinateScaleCalculator";
|
|
3
|
+
import { getLimitSafely } from "./dataRange";
|
|
4
|
+
import { isVerticalAlign } from "./layout";
|
|
5
|
+
import { TREEMAP_ROOT_ID } from "./treemapSeriesData";
|
|
6
|
+
const colorValueScale = {
|
|
7
|
+
name: 'colorValueScale',
|
|
8
|
+
state: () => ({
|
|
9
|
+
treemapZoomId: {
|
|
10
|
+
prev: TREEMAP_ROOT_ID,
|
|
11
|
+
cur: TREEMAP_ROOT_ID,
|
|
12
|
+
},
|
|
13
|
+
colorValueScale: {},
|
|
14
|
+
}),
|
|
15
|
+
action: {
|
|
16
|
+
setColorValueScale({ state }) {
|
|
17
|
+
const { layout, treemapSeries, legend, heatmapSeries } = state;
|
|
18
|
+
if (!legend.useSpectrumLegend) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const series = (treemapSeries !== null && treemapSeries !== void 0 ? treemapSeries : heatmapSeries.flatMap((value) => value));
|
|
22
|
+
const values = series.reduce((acc, { colorValue }) => (colorValue ? [...acc, colorValue] : acc), []);
|
|
23
|
+
const dataRange = getLimitSafely([...new Set(values)]);
|
|
24
|
+
const offsetSize = isVerticalAlign(legend.align) ? layout.plot.width / 2 : layout.plot.height;
|
|
25
|
+
extend(state.colorValueScale, calculateCoordinateScale({
|
|
26
|
+
dataRange,
|
|
27
|
+
offsetSize,
|
|
28
|
+
useSpectrumLegend: true,
|
|
29
|
+
scaleOption: {},
|
|
30
|
+
}));
|
|
31
|
+
},
|
|
32
|
+
setTreemapZoomId({ state }, id) {
|
|
33
|
+
state.treemapZoomId.prev = state.treemapZoomId.cur;
|
|
34
|
+
state.treemapZoomId.cur = id;
|
|
35
|
+
},
|
|
36
|
+
zoomBack({ state }) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const { treemapSeries, treemapZoomId } = state;
|
|
39
|
+
const { prev } = treemapZoomId;
|
|
40
|
+
const prevSeries = treemapSeries.find(({ id }) => id === prev);
|
|
41
|
+
state.treemapZoomId.prev = (_b = (_a = prevSeries) === null || _a === void 0 ? void 0 : _a.parentId, (_b !== null && _b !== void 0 ? _b : TREEMAP_ROOT_ID));
|
|
42
|
+
state.treemapZoomId.cur = prev;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
observe: {
|
|
46
|
+
updateColorValueScale() {
|
|
47
|
+
this.dispatch('setColorValueScale');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
computed: {
|
|
51
|
+
isTreemapSeriesZooming: ({ treemapZoomId }) => {
|
|
52
|
+
return treemapZoomId && treemapZoomId.cur !== treemapZoomId.prev;
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
export default colorValueScale;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { getFirstValidValue, isNull, includes } from "../helpers/utils";
|
|
2
|
+
import { extend } from "./store";
|
|
3
|
+
import { getAxisName, isLabelAxisOnYAxis, getValueAxisNames, getYAxisOption, hasSecondaryYAxis, } from "../helpers/axes";
|
|
4
|
+
import { getCoordinateYValue, isCoordinateSeries } from "../helpers/coordinate";
|
|
5
|
+
import { isRangeValue } from "../helpers/range";
|
|
6
|
+
import { AxisType } from "../component/axis";
|
|
7
|
+
export function getLimitSafely(baseValues, isXAxis = false) {
|
|
8
|
+
const limit = {
|
|
9
|
+
min: Math.min(...baseValues),
|
|
10
|
+
max: Math.max(...baseValues),
|
|
11
|
+
};
|
|
12
|
+
if (baseValues.length === 1) {
|
|
13
|
+
const [firstValue] = baseValues;
|
|
14
|
+
if (isXAxis) {
|
|
15
|
+
limit.min = firstValue;
|
|
16
|
+
limit.max = firstValue;
|
|
17
|
+
}
|
|
18
|
+
else if (firstValue > 0) {
|
|
19
|
+
limit.min = 0;
|
|
20
|
+
}
|
|
21
|
+
else if (firstValue === 0) {
|
|
22
|
+
limit.max = 10;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
limit.max = 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (limit.min === 0 && limit.max === 0) {
|
|
29
|
+
limit.max = 10;
|
|
30
|
+
}
|
|
31
|
+
else if (limit.min === limit.max) {
|
|
32
|
+
limit.min -= limit.min / 10;
|
|
33
|
+
limit.max += limit.max / 10;
|
|
34
|
+
}
|
|
35
|
+
return limit;
|
|
36
|
+
}
|
|
37
|
+
function initDataRange(accDataRangeValue, curDataRangeValue, axisName) {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
const defaultDataRange = {
|
|
40
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
41
|
+
max: Number.MIN_SAFE_INTEGER,
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
min: Math.min(curDataRangeValue[axisName].min, (_b = (_a = accDataRangeValue[axisName]) === null || _a === void 0 ? void 0 : _a.min, (_b !== null && _b !== void 0 ? _b : defaultDataRange.min))),
|
|
45
|
+
max: Math.max(curDataRangeValue[axisName].max, (_d = (_c = accDataRangeValue[axisName]) === null || _c === void 0 ? void 0 : _c.max, (_d !== null && _d !== void 0 ? _d : defaultDataRange.max))),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getTotalDataRange(seriesDataRange) {
|
|
49
|
+
return Object.values(seriesDataRange).reduce((acc, cur) => {
|
|
50
|
+
if (cur.xAxis) {
|
|
51
|
+
acc.xAxis = initDataRange(acc, cur, 'xAxis');
|
|
52
|
+
}
|
|
53
|
+
if (cur.yAxis) {
|
|
54
|
+
acc.yAxis = initDataRange(acc, cur, 'yAxis');
|
|
55
|
+
}
|
|
56
|
+
if (cur.secondaryYAxis) {
|
|
57
|
+
acc.secondaryYAxis = initDataRange(acc, cur, 'secondaryYAxis');
|
|
58
|
+
}
|
|
59
|
+
if (cur.circularAxis) {
|
|
60
|
+
acc.circularAxis = initDataRange(acc, cur, 'circularAxis');
|
|
61
|
+
}
|
|
62
|
+
if (cur.verticalAxis) {
|
|
63
|
+
acc.verticalAxis = initDataRange(acc, cur, 'verticalAxis');
|
|
64
|
+
}
|
|
65
|
+
return acc;
|
|
66
|
+
}, {});
|
|
67
|
+
}
|
|
68
|
+
function setSeriesDataRange({ options, seriesName, values, valueAxisName, seriesDataRange, }) {
|
|
69
|
+
var _a;
|
|
70
|
+
let axisNames;
|
|
71
|
+
if (includes([AxisType.X, AxisType.CIRCULAR, AxisType.VERTICAL], valueAxisName)) {
|
|
72
|
+
axisNames = [valueAxisName];
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const optionsUsingYAxis = options;
|
|
76
|
+
const { secondaryYAxis } = getYAxisOption(optionsUsingYAxis);
|
|
77
|
+
axisNames =
|
|
78
|
+
hasSecondaryYAxis(optionsUsingYAxis) && ((_a = secondaryYAxis) === null || _a === void 0 ? void 0 : _a.chartType)
|
|
79
|
+
? [secondaryYAxis.chartType === seriesName ? 'secondaryYAxis' : 'yAxis']
|
|
80
|
+
: getValueAxisNames(optionsUsingYAxis, valueAxisName);
|
|
81
|
+
}
|
|
82
|
+
axisNames.forEach((axisName) => {
|
|
83
|
+
seriesDataRange[seriesName][axisName] = getLimitSafely([...new Set(values)]);
|
|
84
|
+
});
|
|
85
|
+
return seriesDataRange;
|
|
86
|
+
}
|
|
87
|
+
function getBoxPlotValues(series, seriesName) {
|
|
88
|
+
return series[seriesName].data.flatMap(({ data, outliers = [] }) => [
|
|
89
|
+
...((data !== null && data !== void 0 ? data : [])).flatMap((datum) => datum),
|
|
90
|
+
...((outliers !== null && outliers !== void 0 ? outliers : [])).flatMap((datum) => datum),
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
function getBulletValues(series, seriesName) {
|
|
94
|
+
return series[seriesName].data.flatMap(({ data, markers, ranges }) => [
|
|
95
|
+
data,
|
|
96
|
+
...((markers !== null && markers !== void 0 ? markers : [])).flatMap((datum) => datum),
|
|
97
|
+
...((ranges !== null && ranges !== void 0 ? ranges : [])).flatMap((range) => range),
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
function getCoordinateDataValues(values, categories, hasDateValue) {
|
|
101
|
+
const yAxisValues = values
|
|
102
|
+
.filter((value) => !isNull(value))
|
|
103
|
+
.map((value) => getCoordinateYValue(value));
|
|
104
|
+
const xAxisValues = categories.map((value) => hasDateValue ? Number(new Date(value)) : Number(value));
|
|
105
|
+
return { xAxisValues, yAxisValues };
|
|
106
|
+
}
|
|
107
|
+
const dataRange = {
|
|
108
|
+
name: 'dataRange',
|
|
109
|
+
state: () => ({
|
|
110
|
+
dataRange: {},
|
|
111
|
+
}),
|
|
112
|
+
action: {
|
|
113
|
+
setDataRange({ state, initStoreState }) {
|
|
114
|
+
const { series, disabledSeries, stackSeries, categories, options } = state;
|
|
115
|
+
const seriesDataRange = {};
|
|
116
|
+
const labelAxisOnYAxis = isLabelAxisOnYAxis({ series, options, categories });
|
|
117
|
+
const { labelAxisName, valueAxisName } = getAxisName(labelAxisOnYAxis, series);
|
|
118
|
+
Object.keys(series).forEach((seriesName) => {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
seriesDataRange[seriesName] = {};
|
|
121
|
+
let values = series[seriesName].data.flatMap(({ data, name }) => disabledSeries.includes(name) ? [] : data);
|
|
122
|
+
const firstExistValue = getFirstValidValue(values);
|
|
123
|
+
if (isCoordinateSeries(initStoreState.series)) {
|
|
124
|
+
const hasDateValue = !!((_a = options.xAxis) === null || _a === void 0 ? void 0 : _a.date);
|
|
125
|
+
const { yAxisValues, xAxisValues } = getCoordinateDataValues(values, categories, hasDateValue);
|
|
126
|
+
values = yAxisValues;
|
|
127
|
+
seriesDataRange[seriesName][labelAxisName] = getLimitSafely([...xAxisValues], true);
|
|
128
|
+
}
|
|
129
|
+
else if (!series[seriesName].data.length) {
|
|
130
|
+
values = [];
|
|
131
|
+
}
|
|
132
|
+
else if (isRangeValue(firstExistValue)) {
|
|
133
|
+
values = values.reduce((arr, value) => {
|
|
134
|
+
if (isNull(value)) {
|
|
135
|
+
return arr;
|
|
136
|
+
}
|
|
137
|
+
return Array.isArray(value) ? [...arr, ...value] : [...value];
|
|
138
|
+
}, []);
|
|
139
|
+
}
|
|
140
|
+
else if (stackSeries && ((_b = stackSeries[seriesName]) === null || _b === void 0 ? void 0 : _b.stack)) {
|
|
141
|
+
values = stackSeries[seriesName].dataRangeValues;
|
|
142
|
+
}
|
|
143
|
+
else if (seriesName === 'boxPlot') {
|
|
144
|
+
values = getBoxPlotValues(series, seriesName);
|
|
145
|
+
}
|
|
146
|
+
else if (seriesName === 'bullet') {
|
|
147
|
+
values = getBulletValues(series, seriesName);
|
|
148
|
+
}
|
|
149
|
+
if (includes(['bar', 'column', 'radar', 'bullet'], seriesName)) {
|
|
150
|
+
values.push(0);
|
|
151
|
+
}
|
|
152
|
+
setSeriesDataRange({
|
|
153
|
+
options,
|
|
154
|
+
seriesName,
|
|
155
|
+
values,
|
|
156
|
+
valueAxisName,
|
|
157
|
+
seriesDataRange,
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
const newDataRange = getTotalDataRange(seriesDataRange);
|
|
161
|
+
extend(state.dataRange, newDataRange);
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
observe: {
|
|
165
|
+
updateDataRange() {
|
|
166
|
+
this.dispatch('setDataRange');
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
export default dataRange;
|