@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,175 @@
|
|
|
1
|
+
import { getInitAxisIntervalData, getMaxLabelSize, isLabelAxisOnYAxis, makeTitleOption, getDefaultRadialAxisData, } from "../helpers/axes";
|
|
2
|
+
import { makeLabelsFromLimit, getFontHeight } from "../helpers/calculator";
|
|
3
|
+
import { getTitleFontString } from "../helpers/style";
|
|
4
|
+
import { DEGREE_360, DEGREE_0 } from "../helpers/sector";
|
|
5
|
+
import { isObject, calculateSizeWithPercentString } from "../helpers/utils";
|
|
6
|
+
import { RadialAxisType } from "./radialAxes";
|
|
7
|
+
import { isExistPlotId } from "../helpers/plot";
|
|
8
|
+
const DEFAULT_LABEL_PADDING = 15;
|
|
9
|
+
const RANGE_BAR_MARGIN = 10;
|
|
10
|
+
const CLOCK_HAND_MARGIN = 10;
|
|
11
|
+
export const DATA_LABEL_MARGIN = 30;
|
|
12
|
+
function makeSolidData(outerRadius, barWidth, solidOptions) {
|
|
13
|
+
const initialSolidOptions = (solidOptions !== null && solidOptions !== void 0 ? solidOptions : false);
|
|
14
|
+
const solidBarWidth = calculateSizeWithPercentString(outerRadius, barWidth);
|
|
15
|
+
const defaultSolidOptions = {
|
|
16
|
+
visible: true,
|
|
17
|
+
radiusRange: {
|
|
18
|
+
inner: outerRadius - solidBarWidth,
|
|
19
|
+
outer: outerRadius,
|
|
20
|
+
},
|
|
21
|
+
barWidth: solidBarWidth,
|
|
22
|
+
clockHand: false,
|
|
23
|
+
};
|
|
24
|
+
if (!initialSolidOptions) {
|
|
25
|
+
return Object.assign(Object.assign({}, defaultSolidOptions), { visible: false });
|
|
26
|
+
}
|
|
27
|
+
return isObject(initialSolidOptions)
|
|
28
|
+
? Object.assign(Object.assign({}, defaultSolidOptions), initialSolidOptions) : defaultSolidOptions;
|
|
29
|
+
}
|
|
30
|
+
function getCircularAxisData({ labels, intervalData, circularAxisLabelMargin, circularAxisLabelFont, defaultAxisData, bandWidth, options, solidBarWidth, }) {
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
const { maxLabelWidth, maxLabelHeight } = getMaxLabelSize(labels, circularAxisLabelMargin, circularAxisLabelFont);
|
|
33
|
+
const { totalAngle, axisSize, centerX, centerY, startAngle, endAngle, drawingStartAngle, clockwise, } = defaultAxisData;
|
|
34
|
+
const { tickInterval, labelInterval } = intervalData;
|
|
35
|
+
const outerRadius = axisSize - bandWidth - RANGE_BAR_MARGIN;
|
|
36
|
+
const solidBarWidthValue = (solidBarWidth !== null && solidBarWidth !== void 0 ? solidBarWidth : outerRadius * 0.1);
|
|
37
|
+
const solidData = makeSolidData(outerRadius - circularAxisLabelMargin - maxLabelHeight - (circularAxisLabelMargin - 5), solidBarWidthValue, (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.solid);
|
|
38
|
+
const centralAngle = totalAngle / (labels.length + (totalAngle < DEGREE_360 ? -1 : DEGREE_0));
|
|
39
|
+
const maxClockHandSize = outerRadius -
|
|
40
|
+
circularAxisLabelMargin -
|
|
41
|
+
maxLabelHeight -
|
|
42
|
+
CLOCK_HAND_MARGIN +
|
|
43
|
+
(solidData.visible ? -solidData.barWidth - CLOCK_HAND_MARGIN : 0);
|
|
44
|
+
return {
|
|
45
|
+
axisSize,
|
|
46
|
+
centerX,
|
|
47
|
+
centerY,
|
|
48
|
+
label: {
|
|
49
|
+
labels,
|
|
50
|
+
interval: labelInterval,
|
|
51
|
+
margin: circularAxisLabelMargin,
|
|
52
|
+
maxWidth: maxLabelWidth,
|
|
53
|
+
maxHeight: maxLabelHeight,
|
|
54
|
+
},
|
|
55
|
+
radius: {
|
|
56
|
+
inner: 0,
|
|
57
|
+
outer: outerRadius,
|
|
58
|
+
},
|
|
59
|
+
angle: {
|
|
60
|
+
start: startAngle,
|
|
61
|
+
end: endAngle,
|
|
62
|
+
total: totalAngle,
|
|
63
|
+
central: centralAngle,
|
|
64
|
+
drawingStart: drawingStartAngle,
|
|
65
|
+
},
|
|
66
|
+
band: {
|
|
67
|
+
width: bandWidth,
|
|
68
|
+
margin: RANGE_BAR_MARGIN,
|
|
69
|
+
},
|
|
70
|
+
tickInterval,
|
|
71
|
+
clockwise,
|
|
72
|
+
maxClockHandSize,
|
|
73
|
+
title: makeTitleOption((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.circularAxis) === null || _d === void 0 ? void 0 : _d.title),
|
|
74
|
+
solidData,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function makeLabels(options, rawLabels, axisName) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const formatter = (_c = (_b = (_a = options[axisName]) === null || _a === void 0 ? void 0 : _a.label) === null || _b === void 0 ? void 0 : _b.formatter, (_c !== null && _c !== void 0 ? _c : ((value) => value)));
|
|
80
|
+
return rawLabels.map((label, index) => formatter(label, { index, labels: rawLabels, axisName }));
|
|
81
|
+
}
|
|
82
|
+
function getAxisLabels(isLabelOnVerticalAxis, options, categories, scale) {
|
|
83
|
+
const valueAxisName = isLabelOnVerticalAxis
|
|
84
|
+
? RadialAxisType.CIRCULAR
|
|
85
|
+
: RadialAxisType.VERTICAL;
|
|
86
|
+
const { limit, stepSize } = scale[valueAxisName];
|
|
87
|
+
const valueLabels = makeLabels(options, makeLabelsFromLimit(limit, stepSize), valueAxisName);
|
|
88
|
+
const categoryLabels = makeLabels(options, categories, isLabelOnVerticalAxis ? RadialAxisType.VERTICAL : RadialAxisType.CIRCULAR);
|
|
89
|
+
return isLabelOnVerticalAxis ? valueLabels : categoryLabels;
|
|
90
|
+
}
|
|
91
|
+
function getAxisLabelMargin(options) {
|
|
92
|
+
var _a, _b, _c, _d;
|
|
93
|
+
return _d = (_c = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.circularAxis) === null || _b === void 0 ? void 0 : _b.label) === null || _c === void 0 ? void 0 : _c.margin, (_d !== null && _d !== void 0 ? _d : DEFAULT_LABEL_PADDING);
|
|
94
|
+
}
|
|
95
|
+
function hasAxesLayoutChanged(previousAxes, currentAxes) {
|
|
96
|
+
var _a, _b, _c, _d;
|
|
97
|
+
const prevMaxWidth = (_b = (_a = previousAxes) === null || _a === void 0 ? void 0 : _a.label) === null || _b === void 0 ? void 0 : _b.maxWidth;
|
|
98
|
+
const prevMaxHeight = (_d = (_c = previousAxes) === null || _c === void 0 ? void 0 : _c.label) === null || _d === void 0 ? void 0 : _d.maxHeight;
|
|
99
|
+
const curMaxWidth = currentAxes.label.maxWidth;
|
|
100
|
+
const curMaxHeight = currentAxes.label.maxHeight;
|
|
101
|
+
return prevMaxHeight !== curMaxHeight || prevMaxWidth !== curMaxWidth;
|
|
102
|
+
}
|
|
103
|
+
const axes = {
|
|
104
|
+
name: 'gaugeAxes',
|
|
105
|
+
state: () => ({
|
|
106
|
+
radialAxes: {
|
|
107
|
+
circularAxis: {},
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
action: {
|
|
111
|
+
setCircularAxisData({ state }) {
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
113
|
+
const { series, layout, scale } = state;
|
|
114
|
+
const categories = state.categories;
|
|
115
|
+
const { plot } = layout;
|
|
116
|
+
const isLabelOnVerticalAxis = isLabelAxisOnYAxis({ series, categories });
|
|
117
|
+
const options = state.options;
|
|
118
|
+
const theme = state.theme;
|
|
119
|
+
const circularAxisLabelFont = getTitleFontString(theme.circularAxis.label);
|
|
120
|
+
const circularAxisLabelMargin = getAxisLabelMargin(options);
|
|
121
|
+
const circularAxisLabels = getAxisLabels(isLabelOnVerticalAxis, options, categories, scale);
|
|
122
|
+
const { maxLabelWidth, maxLabelHeight } = getMaxLabelSize(circularAxisLabels, circularAxisLabelMargin, circularAxisLabelFont);
|
|
123
|
+
const defaultAxisData = getDefaultRadialAxisData(options, plot, maxLabelWidth, maxLabelHeight, isLabelOnVerticalAxis);
|
|
124
|
+
const dataLabelHeight = getFontHeight(getTitleFontString(theme.series.gauge.dataLabels));
|
|
125
|
+
const dataLabelOffsetY = (_d = (_c = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.dataLabels) === null || _c === void 0 ? void 0 : _c.offsetY, (_d !== null && _d !== void 0 ? _d : DATA_LABEL_MARGIN));
|
|
126
|
+
if (defaultAxisData.isSemiCircular) {
|
|
127
|
+
defaultAxisData.centerY =
|
|
128
|
+
defaultAxisData.centerY - (dataLabelOffsetY > 0 ? dataLabelOffsetY + dataLabelHeight : 0);
|
|
129
|
+
const diffHeight = defaultAxisData.centerY - defaultAxisData.axisSize;
|
|
130
|
+
defaultAxisData.axisSize += diffHeight < 0 ? diffHeight : 0;
|
|
131
|
+
}
|
|
132
|
+
const defualtBandWidth = ((_g = (_f = (_e = options) === null || _e === void 0 ? void 0 : _e.plot) === null || _f === void 0 ? void 0 : _f.bands) === null || _g === void 0 ? void 0 : _g.length) ? defaultAxisData.axisSize / 2 - RANGE_BAR_MARGIN
|
|
133
|
+
: 0;
|
|
134
|
+
const bandWidth = (_k = (_j = (_h = theme.plot) === null || _h === void 0 ? void 0 : _h.bands) === null || _j === void 0 ? void 0 : _j.barWidth, (_k !== null && _k !== void 0 ? _k : defualtBandWidth));
|
|
135
|
+
const circularAxisData = getCircularAxisData({
|
|
136
|
+
labels: circularAxisLabels,
|
|
137
|
+
intervalData: getInitAxisIntervalData(true, {
|
|
138
|
+
axis: options.circularAxis,
|
|
139
|
+
categories,
|
|
140
|
+
layout,
|
|
141
|
+
}),
|
|
142
|
+
defaultAxisData,
|
|
143
|
+
circularAxisLabelMargin,
|
|
144
|
+
circularAxisLabelFont,
|
|
145
|
+
bandWidth,
|
|
146
|
+
options,
|
|
147
|
+
solidBarWidth: (_m = (_l = theme.series.gauge) === null || _l === void 0 ? void 0 : _l.solid) === null || _m === void 0 ? void 0 : _m.barWidth,
|
|
148
|
+
});
|
|
149
|
+
if (hasAxesLayoutChanged((_o = state.radialAxes) === null || _o === void 0 ? void 0 : _o.circularAxis, circularAxisData)) {
|
|
150
|
+
this.notify(state, 'layout');
|
|
151
|
+
}
|
|
152
|
+
state.radialAxes = {
|
|
153
|
+
circularAxis: circularAxisData,
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
addGaugePlotBand({ state }, { data }) {
|
|
157
|
+
var _a, _b, _c;
|
|
158
|
+
const bands = (_c = (_b = (_a = state.options) === null || _a === void 0 ? void 0 : _a.plot) === null || _b === void 0 ? void 0 : _b.bands, (_c !== null && _c !== void 0 ? _c : []));
|
|
159
|
+
if (!isExistPlotId(bands, data)) {
|
|
160
|
+
this.dispatch('updateOptions', { options: { plot: { bands: [...bands, data] } } });
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
removeGaugePlotBand({ state }, { id }) {
|
|
164
|
+
var _a, _b, _c;
|
|
165
|
+
const bands = (_c = (_b = (_a = state.options) === null || _a === void 0 ? void 0 : _a.plot) === null || _b === void 0 ? void 0 : _b.bands, (_c !== null && _c !== void 0 ? _c : [])).filter(({ id: bandId }) => bandId !== id);
|
|
166
|
+
this.dispatch('updateOptions', { options: { plot: { bands } } });
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
observe: {
|
|
170
|
+
updateRadialAxes() {
|
|
171
|
+
this.dispatch('setCircularAxisData');
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
export default axes;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AxisType } from "../component/axis";
|
|
2
|
+
import { getAxisTheme, getViewAxisLabels, makeRotationData, getRotatableOption, hasAxesLayoutChanged, makeTitleOption, getMaxLabelSize, getLabelXMargin, getLabelsAppliedFormatter, isDateType, } from "../helpers/axes";
|
|
3
|
+
import { getAxisLabelAnchorPoint } from "../helpers/calculator";
|
|
4
|
+
import { getTitleFontString } from "../helpers/style";
|
|
5
|
+
function getHeatmapAxisData(stateProp, axisType) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7
|
+
const { categories, axisSize, axisLayout, options, theme } = stateProp;
|
|
8
|
+
const isLabelAxis = axisType === AxisType.X;
|
|
9
|
+
const axisName = isLabelAxis ? 'x' : 'y';
|
|
10
|
+
const dateType = isDateType(options, axisType);
|
|
11
|
+
const labels = getLabelsAppliedFormatter(categories[axisName], options, dateType, axisType);
|
|
12
|
+
const tickIntervalCount = labels.length;
|
|
13
|
+
const tickDistance = tickIntervalCount ? axisSize / tickIntervalCount : axisSize;
|
|
14
|
+
const labelDistance = axisSize / tickIntervalCount;
|
|
15
|
+
const pointOnColumn = true;
|
|
16
|
+
const tickCount = tickIntervalCount + 1;
|
|
17
|
+
const tickInterval = (_c = (_b = (_a = options[axisType]) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.interval, (_c !== null && _c !== void 0 ? _c : 1));
|
|
18
|
+
const labelInterval = (_f = (_e = (_d = options[axisType]) === null || _d === void 0 ? void 0 : _d.label) === null || _e === void 0 ? void 0 : _e.interval, (_f !== null && _f !== void 0 ? _f : 1));
|
|
19
|
+
const viewLabels = getViewAxisLabels({
|
|
20
|
+
labels,
|
|
21
|
+
pointOnColumn,
|
|
22
|
+
tickDistance,
|
|
23
|
+
tickCount,
|
|
24
|
+
tickInterval,
|
|
25
|
+
labelInterval,
|
|
26
|
+
}, axisSize);
|
|
27
|
+
const labelXMargin = getLabelXMargin(axisType, options);
|
|
28
|
+
const { maxLabelWidth, maxLabelHeight } = getMaxLabelSize(labels, labelXMargin, getTitleFontString(theme.label));
|
|
29
|
+
const axisData = {
|
|
30
|
+
labels,
|
|
31
|
+
viewLabels,
|
|
32
|
+
pointOnColumn,
|
|
33
|
+
isLabelAxis,
|
|
34
|
+
tickCount,
|
|
35
|
+
tickDistance,
|
|
36
|
+
labelDistance,
|
|
37
|
+
tickInterval,
|
|
38
|
+
labelInterval,
|
|
39
|
+
title: makeTitleOption((_g = options[axisType]) === null || _g === void 0 ? void 0 : _g.title),
|
|
40
|
+
maxLabelWidth,
|
|
41
|
+
maxLabelHeight,
|
|
42
|
+
};
|
|
43
|
+
if (axisType === AxisType.X) {
|
|
44
|
+
const labelMargin = (_k = (_j = (_h = options.xAxis) === null || _h === void 0 ? void 0 : _h.label) === null || _j === void 0 ? void 0 : _j.margin, (_k !== null && _k !== void 0 ? _k : 0));
|
|
45
|
+
const offsetY = getAxisLabelAnchorPoint(maxLabelHeight) + labelMargin;
|
|
46
|
+
const distance = axisSize / viewLabels.length;
|
|
47
|
+
const rotationData = makeRotationData(maxLabelWidth, maxLabelHeight, distance, getRotatableOption(options), axisLayout);
|
|
48
|
+
const { needRotateLabel, rotationHeight } = rotationData;
|
|
49
|
+
const maxHeight = (needRotateLabel ? rotationHeight : maxLabelHeight) + offsetY;
|
|
50
|
+
return Object.assign(Object.assign(Object.assign({}, axisData), rotationData), { maxHeight,
|
|
51
|
+
offsetY });
|
|
52
|
+
}
|
|
53
|
+
return axisData;
|
|
54
|
+
}
|
|
55
|
+
const axes = {
|
|
56
|
+
name: 'axes',
|
|
57
|
+
state: () => {
|
|
58
|
+
return {
|
|
59
|
+
axes: {
|
|
60
|
+
xAxis: {},
|
|
61
|
+
yAxis: {},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
action: {
|
|
66
|
+
setAxesData({ state }) {
|
|
67
|
+
const { layout, theme } = state;
|
|
68
|
+
const { width, height } = layout.plot;
|
|
69
|
+
const categories = state.categories;
|
|
70
|
+
const options = state.options;
|
|
71
|
+
const xAxisData = getHeatmapAxisData({
|
|
72
|
+
axisSize: width,
|
|
73
|
+
categories,
|
|
74
|
+
options,
|
|
75
|
+
theme: getAxisTheme(theme, AxisType.X),
|
|
76
|
+
axisLayout: layout[AxisType.X],
|
|
77
|
+
}, AxisType.X);
|
|
78
|
+
const yAxisData = getHeatmapAxisData({
|
|
79
|
+
axisSize: height,
|
|
80
|
+
categories,
|
|
81
|
+
options,
|
|
82
|
+
theme: getAxisTheme(theme, AxisType.Y),
|
|
83
|
+
}, AxisType.Y);
|
|
84
|
+
const axesState = { xAxis: xAxisData, yAxis: yAxisData };
|
|
85
|
+
if (hasAxesLayoutChanged(state.axes, axesState)) {
|
|
86
|
+
this.notify(state, 'layout');
|
|
87
|
+
}
|
|
88
|
+
state.axes = axesState;
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
computed: {},
|
|
92
|
+
observe: {
|
|
93
|
+
updateAxes() {
|
|
94
|
+
this.dispatch('setAxesData');
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
export default axes;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getDataInRange } from "../helpers/range";
|
|
2
|
+
function makeHeatmapSeries(series, categories, viewRange) {
|
|
3
|
+
if (!series.heatmap) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
return series.heatmap.data.map((rowSeries, y) => {
|
|
7
|
+
const { yCategory, data } = rowSeries;
|
|
8
|
+
return getDataInRange(data, viewRange).map((colorValue, x) => ({
|
|
9
|
+
colorValue,
|
|
10
|
+
category: {
|
|
11
|
+
x: categories.x[x],
|
|
12
|
+
y: yCategory,
|
|
13
|
+
},
|
|
14
|
+
indexes: [x, y],
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const heatmapSeriesData = {
|
|
19
|
+
name: 'heatmapSeriesData',
|
|
20
|
+
state: () => ({
|
|
21
|
+
heatmapSeries: [],
|
|
22
|
+
}),
|
|
23
|
+
action: {
|
|
24
|
+
setHeatmapSeriesData({ state, computed }) {
|
|
25
|
+
state.heatmapSeries = makeHeatmapSeries(state.series, state.categories, computed.viewRange);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
observe: {
|
|
29
|
+
updateTreemapSeriesData() {
|
|
30
|
+
this.dispatch('setHeatmapSeriesData');
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export default heatmapSeriesData;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoreModule, Options } from "../../types/store/store";
|
|
2
|
+
import { Align } from "../../types/options";
|
|
3
|
+
export declare const padding: {
|
|
4
|
+
X: number;
|
|
5
|
+
Y: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const X_AXIS_HEIGHT = 20;
|
|
8
|
+
export declare function isVerticalAlign(align?: Align): boolean;
|
|
9
|
+
export declare function isUsingResetButton(options: Options): boolean;
|
|
10
|
+
export declare function isExportMenuVisible(options: Options): boolean;
|
|
11
|
+
declare const layout: StoreModule;
|
|
12
|
+
export default layout;
|