@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,484 @@
|
|
|
1
|
+
import Store from "../store/store";
|
|
2
|
+
import root from "../store/root";
|
|
3
|
+
import layout from "../store/layout";
|
|
4
|
+
import seriesData from "../store/seriesData";
|
|
5
|
+
import category from "../store/category";
|
|
6
|
+
import legend from "../store/legend";
|
|
7
|
+
import optionsStore from "../store/options";
|
|
8
|
+
import theme from "../store/theme";
|
|
9
|
+
import EventEmitter from "../eventEmitter";
|
|
10
|
+
import ComponentManager from "../component/componentManager";
|
|
11
|
+
import Painter from "../painter";
|
|
12
|
+
import Animator from "../animator";
|
|
13
|
+
import { debounce, isBoolean, isNumber, isUndefined, pick, isAutoValue } from "../helpers/utils";
|
|
14
|
+
import { responderDetectors } from "../responderDetectors";
|
|
15
|
+
import { message } from "../message";
|
|
16
|
+
import { sendHostname } from "../helpers/googleAnalytics";
|
|
17
|
+
import { makeObservableObjectToNormal } from "../store/reactive";
|
|
18
|
+
import { isMouseInRect } from "../helpers/coordinate";
|
|
19
|
+
export const DEFAULT_ANIM_DURATION = 500;
|
|
20
|
+
function getUsingContainerSize(eventName, usingContainerSize, width, height) {
|
|
21
|
+
const { width: usingContainerWidth, height: usingContainerHeight } = usingContainerSize;
|
|
22
|
+
const isAutoWidth = isAutoValue(width);
|
|
23
|
+
const isAutoHeight = isAutoValue(height);
|
|
24
|
+
return eventName === 'updateOptions'
|
|
25
|
+
? {
|
|
26
|
+
width: !isUndefined(width) && usingContainerWidth !== isAutoWidth
|
|
27
|
+
? isAutoWidth
|
|
28
|
+
: usingContainerWidth,
|
|
29
|
+
height: !isUndefined(height) && usingContainerHeight !== isAutoHeight
|
|
30
|
+
? isAutoHeight
|
|
31
|
+
: usingContainerHeight,
|
|
32
|
+
}
|
|
33
|
+
: {
|
|
34
|
+
width: isAutoWidth,
|
|
35
|
+
height: isAutoHeight,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @class
|
|
40
|
+
* @abstract
|
|
41
|
+
* Abstract class used to implement each chart.
|
|
42
|
+
*/
|
|
43
|
+
export default class Chart {
|
|
44
|
+
constructor(props) {
|
|
45
|
+
var _a, _b, _c, _d;
|
|
46
|
+
this.___animId___ = null;
|
|
47
|
+
this.painter = new Painter(this);
|
|
48
|
+
this.eventBus = new EventEmitter();
|
|
49
|
+
this.enteredComponents = [];
|
|
50
|
+
this.animationControlFlag = {
|
|
51
|
+
resizing: false,
|
|
52
|
+
updating: false,
|
|
53
|
+
};
|
|
54
|
+
this.resizeObserver = null;
|
|
55
|
+
this.debounceResizeEvent = debounce(() => {
|
|
56
|
+
const { offsetWidth, offsetHeight } = this.containerEl;
|
|
57
|
+
this.resizeChartSize(offsetWidth, offsetHeight);
|
|
58
|
+
}, 100);
|
|
59
|
+
/**
|
|
60
|
+
* Get checked legend chart type and label, checked state.
|
|
61
|
+
* @returns {Array<{checked: boolean, chartType: string, label: string}>} Array data that whether series has checked
|
|
62
|
+
* @api
|
|
63
|
+
* @example
|
|
64
|
+
* const checkedLegend = chart.getCheckedLegend()
|
|
65
|
+
*/
|
|
66
|
+
this.getCheckedLegend = () => {
|
|
67
|
+
const { data } = this.store.state.legend;
|
|
68
|
+
return data
|
|
69
|
+
.filter((datum) => datum.checked)
|
|
70
|
+
.map((datum) => pick(datum, 'chartType', 'label', 'checked'));
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Returns the currently applied chart options.
|
|
74
|
+
* @returns {Object} options
|
|
75
|
+
* @api
|
|
76
|
+
* @example
|
|
77
|
+
* const options = chart.getOptions();
|
|
78
|
+
*/
|
|
79
|
+
this.getOptions = () => {
|
|
80
|
+
return makeObservableObjectToNormal(this.store.initStoreState.options);
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Register of user custom event.
|
|
84
|
+
* @param {string} eventName - Event name. 'clickLegendLabel', 'clickLegendCheckbox', 'selectSeries', 'unselectSeries', 'hoverSeries', 'unhoverSeries', 'zoom', 'resetZoom' is available.
|
|
85
|
+
* @param {Function} handler - Event handler
|
|
86
|
+
* @api
|
|
87
|
+
*/
|
|
88
|
+
this.on = (eventName, handler) => {
|
|
89
|
+
/**
|
|
90
|
+
* Register Events that occur when click legend label
|
|
91
|
+
* @event ChartBase#clickLegendLabel
|
|
92
|
+
* @param {object} info selected legend information
|
|
93
|
+
* @api
|
|
94
|
+
* @example
|
|
95
|
+
* chart.on('clickLegendLabel', (info) => {
|
|
96
|
+
* console.log(info);
|
|
97
|
+
* });
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* Register Events that occur when click legend checkbox
|
|
101
|
+
* @event ChartBase#clickLegendCheckbox
|
|
102
|
+
* @param {object} info selected legend info
|
|
103
|
+
* @api
|
|
104
|
+
* @example
|
|
105
|
+
* chart.on('clickLegendCheckbox', (info) => {
|
|
106
|
+
* console.log(info);
|
|
107
|
+
* });
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* Register Events that occur when select series
|
|
111
|
+
* @event ChartBase#selectSeries
|
|
112
|
+
* @param {object} info selected series info
|
|
113
|
+
* @api
|
|
114
|
+
* @example
|
|
115
|
+
* chart.on('selectSeries', (info) => {
|
|
116
|
+
* console.log(info);
|
|
117
|
+
* });
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* Register Events that occur when unselect series
|
|
121
|
+
* @event ChartBase#unselectSeries
|
|
122
|
+
* @param {object} info unselected series info
|
|
123
|
+
* @api
|
|
124
|
+
* @example
|
|
125
|
+
* chart.on('unselectSeries', (info) => {
|
|
126
|
+
* console.log(info);
|
|
127
|
+
* });
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* Register Events that occur when hover to series
|
|
131
|
+
* @event ChartBase#hoverSeries
|
|
132
|
+
* @param {object} info hovered series info
|
|
133
|
+
* @api
|
|
134
|
+
* @example
|
|
135
|
+
* chart.on('hoverSeries', (info) => {
|
|
136
|
+
* console.log(info);
|
|
137
|
+
* });
|
|
138
|
+
*/
|
|
139
|
+
/**
|
|
140
|
+
* Register Events that occur when unhover from series
|
|
141
|
+
* @event ChartBase#unhoverSeries
|
|
142
|
+
* @param {object} info unhovered series info
|
|
143
|
+
* @api
|
|
144
|
+
* @example
|
|
145
|
+
* chart.on('unhoverSeries', (info) => {
|
|
146
|
+
* console.log(info);
|
|
147
|
+
* });
|
|
148
|
+
*/
|
|
149
|
+
/**
|
|
150
|
+
* Register Events that occur when zooming
|
|
151
|
+
* @event ChartBase#zoom
|
|
152
|
+
* @param {string[]} dataRange - []
|
|
153
|
+
* @api
|
|
154
|
+
* @example
|
|
155
|
+
* chart.on('zoom', (dataRange) => {
|
|
156
|
+
* console.log(dataRange);
|
|
157
|
+
* });
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* Register Events that occur when zoom is reset
|
|
161
|
+
* @event ChartBase#resetZoom
|
|
162
|
+
* @api
|
|
163
|
+
* @example
|
|
164
|
+
* chart.on('resetZoom', () => {});
|
|
165
|
+
*/
|
|
166
|
+
this.eventBus.on(eventName, handler);
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Destroys the instance.
|
|
170
|
+
* @api
|
|
171
|
+
* @example
|
|
172
|
+
* chart.destroy();
|
|
173
|
+
*/
|
|
174
|
+
this.destroy = () => {
|
|
175
|
+
this.componentManager.clear();
|
|
176
|
+
this.clearResizeEvent();
|
|
177
|
+
this.containerEl.innerHTML = '';
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Select series. It works only when the selectable option is true.
|
|
181
|
+
* @param {Object} seriesInfo - Information of the series to be selected
|
|
182
|
+
* @param {number} [seriesInfo.seriesIndex] - Index of series
|
|
183
|
+
* @param {number} [seriesInfo.index] - Index of data within series
|
|
184
|
+
* @param {string} [seriesInfo.name] - Specify name for NestedPie Chart
|
|
185
|
+
* @param {string} [seriesInfo.chartType] - Specify which chart to select when using LineArea, LineScatter, and ColumnLine charts.specifies which chart to select when using LineArea, LineScatter, and ColumnLine charts.
|
|
186
|
+
* @api
|
|
187
|
+
* @example
|
|
188
|
+
* chart.selectSeries({index: 1, seriesIndex: 2});
|
|
189
|
+
*/
|
|
190
|
+
this.selectSeries = (seriesInfo) => {
|
|
191
|
+
if (!this.isSelectableSeries()) {
|
|
192
|
+
throw new Error(message.SELECT_SERIES_API_SELECTABLE_ERROR);
|
|
193
|
+
}
|
|
194
|
+
this.eventBus.emit('selectSeries', Object.assign(Object.assign({}, seriesInfo), { state: this.store.state }));
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Unselect selected series. It works only when the selectable option is true.
|
|
198
|
+
* @api
|
|
199
|
+
* @example
|
|
200
|
+
* chart.unselectSeries();
|
|
201
|
+
*/
|
|
202
|
+
this.unselectSeries = () => {
|
|
203
|
+
if (!this.isSelectableSeries()) {
|
|
204
|
+
throw new Error(message.SELECT_SERIES_API_SELECTABLE_ERROR);
|
|
205
|
+
}
|
|
206
|
+
this.store.dispatch('setAllLegendActiveState', true);
|
|
207
|
+
this.eventBus.emit('resetSelectedSeries');
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Resize chart size.
|
|
211
|
+
* @param {Object} size Chart size
|
|
212
|
+
* @param {number} [size.width] Width
|
|
213
|
+
* @param {number} [size.height] Height
|
|
214
|
+
* @api
|
|
215
|
+
* @example
|
|
216
|
+
* chart.resize({height: 100, width: 200});
|
|
217
|
+
*/
|
|
218
|
+
this.resize = (size) => {
|
|
219
|
+
this.resetSeries();
|
|
220
|
+
this.dispatchOptionsEvent('updateOptions', { chart: Object.assign({}, size) });
|
|
221
|
+
};
|
|
222
|
+
this.resetSeries = () => {
|
|
223
|
+
this.eventBus.emit('resetHoveredSeries');
|
|
224
|
+
this.eventBus.emit('resetSelectedSeries');
|
|
225
|
+
};
|
|
226
|
+
this.setResizeEventListeners = (eventName, options) => {
|
|
227
|
+
var _a, _b, _c, _d;
|
|
228
|
+
const { usingContainerSize } = this.store.state;
|
|
229
|
+
const { width: usingContainerWidth, height: usingContainerHeight } = usingContainerSize;
|
|
230
|
+
const width = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.chart) === null || _b === void 0 ? void 0 : _b.width;
|
|
231
|
+
const height = (_d = (_c = options) === null || _c === void 0 ? void 0 : _c.chart) === null || _d === void 0 ? void 0 : _d.height;
|
|
232
|
+
const isAutoWidth = isAutoValue(width);
|
|
233
|
+
const isAutoHeight = isAutoValue(height);
|
|
234
|
+
this.store.dispatch('setUsingContainerSize', getUsingContainerSize(eventName, usingContainerSize, width, height));
|
|
235
|
+
if ((usingContainerWidth || usingContainerHeight) && isNumber(width) && isNumber(height)) {
|
|
236
|
+
this.clearResizeEvent();
|
|
237
|
+
}
|
|
238
|
+
else if (!(usingContainerWidth || usingContainerHeight) && (isAutoWidth || isAutoHeight)) {
|
|
239
|
+
this.setResizeEvent();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const { el, options, series, categories, modules } = props;
|
|
243
|
+
this.modules = (modules !== null && modules !== void 0 ? modules : []);
|
|
244
|
+
if (isUndefined(options.usageStatistics) || options.usageStatistics) {
|
|
245
|
+
sendHostname();
|
|
246
|
+
}
|
|
247
|
+
this.containerEl = el;
|
|
248
|
+
this.el = this.createChartWrapper();
|
|
249
|
+
this.containerEl.appendChild(this.el);
|
|
250
|
+
this.animator = new Animator();
|
|
251
|
+
this.store = new Store({
|
|
252
|
+
series,
|
|
253
|
+
categories,
|
|
254
|
+
options,
|
|
255
|
+
});
|
|
256
|
+
this.componentManager = new ComponentManager({
|
|
257
|
+
store: this.store,
|
|
258
|
+
eventBus: this.eventBus,
|
|
259
|
+
});
|
|
260
|
+
this.eventBus.on('needLoop', debounce(() => {
|
|
261
|
+
var _a, _b;
|
|
262
|
+
let duration = this.getAnimationDuration((_a = options.chart) === null || _a === void 0 ? void 0 : _a.animation);
|
|
263
|
+
if (this.animationControlFlag.resizing) {
|
|
264
|
+
duration = isUndefined(options.responsive)
|
|
265
|
+
? this.getAnimationDuration()
|
|
266
|
+
: this.getAnimationDuration((_b = options.responsive) === null || _b === void 0 ? void 0 : _b.animation);
|
|
267
|
+
this.animationControlFlag.resizing = false;
|
|
268
|
+
}
|
|
269
|
+
this.eventBus.emit('loopStart');
|
|
270
|
+
this.animator.add({
|
|
271
|
+
onCompleted: () => {
|
|
272
|
+
this.eventBus.emit('loopComplete');
|
|
273
|
+
},
|
|
274
|
+
chart: this,
|
|
275
|
+
duration,
|
|
276
|
+
requester: this,
|
|
277
|
+
});
|
|
278
|
+
}, 10));
|
|
279
|
+
this.eventBus.on('needSubLoop', (opts) => {
|
|
280
|
+
this.animator.add(Object.assign(Object.assign({}, opts), { chart: this }));
|
|
281
|
+
});
|
|
282
|
+
this.eventBus.on('needDraw', debounce(() => {
|
|
283
|
+
this.draw();
|
|
284
|
+
}, 10));
|
|
285
|
+
this.initialize();
|
|
286
|
+
this.store.observe(() => {
|
|
287
|
+
this.painter.setup();
|
|
288
|
+
});
|
|
289
|
+
if (isAutoValue((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.chart) === null || _b === void 0 ? void 0 : _b.width) || isAutoValue((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.chart) === null || _d === void 0 ? void 0 : _d.height)) {
|
|
290
|
+
this.setResizeEvent();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
getAnimationDuration(animationOption) {
|
|
294
|
+
const { firstRendering } = this.animator;
|
|
295
|
+
const { resizing, updating } = this.animationControlFlag;
|
|
296
|
+
let duration;
|
|
297
|
+
if ((!firstRendering && !resizing) || isUndefined(animationOption)) {
|
|
298
|
+
duration = DEFAULT_ANIM_DURATION;
|
|
299
|
+
}
|
|
300
|
+
else if (isBoolean(animationOption)) {
|
|
301
|
+
duration = animationOption ? DEFAULT_ANIM_DURATION : 0;
|
|
302
|
+
}
|
|
303
|
+
else if (isNumber(animationOption.duration)) {
|
|
304
|
+
duration = animationOption.duration;
|
|
305
|
+
}
|
|
306
|
+
if (updating) {
|
|
307
|
+
duration = 0;
|
|
308
|
+
}
|
|
309
|
+
this.animationControlFlag.updating = false;
|
|
310
|
+
return duration;
|
|
311
|
+
}
|
|
312
|
+
createChartWrapper() {
|
|
313
|
+
const el = document.createElement('div');
|
|
314
|
+
el.classList.add('td-chart-wrapper');
|
|
315
|
+
return el;
|
|
316
|
+
}
|
|
317
|
+
resizeChartSize(containerWidth, containerHeight) {
|
|
318
|
+
this.animationControlFlag.resizing = true;
|
|
319
|
+
const { usingContainerSize: { width: usingContainerWidth, height: usingContainerHeight }, chart: { width, height }, } = this.store.state;
|
|
320
|
+
if (!(usingContainerWidth || usingContainerHeight) ||
|
|
321
|
+
!(containerWidth || containerHeight) ||
|
|
322
|
+
(containerWidth === width && containerHeight === height)) {
|
|
323
|
+
this.animationControlFlag.resizing = false;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// @TODO: For updates where the data doesn't change, it looks good to recalculate the selected series position.
|
|
327
|
+
this.resetSeries();
|
|
328
|
+
this.store.dispatch('setChartSize', {
|
|
329
|
+
width: usingContainerWidth ? containerWidth : width,
|
|
330
|
+
height: usingContainerHeight ? containerHeight : height,
|
|
331
|
+
});
|
|
332
|
+
this.draw();
|
|
333
|
+
}
|
|
334
|
+
setResizeEvent() {
|
|
335
|
+
const { usingContainerSize } = this.store.state;
|
|
336
|
+
if ((usingContainerSize.height && !this.containerEl.style.height.length) ||
|
|
337
|
+
(usingContainerSize.width && !this.containerEl.style.width.length)) {
|
|
338
|
+
throw new Error(message.AUTO_LAYOUT_CONTAINER_SIZE_ERROR);
|
|
339
|
+
}
|
|
340
|
+
const isResizeObserverAPIExist = typeof ResizeObserver === 'undefined';
|
|
341
|
+
if (isResizeObserverAPIExist) {
|
|
342
|
+
window.addEventListener('resize', this.debounceResizeEvent);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
346
|
+
entries.forEach(() => {
|
|
347
|
+
this.debounceResizeEvent();
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
this.resizeObserver.observe(this.containerEl);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
clearResizeEvent() {
|
|
354
|
+
if (this.resizeObserver) {
|
|
355
|
+
this.resizeObserver.unobserve(this.containerEl);
|
|
356
|
+
this.resizeObserver.disconnect();
|
|
357
|
+
this.resizeObserver = null;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
window.removeEventListener('resize', this.debounceResizeEvent);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
handleCanvasMouseEvent(eventType, mousePosition) {
|
|
364
|
+
const newEnteredComponents = [];
|
|
365
|
+
this.componentManager.forEach((component) => {
|
|
366
|
+
if (eventType === 'mousemove') {
|
|
367
|
+
const exist = this.enteredComponents.some((enteredComponent) => enteredComponent === component);
|
|
368
|
+
if (isMouseInRect(component.rect, mousePosition)) {
|
|
369
|
+
newEnteredComponents.push(component);
|
|
370
|
+
if (!exist && component.onMouseenterComponent) {
|
|
371
|
+
component.onMouseenterComponent();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else if (exist && component.onMouseoutComponent) {
|
|
375
|
+
component.onMouseoutComponent();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else if (eventType === 'mouseout' && component.onMouseoutComponent) {
|
|
379
|
+
component.onMouseoutComponent();
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
this.enteredComponents = newEnteredComponents;
|
|
383
|
+
}
|
|
384
|
+
handleResponderEvent(event, mousePosition) {
|
|
385
|
+
const eventType = event.type;
|
|
386
|
+
const delegationMethod = `on${eventType[0].toUpperCase() + eventType.substring(1)}`;
|
|
387
|
+
const allResponders = [];
|
|
388
|
+
this.componentManager.forEach((component) => {
|
|
389
|
+
if (!component[delegationMethod]) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (!responderDetectors.rect(mousePosition, component.rect)) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const detected = (component.responders || []).filter((m) => {
|
|
396
|
+
return responderDetectors[m.type](mousePosition, m, component.rect);
|
|
397
|
+
});
|
|
398
|
+
if (detected.length) {
|
|
399
|
+
allResponders.push({ component, detected });
|
|
400
|
+
}
|
|
401
|
+
component[delegationMethod]({ mousePosition, responders: detected }, event);
|
|
402
|
+
});
|
|
403
|
+
if (this.handleEventForAllResponders) {
|
|
404
|
+
this.handleEventForAllResponders(event, allResponders, delegationMethod, mousePosition);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
handleEvent(event) {
|
|
408
|
+
const { clientX, clientY, type: eventType } = event;
|
|
409
|
+
const canvas = this.painter.ctx.canvas;
|
|
410
|
+
const { width, height, left, top } = canvas.getBoundingClientRect();
|
|
411
|
+
// Calculate scale for chart affected by a CSS transform.
|
|
412
|
+
const scaleX = width / canvas.offsetWidth;
|
|
413
|
+
const scaleY = height / canvas.offsetHeight;
|
|
414
|
+
const mousePosition = {
|
|
415
|
+
x: (clientX - left) / scaleX,
|
|
416
|
+
y: (clientY - top) / scaleY,
|
|
417
|
+
};
|
|
418
|
+
if (eventType === 'mousemove' || eventType === 'mouseout') {
|
|
419
|
+
this.handleCanvasMouseEvent(eventType, mousePosition);
|
|
420
|
+
}
|
|
421
|
+
this.handleResponderEvent(event, mousePosition);
|
|
422
|
+
}
|
|
423
|
+
initStore() {
|
|
424
|
+
[
|
|
425
|
+
root,
|
|
426
|
+
optionsStore,
|
|
427
|
+
theme,
|
|
428
|
+
seriesData,
|
|
429
|
+
legend,
|
|
430
|
+
layout,
|
|
431
|
+
category,
|
|
432
|
+
...this.modules,
|
|
433
|
+
].forEach((module) => this.store.setModule(module));
|
|
434
|
+
}
|
|
435
|
+
initialize() {
|
|
436
|
+
this.initStore();
|
|
437
|
+
this.store.dispatch('initChartSize', this.containerEl);
|
|
438
|
+
}
|
|
439
|
+
draw() {
|
|
440
|
+
this.painter.beforeFrame();
|
|
441
|
+
this.componentManager.forEach((component) => {
|
|
442
|
+
if (!component.isShow) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
this.painter.beforeDraw(component.rect.x, component.rect.y);
|
|
446
|
+
if (component.beforeDraw) {
|
|
447
|
+
component.beforeDraw(this.painter);
|
|
448
|
+
}
|
|
449
|
+
component.draw(this.painter);
|
|
450
|
+
this.painter.afterDraw();
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
update(delta) {
|
|
454
|
+
this.componentManager.invoke('update', delta);
|
|
455
|
+
}
|
|
456
|
+
initUpdate(delta) {
|
|
457
|
+
this.componentManager.invoke('initUpdate', delta);
|
|
458
|
+
}
|
|
459
|
+
isSelectableSeries() {
|
|
460
|
+
var _a;
|
|
461
|
+
return (_a = this.store.initStoreState.options.series) === null || _a === void 0 ? void 0 : _a.selectable;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Set tooltip offset.
|
|
465
|
+
* @param {Object} offset - Offset size
|
|
466
|
+
* @param {number} [offset.x] Offset value to move title horizontally
|
|
467
|
+
* @param {number} [offset.y] Offset value to move title vertically
|
|
468
|
+
* @api
|
|
469
|
+
* @example
|
|
470
|
+
* chart.setTooltipOffset({x: 10, y: -20});
|
|
471
|
+
*/
|
|
472
|
+
setTooltipOffset(offset) {
|
|
473
|
+
const { x: offsetX, y: offsetY } = offset;
|
|
474
|
+
this.store.dispatch('updateOptions', { options: { tooltip: { offsetX, offsetY } } });
|
|
475
|
+
}
|
|
476
|
+
dispatchOptionsEvent(eventName, options) {
|
|
477
|
+
this.setResizeEventListeners(eventName, options);
|
|
478
|
+
const { offsetWidth, offsetHeight } = this.containerEl;
|
|
479
|
+
this.store.dispatch(eventName, {
|
|
480
|
+
options,
|
|
481
|
+
containerSize: { width: offsetWidth, height: offsetHeight },
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import Chart from "./chart";
|
|
2
|
+
import { ColumnChartOptions, BoxSeriesData, BoxSeriesDataType, BoxSeriesInput } from "../../types/options";
|
|
3
|
+
import { ColumnChartProps, SelectSeriesInfo } from "../../types/charts";
|
|
4
|
+
/**
|
|
5
|
+
* @class
|
|
6
|
+
* @classdesc Column Chart
|
|
7
|
+
* @param {Object} props
|
|
8
|
+
* @param {HTMLElement} props.el - The target element to create chart.
|
|
9
|
+
* @param {Object} props.data - Data for making Column Chart.
|
|
10
|
+
* @param {Array<string>} props.data.categories - Categories.
|
|
11
|
+
* @param {Array<Object>} props.data.series - Series data.
|
|
12
|
+
* @param {string} props.data.series.name - Series name.
|
|
13
|
+
* @param {string} props.data.series.colorByCategories - Paint Rect with color based on categories.
|
|
14
|
+
* @param {Array<number|Array<number>>} props.data.series.data - Series data.
|
|
15
|
+
* @param {Object} [props.options] - Options for making Column Chart.
|
|
16
|
+
* @param {Object} [props.options.chart]
|
|
17
|
+
* @param {string|Object} [props.options.chart.title] - Chart title text or options.
|
|
18
|
+
* @param {string} [props.options.chart.title.text] - Chart title text.
|
|
19
|
+
* @param {number} [props.options.chart.title.offsetX] - Offset value to move title horizontally.
|
|
20
|
+
* @param {number} [props.options.chart.title.offsetY] - Offset value to move title vertically.
|
|
21
|
+
* @param {string} [props.options.chart.title.align] - Chart text align. 'left', 'right', 'center' is available.
|
|
22
|
+
* @param {boolean|Object} [props.options.chart.animation] - Whether to use animation and duration when rendering the initial chart.
|
|
23
|
+
* @param {number|string} [props.options.chart.width] - Chart width. 'auto' or if not write, the width of the parent container is followed. 'auto' or if not created, the width of the parent container is followed.
|
|
24
|
+
* @param {number|string} [props.options.chart.height] - Chart height. 'auto' or if not write, the width of the parent container is followed. 'auto' or if not created, the height of the parent container is followed.
|
|
25
|
+
* @param {Object} [props.options.series]
|
|
26
|
+
* @param {boolean} [props.options.series.selectable=false] - Whether to make selectable series or not.
|
|
27
|
+
* @param {boolean} [props.options.series.rangeSelectable=false] - Whether to use range selection feature or not.
|
|
28
|
+
* @param {number} [props.options.series.barWidth] - Bar width.
|
|
29
|
+
* @param {boolean} [props.options.series.diverging] - Whether to use diverging chart or not.
|
|
30
|
+
* @param {Object} [props.options.series.stack] - Option to use the stack chart or, if so, what type of stack to use.
|
|
31
|
+
* @param {string} [props.options.series.eventDetectType] - Event detect type. 'grouped', 'point' is available.
|
|
32
|
+
* @param {Object} [props.options.series.dataLabels] - Set the visibility, location, and formatting of dataLabel. For specific information, refer to the {@link https://github.com/nhn/tui.chart|DataLabels guide} on github.
|
|
33
|
+
* @param {boolean} [props.options.series.shift=false] - Whether to use shift when addData or not.
|
|
34
|
+
* @param {Object} [props.options.xAxis]
|
|
35
|
+
* @param {string|Object} [props.options.xAxis.title] - Axis title.
|
|
36
|
+
* @param {boolean} [props.options.xAxis.rotateLabel=true] - Whether to allow axis label rotation.
|
|
37
|
+
* @param {boolean|Object} [props.options.xAxis.date] - Whether the x axis label is of date type. Format option used for date type. Whether the x axis label is of date type. If use date type, format option used for date type.
|
|
38
|
+
* @param {Object} [props.options.xAxis.tick] - Option to adjust tick interval.
|
|
39
|
+
* @param {Object} [props.options.xAxis.label] - Option to adjust label interval.
|
|
40
|
+
* @param {Object} [props.options.xAxis.scale] - Option to adjust axis minimum, maximum, step size.
|
|
41
|
+
* @param {number} [props.options.xAxis.width] - Width of xAxis.
|
|
42
|
+
* @param {number} [props.options.xAxis.height] - Height of xAxis.
|
|
43
|
+
* @param {Object|Array<Object>} [props.options.yAxis] - If this option is an array type, use the secondary y axis.
|
|
44
|
+
* @param {string|Object} [props.options.yAxis.title] - Axis title.
|
|
45
|
+
* @param {Object} [props.options.yAxis.tick] - Option to adjust tick interval.
|
|
46
|
+
* @param {Object} [props.options.yAxis.label] - Option to adjust label interval.
|
|
47
|
+
* @param {Object} [props.options.yAxis.scale] - Option to adjust axis minimum, maximum, step size.
|
|
48
|
+
* @param {number} [props.options.yAxis.width] - Width of yAxis.
|
|
49
|
+
* @param {number} [props.options.yAxis.height] - Height of yAxis.
|
|
50
|
+
* @param {Object} [props.options.plot]
|
|
51
|
+
* @param {number} [props.options.plot.width] - Width of plot.
|
|
52
|
+
* @param {number} [props.options.plot.height] - Height of plot.
|
|
53
|
+
* @param {boolean} [props.options.plot.visible] - Whether to show plot line.
|
|
54
|
+
* @param {Object} [props.options.legend]
|
|
55
|
+
* @param {string} [props.options.legend.align] - Legend align. 'top', 'bottom', 'right', 'left' is available.
|
|
56
|
+
* @param {string} [props.options.legend.showCheckbox] - Whether to show checkbox.
|
|
57
|
+
* @param {boolean} [props.options.legend.visible] - Whether to show legend.
|
|
58
|
+
* @param {number} [props.options.legend.width] - Width of legend.
|
|
59
|
+
* @param {Object} [props.options.legend.item] - `width` and `overflow` options of the legend item. For specific information, refer to the {@link https://github.com/nhn/tui.chart|Legend guide} on github.
|
|
60
|
+
* @param {Object} [props.options.exportMenu]
|
|
61
|
+
* @param {boolean} [props.options.exportMenu.visible] - Whether to show export menu.
|
|
62
|
+
* @param {string} [props.options.exportMenu.filename] - File name applied when downloading.
|
|
63
|
+
* @param {Object} [props.options.tooltip]
|
|
64
|
+
* @param {number} [props.options.tooltip.offsetX] - Offset value to move title horizontally.
|
|
65
|
+
* @param {number} [props.options.tooltip.offsetY] - Offset value to move title vertically.
|
|
66
|
+
* @param {Function} [props.options.tooltip.formatter] - Function to format data value.
|
|
67
|
+
* @param {Function} [props.options.tooltip.template] - Function to create custom template. For specific information, refer to the {@link https://github.com/nhn/tui.chart|Tooltip guide} on github.
|
|
68
|
+
* @param {Object} [props.options.responsive] - Rules for changing chart options. For specific information, refer to the {@link https://github.com/nhn/tui.chart|Responsive guide} on github.
|
|
69
|
+
* @param {boolean|Object} [props.options.responsive.animation] - Animation duration when the chart is modified.
|
|
70
|
+
* @param {Array<Object>} [props.options.responsive.rules] - Rules for the Chart to Respond.
|
|
71
|
+
* @param {Object} [props.options.lang] - Options for changing the text displayed on the chart or i18n languages.
|
|
72
|
+
* @param {Object} [props.options.lang.noData] - No Data Layer Text.
|
|
73
|
+
* @param {Object} [props.options.theme] - Chart theme options. For specific information, refer to the {@link https://github.com/nhn/tui.chart|Bar Chart guide} on github.
|
|
74
|
+
* @param {Object} [props.options.theme.chart] - Chart font theme.
|
|
75
|
+
* @param {Object} [props.options.theme.noData] - No Data Layer Text theme.
|
|
76
|
+
* @param {Object} [props.options.theme.series] - Series theme.
|
|
77
|
+
* @param {Object} [props.options.theme.title] - Title theme.
|
|
78
|
+
* @param {Object} [props.options.theme.xAxis] - X Axis theme.
|
|
79
|
+
* @param {Object|Array<Object>} [props.options.theme.yAxis] - Y Axis theme. In the case of an arrangement, the first is the main axis and the second is the theme for the secondary axis.
|
|
80
|
+
* @param {Object} [props.options.theme.legend] - Legend theme.
|
|
81
|
+
* @param {Object} [props.options.theme.tooltip] - Tooltip theme.
|
|
82
|
+
* @param {Object} [props.options.theme.plot] - Plot theme.
|
|
83
|
+
* @param {Object} [props.options.theme.exportMenu] - ExportMenu theme.
|
|
84
|
+
* @extends Chart
|
|
85
|
+
*/
|
|
86
|
+
export default class ColumnChart extends Chart<ColumnChartOptions> {
|
|
87
|
+
constructor({ el, options, data }: ColumnChartProps);
|
|
88
|
+
protected initialize(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Add data.
|
|
91
|
+
* @param {Array<number|Array<number>>} data - Array of data to be added
|
|
92
|
+
* @param {string} category - Category to be added
|
|
93
|
+
* @api
|
|
94
|
+
* @example
|
|
95
|
+
* chart.addData([10, 20], '6');
|
|
96
|
+
*/
|
|
97
|
+
addData(data: BoxSeriesDataType[], category: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Add series.
|
|
100
|
+
* @param {Object} data - Data to be added
|
|
101
|
+
* @param {string} data.name - Series name
|
|
102
|
+
* @param {Array<number|Array<number>>} data.data - Array of data to be added
|
|
103
|
+
* @api
|
|
104
|
+
* @example
|
|
105
|
+
* chart.addSeries({
|
|
106
|
+
* name: 'newSeries',
|
|
107
|
+
* data: [10, 100, 50, 40, 70, 55, 33, 70, 90, 110],
|
|
108
|
+
* });
|
|
109
|
+
*/
|
|
110
|
+
addSeries(data: BoxSeriesInput<BoxSeriesDataType>): void;
|
|
111
|
+
/**
|
|
112
|
+
* Convert the chart data to new data.
|
|
113
|
+
* @param {Object} data - Data to be set
|
|
114
|
+
* @api
|
|
115
|
+
* @example
|
|
116
|
+
* chart.setData({
|
|
117
|
+
* categories: ['1', '2', '3'],
|
|
118
|
+
* series: [
|
|
119
|
+
* {
|
|
120
|
+
* name: 'new series',
|
|
121
|
+
* data: [1, 2, 3],
|
|
122
|
+
* },
|
|
123
|
+
* {
|
|
124
|
+
* name: 'new series2',
|
|
125
|
+
* data: [4, 5, 6],
|
|
126
|
+
* }
|
|
127
|
+
* ]
|
|
128
|
+
* });
|
|
129
|
+
*/
|
|
130
|
+
setData(data: BoxSeriesData): void;
|
|
131
|
+
/**
|
|
132
|
+
* Hide series data label.
|
|
133
|
+
* @api
|
|
134
|
+
* @example
|
|
135
|
+
* chart.hideSeriesDataLabel();
|
|
136
|
+
*/
|
|
137
|
+
hideSeriesDataLabel(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Show series data label.
|
|
140
|
+
* @api
|
|
141
|
+
* @example
|
|
142
|
+
* chart.showSeriesDataLabel();
|
|
143
|
+
*/
|
|
144
|
+
showSeriesDataLabel(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Convert the chart options to new options.
|
|
147
|
+
* @param {Object} options - Chart options
|
|
148
|
+
* @api
|
|
149
|
+
* @example
|
|
150
|
+
* chart.setOptions({
|
|
151
|
+
* chart: {
|
|
152
|
+
* width: 500,
|
|
153
|
+
* height: 'auto',
|
|
154
|
+
* title: 'Energy Usage',
|
|
155
|
+
* },
|
|
156
|
+
* xAxis: {
|
|
157
|
+
* title: 'Month',
|
|
158
|
+
* date: { format: 'yy/MM' },
|
|
159
|
+
* },
|
|
160
|
+
* yAxis: {
|
|
161
|
+
* title: 'Energy (kWh)',
|
|
162
|
+
* },
|
|
163
|
+
* series: {
|
|
164
|
+
* selectable: true,
|
|
165
|
+
* },
|
|
166
|
+
* tooltip: {
|
|
167
|
+
* formatter: (value) => `${value}kWh`,
|
|
168
|
+
* },
|
|
169
|
+
* });
|
|
170
|
+
*/
|
|
171
|
+
setOptions(options: ColumnChartOptions): void;
|
|
172
|
+
/**
|
|
173
|
+
* Update chart options.
|
|
174
|
+
* @param {Object} options - Chart options
|
|
175
|
+
* @api
|
|
176
|
+
* @example
|
|
177
|
+
* chart.updateOptions({
|
|
178
|
+
* chart: {
|
|
179
|
+
* height: 'auto',
|
|
180
|
+
* title: 'Energy Usage',
|
|
181
|
+
* },
|
|
182
|
+
* tooltip: {
|
|
183
|
+
* formatter: (value) => `${value}kWh`,
|
|
184
|
+
* },
|
|
185
|
+
* });
|
|
186
|
+
*/
|
|
187
|
+
updateOptions(options: ColumnChartOptions): void;
|
|
188
|
+
/**
|
|
189
|
+
* Show tooltip.
|
|
190
|
+
* @param {Object} seriesInfo - Information of the series for the tooltip to be displayed.
|
|
191
|
+
* @param {number} seriesInfo.index - Index of data within series. If 'series.eventDetectType' is "grouped", only seriesIndex is needed.
|
|
192
|
+
* @param {number} [seriesInfo.seriesIndex] - Index of series.
|
|
193
|
+
* @api
|
|
194
|
+
* @example
|
|
195
|
+
* chart.showTooltip({index: 1, seriesIndex: 2});
|
|
196
|
+
*/
|
|
197
|
+
showTooltip(seriesInfo: SelectSeriesInfo): void;
|
|
198
|
+
/**
|
|
199
|
+
* Hide tooltip.
|
|
200
|
+
* @api
|
|
201
|
+
* @example
|
|
202
|
+
* chart.hideTooltip();
|
|
203
|
+
*/
|
|
204
|
+
hideTooltip(): void;
|
|
205
|
+
}
|