sea-chart 2.0.40 → 2.0.43
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/dist/api/index.js +4 -4
- package/dist/components/cell-factory/SimpleCellFormatter.js +1 -1
- package/dist/components/cell-factory/link-content.js +4 -4
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/color-popover/color-rules/color-rule.js +1 -1
- package/dist/components/color-popover/color-rules/index.js +1 -1
- package/dist/components/color-popover/color-rules-popover.js +6 -6
- package/dist/components/color-popover/color-selector-popover.js +2 -2
- package/dist/components/color-setting/color-group-selector.js +1 -1
- package/dist/components/common-add-tool/index.js +2 -2
- package/dist/components/data-process-setter/hide-column-setter.js +1 -1
- package/dist/components/data-process-setter/sort-setter.js +2 -2
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +4 -4
- package/dist/components/icon/index.js +1 -1
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +1 -1
- package/dist/components/popover/sort-popover/sort-popover.js +1 -1
- package/dist/components/row-card/row-card-header-cell.js +2 -2
- package/dist/components/row-card/row-card-header.js +1 -1
- package/dist/components/row-card/row-card-item.js +2 -2
- package/dist/components/row-card/row-card.js +2 -2
- package/dist/components/statistic-record-dialog/index.js +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/types-dialog/index.js +9 -10
- package/dist/context.js +2 -2
- package/dist/services/map-json.js +4 -4
- package/dist/settings/basic-number-card/style-settings.js +1 -1
- package/dist/settings/map-settings/map-style-settings.js +1 -1
- package/dist/settings/stacks-settings/index.js +1 -1
- package/dist/settings/style-settings.js +1 -1
- package/dist/settings/table-settings/data-settings.js +1 -1
- package/dist/settings/trend-settings/style-setting.js +2 -2
- package/dist/settings/widgets/date-summary-item.js +2 -2
- package/dist/settings/widgets/numeric-summary-item.js +2 -2
- package/dist/settings/widgets/summary-settings.js +2 -2
- package/dist/settings/widgets/switch/index.js +1 -1
- package/dist/settings/widgets/text-horizontal-settings.js +2 -2
- package/dist/settings/widgets/y-axis-group-settings.js +1 -1
- package/dist/utils/cell-value-utils.js +1 -1
- package/dist/utils/chart-utils/base-utils.js +8 -8
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +1 -1
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +2 -2
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +1 -1
- package/dist/utils/chart-utils/sql-statistics-utils.js +8 -8
- package/dist/utils/collaborator-utils.js +1 -1
- package/dist/utils/collaborator.js +2 -2
- package/dist/utils/column-utils.js +12 -12
- package/dist/utils/common-utils.js +1 -1
- package/dist/utils/date-translate.js +1 -1
- package/dist/utils/object-utils.js +1 -1
- package/dist/utils/options-utils.js +2 -2
- package/dist/utils/row-record-utils.js +2 -2
- package/dist/utils/sql/chart-data-sql.js +58 -58
- package/dist/utils/sql/column-2-sql-column.js +18 -18
- package/dist/view/index.js +2 -2
- package/dist/view/title/index.js +2 -2
- package/dist/view/wrapper/area-group.js +3 -3
- package/dist/view/wrapper/area.js +6 -5
- package/dist/view/wrapper/bar-compare.js +4 -4
- package/dist/view/wrapper/bar-custom-stack.js +4 -4
- package/dist/view/wrapper/bar-group.js +8 -4
- package/dist/view/wrapper/bar-stack.js +3 -3
- package/dist/view/wrapper/bar.js +2 -2
- package/dist/view/wrapper/basic-number-card.js +8 -8
- package/dist/view/wrapper/chart-component.js +45 -44
- package/dist/view/wrapper/combination.js +6 -6
- package/dist/view/wrapper/completeness-group.js +7 -7
- package/dist/view/wrapper/completeness.js +4 -4
- package/dist/view/wrapper/dashboard.js +12 -9
- package/dist/view/wrapper/funnel.js +7 -2
- package/dist/view/wrapper/heat-map.js +8 -8
- package/dist/view/wrapper/horizontal-bar-group.js +7 -5
- package/dist/view/wrapper/horizontal-bar-stack.js +4 -4
- package/dist/view/wrapper/horizontal-bar.js +3 -3
- package/dist/view/wrapper/line-group.js +11 -5
- package/dist/view/wrapper/line.js +3 -3
- package/dist/view/wrapper/mirror.js +5 -5
- package/dist/view/wrapper/pie.js +4 -4
- package/dist/view/wrapper/ring.js +6 -6
- package/dist/view/wrapper/scatter.js +2 -2
- package/dist/view/wrapper/table/index.js +1 -1
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +3 -3
- package/dist/view/wrapper/table/pivot-table-display-name.js +1 -1
- package/dist/view/wrapper/table/two-dimension-table.js +9 -9
- package/dist/view/wrapper/table-element/components/formatter.js +14 -2
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +1 -1
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +17 -17
- package/dist/view/wrapper/table-element/components/link-formatter.js +17 -17
- package/dist/view/wrapper/table-element/components/record.js +3 -3
- package/dist/view/wrapper/table-element/components/records.js +4 -4
- package/dist/view/wrapper/table-element/components/utils.js +1 -1
- package/dist/view/wrapper/table-element/css/index.css +79 -0
- package/dist/view/wrapper/treemap.js +2 -2
- package/dist/view/wrapper/trend.js +18 -18
- package/package.json +2 -2
|
@@ -44,9 +44,10 @@ class Area extends _chartComponent.default {
|
|
|
44
44
|
this.drawChart = () => {
|
|
45
45
|
let {
|
|
46
46
|
result: data,
|
|
47
|
-
customRender
|
|
47
|
+
customRender,
|
|
48
|
+
chart
|
|
48
49
|
} = this.props;
|
|
49
|
-
data = _utils.BaseUtils.formatEmptyName(data,
|
|
50
|
+
data = _utils.BaseUtils.formatEmptyName(data, chart.config.column_groupby_column_key, _intl.default.get('Empty'));
|
|
50
51
|
if (!Array.isArray(data)) return;
|
|
51
52
|
this.draw(data);
|
|
52
53
|
(0, _utils.isFunction)(customRender) && customRender(this.chart);
|
|
@@ -89,12 +90,12 @@ class Area extends _chartComponent.default {
|
|
|
89
90
|
// Y axis
|
|
90
91
|
const niceEnd = d3.nice(0, d3.max(data, d => d.value), 5)[1];
|
|
91
92
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, niceEnd] : [y_axis_min || 0, y_axis_max || niceEnd]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
92
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
93
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
93
94
|
|
|
94
95
|
// X axis
|
|
95
96
|
const xDomain = data.map(item => item.name);
|
|
96
97
|
const x = d3.scaleBand().domain(xDomain).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
97
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
98
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0, ${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
98
99
|
this.ticksAddName(g);
|
|
99
100
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
100
101
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
@@ -138,7 +139,7 @@ class Area extends _chartComponent.default {
|
|
|
138
139
|
} = g.node().getBoundingClientRect();
|
|
139
140
|
const translateX = Number(curCircleEl.getAttribute('cx')) - width / 2;
|
|
140
141
|
const translateY = Number(curCircleEl.getAttribute('cy')) - 10;
|
|
141
|
-
g.attr('transform',
|
|
142
|
+
g.attr('transform', `translate(${translateX}, ${translateY})`);
|
|
142
143
|
});
|
|
143
144
|
}
|
|
144
145
|
}).on('click', (event, data) => {
|
|
@@ -68,13 +68,13 @@ class BarCompare extends _chartComponent.default {
|
|
|
68
68
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding, insertPadding]);
|
|
69
69
|
|
|
70
70
|
// Y axis
|
|
71
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
71
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _chartUtils.BaseUtils.getSummaryValueDisplayString(columnGroupbyColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
72
72
|
const fx = d3.scaleBand().domain(d3.group(data, d => d.name).keys()).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
73
73
|
const color = d3.scaleOrdinal().domain(d3.group(data, d => d.group_name).keys()).range(_chartUtils.BaseUtils.getCurrentTheme(chartColorTheme).colors).unknown('#ccc');
|
|
74
74
|
const x = d3.scaleBand().domain(d3.group(data, d => d.group_name).keys()).range([0, fx.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
75
75
|
|
|
76
76
|
// X axis
|
|
77
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
77
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0,${chartHeight - insertPadding})`).call(d3.axisBottom(fx).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
78
78
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
79
79
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
80
80
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -87,7 +87,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
87
87
|
let [name, dum] = _ref;
|
|
88
88
|
// Each group is horizontally centered
|
|
89
89
|
const offset = (fx.bandwidth() - dum.length * x.bandwidth()) / 2;
|
|
90
|
-
return
|
|
90
|
+
return `translate(${fx(name) + offset},0)`;
|
|
91
91
|
})
|
|
92
92
|
// rect item
|
|
93
93
|
.selectAll().data(_ref2 => {
|
|
@@ -254,7 +254,7 @@ class BarCompare extends _chartComponent.default {
|
|
|
254
254
|
} = g.node().getBoundingClientRect();
|
|
255
255
|
const translateX = Number(curCircleEl.getAttribute('cx')) - width / 2;
|
|
256
256
|
const translateY = Number(curCircleEl.getAttribute('cy')) - 10;
|
|
257
|
-
g.attr('transform',
|
|
257
|
+
g.attr('transform', `translate(${translateX}, ${translateY})`);
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
}).on('mouseover', event => {
|
|
@@ -154,12 +154,12 @@ class BarCustom extends _chartComponent.default {
|
|
|
154
154
|
const y = d3.scaleLinear().domain([0, niceEnd]).range([chartHeight - insertPadding, insertPadding]);
|
|
155
155
|
|
|
156
156
|
// Y axis
|
|
157
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
157
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => d)).call(g => this.drawYaxis(g, theme));
|
|
158
158
|
const fx = d3.scaleBand().domain(new Set(organizedData.map(d => d.name))).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
159
159
|
const x = d3.scaleBand().domain(new Set(data.map(d => d.y_axis_type))).range([0, fx.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
160
160
|
|
|
161
161
|
// X axis
|
|
162
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
162
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0,${chartHeight - insertPadding})`).call(d3.axisBottom(fx).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
163
163
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
164
164
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
165
165
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -172,7 +172,7 @@ class BarCustom extends _chartComponent.default {
|
|
|
172
172
|
const {
|
|
173
173
|
name
|
|
174
174
|
} = d;
|
|
175
|
-
return
|
|
175
|
+
return `translate(${fx(name)},0)`;
|
|
176
176
|
}).attr('data-transform', d => {
|
|
177
177
|
const {
|
|
178
178
|
name
|
|
@@ -282,7 +282,7 @@ class BarCustom extends _chartComponent.default {
|
|
|
282
282
|
}).on('mouseleave', (event, data) => {
|
|
283
283
|
this.hiddenTooltip();
|
|
284
284
|
this.handleStacksAcitveAndInActiveState('active', event);
|
|
285
|
-
}).append('xhtml:div').attr('class', 'stack').attr('data-rectId', rect.getAttribute('data-rectId')).attr('style',
|
|
285
|
+
}).append('xhtml:div').attr('class', 'stack').attr('data-rectId', rect.getAttribute('data-rectId')).attr('style', `width: 100%; height: 100%; background-color: ${rect.getAttribute('fill')}; border-radius: ${safeBorderRadius}px ${safeBorderRadius}px 0px 0px`);
|
|
286
286
|
|
|
287
287
|
// Remove old rect
|
|
288
288
|
d3.select(rect).remove();
|
|
@@ -101,12 +101,12 @@ class BarGroup extends _chartComponent.default {
|
|
|
101
101
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
102
102
|
|
|
103
103
|
// Y axis
|
|
104
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
104
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
105
105
|
const fx = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.25).paddingOuter(0.1);
|
|
106
106
|
const sortedData = _utils.BaseUtils.sortDataByGroupName((0, _lodashEs.cloneDeep)(data), 'group_name', columnGroupbyColumn, chart);
|
|
107
107
|
|
|
108
108
|
// X axis
|
|
109
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
109
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0,${chartHeight - insertPadding})`).call(d3.axisBottom(fx).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
110
110
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
111
111
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
112
112
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -119,13 +119,17 @@ class BarGroup extends _chartComponent.default {
|
|
|
119
119
|
const groupedData = d3.group(sortedData, d => d.name);
|
|
120
120
|
const group = contentWrapper.selectAll().data(groupedData).join('g').attr('transform', _ref => {
|
|
121
121
|
let [name] = _ref;
|
|
122
|
-
return
|
|
122
|
+
return `translate(${fx(name)},0)`;
|
|
123
123
|
});
|
|
124
124
|
group.each((_ref2, groupIndex, groupNodes) => {
|
|
125
125
|
let [, dum] = _ref2;
|
|
126
126
|
const groupNode = groupNodes[groupIndex];
|
|
127
127
|
const localX = d3.scaleBand().domain(dum.map(d => d.group_name)).range([0, fx.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
128
|
-
const rectSelection = d3.select(groupNode).selectAll('rect').data(dum).join('rect').attr('opacity', 1).attr('x', d => localX(d.group_name)).attr('y', d => y(d.value)).attr('width', localX.bandwidth()).attr('height', d => y(0) - y(d.value)).attr('fill', d =>
|
|
128
|
+
const rectSelection = d3.select(groupNode).selectAll('rect').data(dum).join('rect').attr('opacity', 1).attr('x', d => localX(d.group_name)).attr('y', d => y(d.value)).attr('width', localX.bandwidth()).attr('height', d => y(0) - y(d.value)).attr('fill', d => {
|
|
129
|
+
var _this$colorMap$colorK;
|
|
130
|
+
const colorKey = d.group_name || d.group_name === 0 ? d.group_name : '';
|
|
131
|
+
return (_this$colorMap$colorK = this.colorMap[colorKey]) !== null && _this$colorMap$colorK !== void 0 ? _this$colorMap$colorK : _constants.CHART_STYLE_COLORS[0];
|
|
132
|
+
}).attr('data-value', d => d.value).attr('data-groupName', d => d.name).attr('data-slugid', d => d.slugId);
|
|
129
133
|
const {
|
|
130
134
|
borderRadius
|
|
131
135
|
} = this.chartBoundingClientRect;
|
|
@@ -109,11 +109,11 @@ class BarStack extends _chartComponent.default {
|
|
|
109
109
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, niceEnd] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
110
110
|
|
|
111
111
|
// Y axis
|
|
112
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
112
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
113
113
|
const x = d3.scaleBand().domain(d3.group(data, d => d.name).keys()).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
114
114
|
|
|
115
115
|
// X axis
|
|
116
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
116
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0,${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
117
117
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
118
118
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
119
119
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -269,7 +269,7 @@ class BarStack extends _chartComponent.default {
|
|
|
269
269
|
}).on('mouseleave', (event, data) => {
|
|
270
270
|
this.hiddenTooltip();
|
|
271
271
|
this.handleAcitveAndInActiveState('active', event);
|
|
272
|
-
}).append('xhtml:div').attr('style',
|
|
272
|
+
}).append('xhtml:div').attr('style', `width: 100%; height: 100%; background-color: ${rect.getAttribute('fill')}; border-radius: ${xWidth * borderRadius}px ${xWidth * borderRadius}px 0px 0px`);
|
|
273
273
|
|
|
274
274
|
// Remove old rect
|
|
275
275
|
d3.select(rect).remove();
|
package/dist/view/wrapper/bar.js
CHANGED
|
@@ -165,11 +165,11 @@ class Bar extends _chartComponent.default {
|
|
|
165
165
|
const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
166
166
|
|
|
167
167
|
// Y axis
|
|
168
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform',
|
|
168
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
|
|
169
169
|
const x = d3.scaleBand().domain(data.map(item => item.name)).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
170
170
|
|
|
171
171
|
// X axis
|
|
172
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
172
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0, ${chartHeight - insertPadding})`).call(d3.axisBottom(x).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
173
173
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
174
174
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
175
175
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -146,11 +146,11 @@ class BasicNumericCard extends _react.Component {
|
|
|
146
146
|
width: '100%',
|
|
147
147
|
top: 'calc((100% - 25px)/2)',
|
|
148
148
|
transform: 'translateY(-50%)',
|
|
149
|
-
fontSize:
|
|
149
|
+
fontSize: `${font_size}px`,
|
|
150
150
|
margin: '-8px 0 2px 0',
|
|
151
|
-
textAlign:
|
|
152
|
-
fontWeight:
|
|
153
|
-
color:
|
|
151
|
+
textAlign: `${text_align}`,
|
|
152
|
+
fontWeight: `${font_weight}`,
|
|
153
|
+
color: `${font_color}`
|
|
154
154
|
}
|
|
155
155
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
156
156
|
onClick: this.handleClickNumber,
|
|
@@ -164,10 +164,10 @@ class BasicNumericCard extends _react.Component {
|
|
|
164
164
|
width: '100%',
|
|
165
165
|
bottom: '0px',
|
|
166
166
|
margin: '0',
|
|
167
|
-
transform: currentLineHeight ?
|
|
168
|
-
fontSize:
|
|
169
|
-
fontWeight:
|
|
170
|
-
textAlign:
|
|
167
|
+
transform: currentLineHeight ? `translateY(${currentLabelHeight - currentLineHeight}px)` : '',
|
|
168
|
+
fontSize: `${card_label_font_size}px`,
|
|
169
|
+
fontWeight: `${label_font_weight}`,
|
|
170
|
+
textAlign: `${label_text_align}`,
|
|
171
171
|
color: label_font_color,
|
|
172
172
|
overflow: 'hidden',
|
|
173
173
|
textOverflow: 'ellipsis',
|
|
@@ -85,7 +85,7 @@ class ChartComponent extends _react.Component {
|
|
|
85
85
|
width,
|
|
86
86
|
height
|
|
87
87
|
} = this.chartBoundingClientRect;
|
|
88
|
-
this.chart.append('defs').append('mask').attr('id',
|
|
88
|
+
this.chart.append('defs').append('mask').attr('id', `mask-wrapper-${previewType}-${this.chart.node().id}`).append('rect').attr('x', 0).attr('y', 0).attr('width', width).attr('height', height - 30).attr('fill', 'white');
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
this.getChartDisplayLabels = (containerWidth, minItemWidth, charts) => {
|
|
@@ -248,8 +248,8 @@ class ChartComponent extends _react.Component {
|
|
|
248
248
|
this.globalTheme === _constants.THEME_NAME_MAP.DARK ? textColor = '#fff' : textColor = '#999';
|
|
249
249
|
|
|
250
250
|
// xAxis
|
|
251
|
-
const xAxisID =
|
|
252
|
-
const xLabel = chartContainer === null || chartContainer === void 0 ? void 0 : chartContainer.querySelector(
|
|
251
|
+
const xAxisID = `chart-x-axis-label_${chart.id}`;
|
|
252
|
+
const xLabel = chartContainer === null || chartContainer === void 0 ? void 0 : chartContainer.querySelector(`#${xAxisID}`);
|
|
253
253
|
const {
|
|
254
254
|
width: containerWidth
|
|
255
255
|
} = this.chartBoundingClientRect;
|
|
@@ -258,20 +258,20 @@ class ChartComponent extends _react.Component {
|
|
|
258
258
|
div.id = xAxisID;
|
|
259
259
|
div.className = 'chart-axis-label';
|
|
260
260
|
const column = (0, _dtableUtils.getTableColumnByKey)(table, x_axis_column_key);
|
|
261
|
-
div.innerHTML =
|
|
262
|
-
div.setAttribute('style',
|
|
261
|
+
div.innerHTML = `${column ? column.name : ''}`;
|
|
262
|
+
div.setAttribute('style', `color:${textColor}; width: ${containerWidth}px; text-align: ${x_axis_label_position}; position: absolute; bottom: 0;`);
|
|
263
263
|
chartContainer.appendChild(div);
|
|
264
264
|
}
|
|
265
265
|
if (xLabel && x_axis_show_label) {
|
|
266
|
-
xLabel.setAttribute('style',
|
|
266
|
+
xLabel.setAttribute('style', `color:${textColor}; width: ${containerWidth}px; text-align: ${x_axis_label_position}; position: absolute; bottom: 0;`);
|
|
267
267
|
}
|
|
268
268
|
if (xLabel && !x_axis_show_label) {
|
|
269
269
|
xLabel.parentNode.removeChild(xLabel);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
// yAxis
|
|
273
|
-
const yAxisID =
|
|
274
|
-
const yLabel = chartContainer.querySelector(
|
|
273
|
+
const yAxisID = `chart-y-axis-label_${chart.id}`;
|
|
274
|
+
const yLabel = chartContainer.querySelector(`#${yAxisID}`);
|
|
275
275
|
const divHeight = 20;
|
|
276
276
|
if (!yLabel && y_axis_show_label) {
|
|
277
277
|
const div = document.createElement('div');
|
|
@@ -293,7 +293,7 @@ class ChartComponent extends _react.Component {
|
|
|
293
293
|
let textAlign = 'center';
|
|
294
294
|
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
295
295
|
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
296
|
-
div.setAttribute('style',
|
|
296
|
+
div.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: translate(-${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
297
297
|
chartContainer.appendChild(div);
|
|
298
298
|
}
|
|
299
299
|
if (yLabel && y_axis_show_label) {
|
|
@@ -303,15 +303,15 @@ class ChartComponent extends _react.Component {
|
|
|
303
303
|
let textAlign = 'center';
|
|
304
304
|
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
305
305
|
if (y_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
306
|
-
yLabel.setAttribute('style',
|
|
306
|
+
yLabel.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: translate(-${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
307
307
|
}
|
|
308
308
|
if (yLabel && !y_axis_show_label) {
|
|
309
309
|
yLabel.parentNode.removeChild(yLabel);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// yAxis(left) - combination chart
|
|
313
|
-
const yAxisLeftID =
|
|
314
|
-
const yAxisLeftLabel = chartContainer.querySelector(
|
|
313
|
+
const yAxisLeftID = `chart-y-axis-left-label_${chart.id}`;
|
|
314
|
+
const yAxisLeftLabel = chartContainer.querySelector(`#${yAxisLeftID}`);
|
|
315
315
|
if (!yAxisLeftLabel && show_y_axis_left_label) {
|
|
316
316
|
const div = document.createElement('div');
|
|
317
317
|
div.id = yAxisLeftID;
|
|
@@ -326,7 +326,7 @@ class ChartComponent extends _react.Component {
|
|
|
326
326
|
let textAlign = 'center';
|
|
327
327
|
if (y_axis_left_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
328
328
|
if (y_axis_left_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
329
|
-
div.setAttribute('style',
|
|
329
|
+
div.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: translate(-${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
330
330
|
chartContainer.appendChild(div);
|
|
331
331
|
}
|
|
332
332
|
if (yAxisLeftLabel && show_y_axis_left_label) {
|
|
@@ -334,15 +334,15 @@ class ChartComponent extends _react.Component {
|
|
|
334
334
|
let textAlign = 'center';
|
|
335
335
|
if (y_axis_left_label_position === 'bottom') textAlign = 'left';
|
|
336
336
|
if (y_axis_left_label_position === 'top') textAlign = 'right';
|
|
337
|
-
yAxisLeftLabel.setAttribute('style',
|
|
337
|
+
yAxisLeftLabel.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: translate(-${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
338
338
|
}
|
|
339
339
|
if (yAxisLeftLabel && !show_y_axis_left_label) {
|
|
340
340
|
yAxisLeftLabel.parentNode.removeChild(yAxisLeftLabel);
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
// yAxis(right) - combination chart
|
|
344
|
-
const yAxisRightID =
|
|
345
|
-
const yAxisRightLabel = chartContainer.querySelector(
|
|
344
|
+
const yAxisRightID = `chart-y-axis-right-label_${chart.id}`;
|
|
345
|
+
const yAxisRightLabel = chartContainer.querySelector(`#${yAxisRightID}`);
|
|
346
346
|
if (!yAxisRightLabel && show_y_axis_right_label) {
|
|
347
347
|
const div = document.createElement('div');
|
|
348
348
|
div.id = yAxisRightID;
|
|
@@ -357,7 +357,7 @@ class ChartComponent extends _react.Component {
|
|
|
357
357
|
let textAlign = 'center';
|
|
358
358
|
if (y_axis_right_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
359
359
|
if (y_axis_right_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
360
|
-
div.setAttribute('style',
|
|
360
|
+
div.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; right: 0; transform: translate(${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
361
361
|
chartContainer.appendChild(div);
|
|
362
362
|
}
|
|
363
363
|
if (yAxisRightLabel && show_y_axis_right_label) {
|
|
@@ -365,7 +365,7 @@ class ChartComponent extends _react.Component {
|
|
|
365
365
|
let textAlign = 'center';
|
|
366
366
|
if (y_axis_right_label_position === 'bottom') textAlign = 'left';
|
|
367
367
|
if (y_axis_right_label_position === 'top') textAlign = 'right';
|
|
368
|
-
yAxisRightLabel.setAttribute('style',
|
|
368
|
+
yAxisRightLabel.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; right: 0; transform: translate(${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
369
369
|
}
|
|
370
370
|
if (yAxisRightLabel && !show_y_axis_right_label) {
|
|
371
371
|
yAxisRightLabel.parentNode.removeChild(yAxisRightLabel);
|
|
@@ -385,8 +385,8 @@ class ChartComponent extends _react.Component {
|
|
|
385
385
|
} = chart.config;
|
|
386
386
|
const table = (0, _dtableUtils.getTableById)(tables, table_id);
|
|
387
387
|
const textColor = '#999999';
|
|
388
|
-
const xAxisID =
|
|
389
|
-
const xLabel = chartContainer.querySelector(
|
|
388
|
+
const xAxisID = `chart-x-axis-label_${chart.id}`;
|
|
389
|
+
const xLabel = chartContainer.querySelector(`#${xAxisID}`);
|
|
390
390
|
const {
|
|
391
391
|
width: containerWidth
|
|
392
392
|
} = this.chartBoundingClientRect;
|
|
@@ -398,19 +398,19 @@ class ChartComponent extends _react.Component {
|
|
|
398
398
|
div.innerHTML = _intl.default.get('Amount');
|
|
399
399
|
} else {
|
|
400
400
|
const column = (0, _dtableUtils.getTableColumnByKey)(table, horizontal_axis_column_key);
|
|
401
|
-
div.innerHTML =
|
|
401
|
+
div.innerHTML = `${column ? column.name : ''}`;
|
|
402
402
|
}
|
|
403
|
-
div.setAttribute('style',
|
|
403
|
+
div.setAttribute('style', `color:${textColor}; width: ${containerWidth}px; text-align: ${horizontal_axis_label_position}; position: absolute`);
|
|
404
404
|
chartContainer.appendChild(div);
|
|
405
405
|
}
|
|
406
406
|
if (xLabel && show_horizontal_axis_label) {
|
|
407
|
-
xLabel.setAttribute('style',
|
|
407
|
+
xLabel.setAttribute('style', `color:${textColor}; width: ${containerWidth}px; text-align: ${horizontal_axis_label_position}; position: absolute`);
|
|
408
408
|
}
|
|
409
409
|
if (xLabel && !show_horizontal_axis_label) {
|
|
410
410
|
xLabel.parentNode.removeChild(xLabel);
|
|
411
411
|
}
|
|
412
|
-
const yAxisID =
|
|
413
|
-
const yLabel = chartContainer.querySelector(
|
|
412
|
+
const yAxisID = `chart-y-axis-label_${chart.id}`;
|
|
413
|
+
const yLabel = chartContainer.querySelector(`#${yAxisID}`);
|
|
414
414
|
const divHeight = 20;
|
|
415
415
|
if (!yLabel && show_vertical_axis_label) {
|
|
416
416
|
const div = document.createElement('div');
|
|
@@ -424,7 +424,7 @@ class ChartComponent extends _react.Component {
|
|
|
424
424
|
let textAlign = 'center';
|
|
425
425
|
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
426
426
|
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
427
|
-
div.setAttribute('style',
|
|
427
|
+
div.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: translate(-${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
428
428
|
chartContainer.appendChild(div);
|
|
429
429
|
}
|
|
430
430
|
if (yLabel && show_horizontal_axis_label) {
|
|
@@ -434,7 +434,7 @@ class ChartComponent extends _react.Component {
|
|
|
434
434
|
let textAlign = 'center';
|
|
435
435
|
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.BOTTOM) textAlign = 'left';
|
|
436
436
|
if (vertical_axis_label_position === _constants.LABEL_POSITION_TYPE.TOP) textAlign = 'right';
|
|
437
|
-
yLabel.setAttribute('style',
|
|
437
|
+
yLabel.setAttribute('style', `color:${textColor}; position: absolute; width: ${containerHeight}px; height: ${divHeight}px; text-align: ${textAlign}; top: 0; left: 0; transform: translate(-${containerHeight / 2 - divHeight / 2}px, ${containerHeight / 2 - divHeight / 2}px) rotate(-90deg)`);
|
|
438
438
|
}
|
|
439
439
|
if (yLabel && !show_horizontal_axis_label) {
|
|
440
440
|
yLabel.parentNode.removeChild(yLabel);
|
|
@@ -509,7 +509,7 @@ class ChartComponent extends _react.Component {
|
|
|
509
509
|
if (groupsData.length === 1) {
|
|
510
510
|
curTranslateX = (chartWidth - width - insertPadding * 2) / 2;
|
|
511
511
|
}
|
|
512
|
-
legendWrapper.attr('transform',
|
|
512
|
+
legendWrapper.attr('transform', `translate(${curTranslateX},${curTranslateY})`);
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
|
|
@@ -532,7 +532,7 @@ class ChartComponent extends _react.Component {
|
|
|
532
532
|
const pageNavigator = legendWrapper.append('g').attr('class', 'legend-flip-page');
|
|
533
533
|
|
|
534
534
|
// count
|
|
535
|
-
pageNavigator.append('text').attr('class', 'legend-count').attr('x', 15).attr('y', legendItemTextPaddingTop).attr('fill', theme.legendTextColor).attr('font-size', theme.legendFontSize).text(
|
|
535
|
+
pageNavigator.append('text').attr('class', 'legend-count').attr('x', 15).attr('y', legendItemTextPaddingTop).attr('fill', theme.legendTextColor).attr('font-size', theme.legendFontSize).text(`${curCount + 1}/${groupsData.length}`);
|
|
536
536
|
|
|
537
537
|
// prev page
|
|
538
538
|
pageNavigator.append('polygon').attr('class', 'legend-prev-page').attr('points', this.calcEquilateralTriangle(5, 8, 12)).attr('fill', theme.legendPageNavigatorMarkerColor).attr('opacity', curCount === 0 ? 0.45 : 1).attr('style', 'cursor: pointer;').on('click', event => {
|
|
@@ -543,7 +543,7 @@ class ChartComponent extends _react.Component {
|
|
|
543
543
|
groupData: groupsData[curCount],
|
|
544
544
|
colorScale,
|
|
545
545
|
theme,
|
|
546
|
-
text:
|
|
546
|
+
text: `${curCount + 1}/${groupsData.length}`
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
});
|
|
@@ -557,7 +557,7 @@ class ChartComponent extends _react.Component {
|
|
|
557
557
|
groupData: groupsData[curCount],
|
|
558
558
|
colorScale,
|
|
559
559
|
theme,
|
|
560
|
-
text:
|
|
560
|
+
text: `${curCount + 1}/${groupsData.length}`
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
});
|
|
@@ -582,7 +582,7 @@ class ChartComponent extends _react.Component {
|
|
|
582
582
|
} = g.node().parentNode.getBoundingClientRect();
|
|
583
583
|
groupTranslateY = groupTranslateY + height + legendItemMargin;
|
|
584
584
|
}
|
|
585
|
-
g.attr('transform',
|
|
585
|
+
g.attr('transform', `translate(${groupTranslateX},${groupTranslateY})`);
|
|
586
586
|
});
|
|
587
587
|
}
|
|
588
588
|
};
|
|
@@ -654,7 +654,7 @@ class ChartComponent extends _react.Component {
|
|
|
654
654
|
const prevTranslateY = Number(prevItem.getAttribute('data-translateY'));
|
|
655
655
|
translateY = prevTranslateY + height + legendItemMargin;
|
|
656
656
|
}
|
|
657
|
-
d3.select(item).attr('transform',
|
|
657
|
+
d3.select(item).attr('transform', `translate(${start},${translateY})`).attr('data-translateY', translateY);
|
|
658
658
|
});
|
|
659
659
|
} else {
|
|
660
660
|
// update g translateX
|
|
@@ -668,7 +668,7 @@ class ChartComponent extends _react.Component {
|
|
|
668
668
|
const prevTranslateX = Number(prevItem.getAttribute('data-translateX'));
|
|
669
669
|
translateX = prevTranslateX + width + legendItemMargin;
|
|
670
670
|
}
|
|
671
|
-
d3.select(item).attr('transform',
|
|
671
|
+
d3.select(item).attr('transform', `translate(${translateX},0)`).attr('data-translateX', translateX);
|
|
672
672
|
|
|
673
673
|
// legend items add offset
|
|
674
674
|
if (legendPosition === 'top-right') {
|
|
@@ -815,7 +815,7 @@ class ChartComponent extends _react.Component {
|
|
|
815
815
|
const offset = end - (endTranslateX + endWidth);
|
|
816
816
|
legendItems.forEach(legendItem => {
|
|
817
817
|
const curTranslateX = Number(legendItem.getAttribute('data-translateX')) + offset;
|
|
818
|
-
d3.select(legendItem).attr('transform',
|
|
818
|
+
d3.select(legendItem).attr('transform', `translate(${curTranslateX}, 0)`).attr('data-translateX', curTranslateX);
|
|
819
819
|
d3.select(legendItem).attr('opacity', 1);
|
|
820
820
|
});
|
|
821
821
|
};
|
|
@@ -864,8 +864,9 @@ class ChartComponent extends _react.Component {
|
|
|
864
864
|
colors = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors;
|
|
865
865
|
}
|
|
866
866
|
const colorMap = newData.reduce((acc, cur) => {
|
|
867
|
-
|
|
868
|
-
|
|
867
|
+
const key = cur[groupName] || cur[groupName] === 0 ? cur[groupName] : '';
|
|
868
|
+
if (!acc.hasOwnProperty(key)) {
|
|
869
|
+
acc[key] = colors[currentIdx++ % colors.length];
|
|
869
870
|
}
|
|
870
871
|
return acc;
|
|
871
872
|
}, {});
|
|
@@ -996,7 +997,7 @@ class ChartComponent extends _react.Component {
|
|
|
996
997
|
const {
|
|
997
998
|
width: chartWidth
|
|
998
999
|
} = this.chartBoundingClientRect;
|
|
999
|
-
const annotationWrapper = this.chart.append('g').attr('class',
|
|
1000
|
+
const annotationWrapper = this.chart.append('g').attr('class', `annotation-wrapper`);
|
|
1000
1001
|
annotationWrapper.append('line').attr('stroke', '#aaa').attr('x1', insertPadding).attr('y1', yScale(goal_value)).attr('x2', chartWidth - insertPadding).attr('y2', yScale(goal_value)).attr('stroke-dasharray', '8,3').call(g => {
|
|
1001
1002
|
annotationWrapper.append('text').attr('x', chartWidth - insertPadding - 30).attr('y', yScale(goal_value) - 10).attr('fill', '#666').text(goal_label);
|
|
1002
1003
|
});
|
|
@@ -1063,7 +1064,7 @@ class ChartComponent extends _react.Component {
|
|
|
1063
1064
|
if (chartType === _constants.CHART_TYPE.BAR_STACK) {
|
|
1064
1065
|
translateY = translateY;
|
|
1065
1066
|
}
|
|
1066
|
-
g.attr('transform',
|
|
1067
|
+
g.attr('transform', `translate(${translateX}, ${translateY})`);
|
|
1067
1068
|
});
|
|
1068
1069
|
};
|
|
1069
1070
|
this.setActiveAndInActiveState = (state, allGroup, curGroupName, chartType) => {
|
|
@@ -1123,7 +1124,7 @@ class ChartComponent extends _react.Component {
|
|
|
1123
1124
|
}
|
|
1124
1125
|
const clipPath = d3.select(parentNode).append('clipPath').attr('opacity', 1).attr('id', rectId);
|
|
1125
1126
|
clipPath.node().appendChild(clipRect.node());
|
|
1126
|
-
d3.select(rect).attr('clip-path',
|
|
1127
|
+
d3.select(rect).attr('clip-path', `url(#${rectId})`);
|
|
1127
1128
|
};
|
|
1128
1129
|
this.drawYaxis = function (g, theme) {
|
|
1129
1130
|
let rightAxisOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
@@ -1144,7 +1145,7 @@ class ChartComponent extends _react.Component {
|
|
|
1144
1145
|
g.selectAll('.tick line').clone().attr('x2', chartWidth - insertPadding * 2 - _this.horizontalOverflowOffset - rightAxisOffset).attr('stroke', theme.gridColor).attr('stroke-dasharray', '8,3');
|
|
1145
1146
|
|
|
1146
1147
|
// update g translateX
|
|
1147
|
-
g.attr('transform',
|
|
1148
|
+
g.attr('transform', `translate(${insertPadding + _this.horizontalOverflowOffset}, 0)`);
|
|
1148
1149
|
};
|
|
1149
1150
|
this.checkTextOverflow = allTextEl => {
|
|
1150
1151
|
const {
|
|
@@ -1235,8 +1236,8 @@ class ChartComponent extends _react.Component {
|
|
|
1235
1236
|
} = g.node().getBoundingClientRect();
|
|
1236
1237
|
if (isRoateText && width > insertPadding) {
|
|
1237
1238
|
const viewWidth = viewBox[viewBox.length - 2];
|
|
1238
|
-
viewBox[0] =
|
|
1239
|
-
viewBox[viewBox.length - 2] =
|
|
1239
|
+
viewBox[0] = `-${width - insertPadding}`;
|
|
1240
|
+
viewBox[viewBox.length - 2] = `${Number(viewWidth) + (width - insertPadding)}`;
|
|
1240
1241
|
queueMicrotask(() => {
|
|
1241
1242
|
if (!this.chart) return;
|
|
1242
1243
|
this.chart.attr('viewBox', viewBox.join(','));
|
|
@@ -1269,7 +1270,7 @@ class ChartComponent extends _react.Component {
|
|
|
1269
1270
|
} = g.node().getBoundingClientRect();
|
|
1270
1271
|
if (height > insertPadding) {
|
|
1271
1272
|
const viewHeight = viewBox[viewBox.length - 1];
|
|
1272
|
-
viewBox[viewBox.length - 1] =
|
|
1273
|
+
viewBox[viewBox.length - 1] = `${Number(viewHeight) + (height - insertPadding)}`;
|
|
1273
1274
|
queueMicrotask(() => {
|
|
1274
1275
|
if (!this.chart) return;
|
|
1275
1276
|
this.chart.attr('viewBox', viewBox.join(','));
|
|
@@ -112,7 +112,7 @@ class Combination extends _chartComponent.default {
|
|
|
112
112
|
const rightY = d3.scaleLinear().domain(y_axis_auto_range_right ? [d3.min(data, d => d.value_right), rightNiceEnd] : [y_axis_min_right, y_axis_max_right]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
113
113
|
|
|
114
114
|
// Y axis (right)
|
|
115
|
-
const rightAxisWrapper = this.chart.append('g').attr('class', 'y-axis-wrapper-right').attr('transform',
|
|
115
|
+
const rightAxisWrapper = this.chart.append('g').attr('class', 'y-axis-wrapper-right').attr('transform', `translate(${chartWidth - insertPadding},0)`).call(d3.axisRight(rightY).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(rightSummaryColumn, d, y_axis_right_summary_column))).call(g => {
|
|
116
116
|
g.select('.domain').remove();
|
|
117
117
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
118
118
|
g.selectAll('text').attr('fill', theme.textColor);
|
|
@@ -122,12 +122,12 @@ class Combination extends _chartComponent.default {
|
|
|
122
122
|
const leftY = d3.scaleLinear().domain(y_axis_auto_range_left ? [0, leftNiceEnd] : [y_axis_min_left, y_axis_max_left]).range([chartHeight - insertPadding, insertPadding + marginTop]);
|
|
123
123
|
|
|
124
124
|
// Y axis (left)
|
|
125
|
-
this.chart.append('g').attr('class', 'y-axis-wrapper-left').attr('transform',
|
|
125
|
+
this.chart.append('g').attr('class', 'y-axis-wrapper-left').attr('transform', `translate(${insertPadding},0)`).call(d3.axisLeft(leftY).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(leftSummaryColumn, d, y_axis_left_summary_method))).call(g => this.drawYaxis(g, theme, rightAxisOffset));
|
|
126
126
|
const fx = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding - rightAxisOffset]).paddingInner(0.5).paddingOuter(0.1);
|
|
127
127
|
const x = d3.scaleBand().domain(y_axis_left_group_by_multiple_numeric_column ? new Set(data.map(d => d.group_name)) : new Set([data[0]])).range([0, fx.bandwidth()]).paddingInner(y_axis_left_group_by_multiple_numeric_column ? 0.2 : 0).paddingOuter(0);
|
|
128
128
|
|
|
129
129
|
// X axis
|
|
130
|
-
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform',
|
|
130
|
+
this.chart.append('g').attr('class', 'x-axis-wrapper').attr('transform', `translate(0,${chartHeight - insertPadding})`).call(d3.axisBottom(fx).tickSizeOuter(0).tickSizeInner(5)).call(g => {
|
|
131
131
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
132
132
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
133
133
|
g.selectAll('text').attr('font-size', theme.fontSize);
|
|
@@ -138,7 +138,7 @@ class Combination extends _chartComponent.default {
|
|
|
138
138
|
// Rect group
|
|
139
139
|
this.chart.append('g').attr('class', 'content-wrapper').selectAll().data(d3.group(data, d => d.name)).join('g').attr('transform', _ref => {
|
|
140
140
|
let [name, dum] = _ref;
|
|
141
|
-
return
|
|
141
|
+
return `translate(${fx(name)},0)`;
|
|
142
142
|
})
|
|
143
143
|
// rect item
|
|
144
144
|
.selectAll().data(_ref2 => {
|
|
@@ -221,7 +221,7 @@ class Combination extends _chartComponent.default {
|
|
|
221
221
|
let offset = 0;
|
|
222
222
|
if (rightAxisWidth > insertPadding) {
|
|
223
223
|
offset = rightAxisWidth - insertPadding;
|
|
224
|
-
rightAxisWrapper.attr('transform',
|
|
224
|
+
rightAxisWrapper.attr('transform', `translate(${chartWidth - insertPadding - offset},0)`);
|
|
225
225
|
return offset;
|
|
226
226
|
}
|
|
227
227
|
return offset;
|
|
@@ -328,7 +328,7 @@ class Combination extends _chartComponent.default {
|
|
|
328
328
|
} = g.node().getBoundingClientRect();
|
|
329
329
|
const translateX = Number(curCircleEl.getAttribute('cx')) - width / 2;
|
|
330
330
|
const translateY = Number(curCircleEl.getAttribute('cy')) - 10;
|
|
331
|
-
g.attr('transform',
|
|
331
|
+
g.attr('transform', `translate(${translateX}, ${translateY})`);
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
334
|
}).on('mouseover', event => {
|