sea-chart 2.0.15 → 2.0.17
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/components/tooltip/index.js +1 -1
- package/dist/components/types-dialog/index.js +1 -1
- package/dist/view/wrapper/area-group.js +423 -0
- package/dist/view/wrapper/area.js +400 -0
- package/dist/view/wrapper/bar-compare.js +4 -4
- package/dist/view/wrapper/bar-custom-stack.js +2 -2
- package/dist/view/wrapper/bar-group.js +5 -47
- package/dist/view/wrapper/bar-stack.js +1 -1
- package/dist/view/wrapper/bar.js +1 -1
- package/dist/view/wrapper/chart-component.js +129 -59
- package/dist/view/wrapper/completeness-group.js +2 -2
- package/dist/view/wrapper/completeness.js +1 -1
- package/dist/view/wrapper/horizontal-bar-group.js +2 -2
- package/dist/view/wrapper/horizontal-bar-stack.js +1 -1
- package/dist/view/wrapper/horizontal-bar.js +1 -1
- package/dist/view/wrapper/index.js +28 -0
- package/dist/view/wrapper/line-group.js +1 -1
- package/dist/view/wrapper/line.js +5 -5
- package/dist/view/wrapper/pie.js +275 -0
- package/dist/view/wrapper/ring.js +328 -0
- package/package.json +1 -1
|
@@ -258,11 +258,11 @@ class ChartComponent extends _react.Component {
|
|
|
258
258
|
div.className = 'chart-axis-label';
|
|
259
259
|
const column = (0, _dtableUtils.getTableColumnByKey)(table, x_axis_column_key);
|
|
260
260
|
div.innerHTML = "".concat(column ? column.name : '');
|
|
261
|
-
div.setAttribute('style', "color:".concat(textColor, "; width: ").concat(containerWidth, "px; text-align: ").concat(x_axis_label_position, "; position: absolute"));
|
|
261
|
+
div.setAttribute('style', "color:".concat(textColor, "; width: ").concat(containerWidth, "px; text-align: ").concat(x_axis_label_position, "; position: absolute; bottom: 0;"));
|
|
262
262
|
chartContainer.appendChild(div);
|
|
263
263
|
}
|
|
264
264
|
if (xLabel && x_axis_show_label) {
|
|
265
|
-
xLabel.setAttribute('style', "color:".concat(textColor, "; width: ").concat(containerWidth, "px; text-align: ").concat(x_axis_label_position, "; position: absolute"));
|
|
265
|
+
xLabel.setAttribute('style', "color:".concat(textColor, "; width: ").concat(containerWidth, "px; text-align: ").concat(x_axis_label_position, "; position: absolute; bottom: 0;"));
|
|
266
266
|
}
|
|
267
267
|
if (xLabel && !x_axis_show_label) {
|
|
268
268
|
xLabel.parentNode.removeChild(xLabel);
|
|
@@ -605,6 +605,7 @@ class ChartComponent extends _react.Component {
|
|
|
605
605
|
legendItemMargin: 20,
|
|
606
606
|
legendRecTextGap: 8,
|
|
607
607
|
legendPageNavWrapperWidth: 100,
|
|
608
|
+
legendPageNavWrapperHeight: 18,
|
|
608
609
|
legendPosition,
|
|
609
610
|
legendName,
|
|
610
611
|
theme
|
|
@@ -616,7 +617,8 @@ class ChartComponent extends _react.Component {
|
|
|
616
617
|
}
|
|
617
618
|
const {
|
|
618
619
|
width: chartWidth,
|
|
619
|
-
insertPadding
|
|
620
|
+
insertPadding,
|
|
621
|
+
rightLegendSpace
|
|
620
622
|
} = this.chartBoundingClientRect;
|
|
621
623
|
const groupsData = this.getLegendDataGroups(legendData);
|
|
622
624
|
const legendWrapper = this.chart.append('g').attr('class', "legend-wrapper-".concat((_this$chart$node = this.chart.node()) === null || _this$chart$node === void 0 ? void 0 : _this$chart$node.id));
|
|
@@ -632,7 +634,8 @@ class ChartComponent extends _react.Component {
|
|
|
632
634
|
// Render Page navigator
|
|
633
635
|
if (groupsData.length > 1) {
|
|
634
636
|
const {
|
|
635
|
-
legendPageNavWrapperWidth
|
|
637
|
+
legendPageNavWrapperWidth,
|
|
638
|
+
legendItemMargin
|
|
636
639
|
} = this.legendConfig;
|
|
637
640
|
let curCount = 0;
|
|
638
641
|
const pageNavigator = legendWrapper.append('g').attr('class', 'legend-flip-page');
|
|
@@ -671,6 +674,7 @@ class ChartComponent extends _react.Component {
|
|
|
671
674
|
// update pageNavigator transform
|
|
672
675
|
pageNavigator.call(g => {
|
|
673
676
|
let groupTranslateX = 0;
|
|
677
|
+
let groupTranslateY = 0;
|
|
674
678
|
if (legendPosition === 'top-right') {
|
|
675
679
|
groupTranslateX = insertPadding;
|
|
676
680
|
} else if (legendPosition === 'top-left') {
|
|
@@ -680,8 +684,14 @@ class ChartComponent extends _react.Component {
|
|
|
680
684
|
} = g.node().getBoundingClientRect();
|
|
681
685
|
const offset = legendPageNavWrapperWidth - width;
|
|
682
686
|
groupTranslateX = groupTranslateX + offset;
|
|
687
|
+
} else if (legendPosition === 'center-right') {
|
|
688
|
+
groupTranslateX = chartWidth - insertPadding - rightLegendSpace;
|
|
689
|
+
const {
|
|
690
|
+
height
|
|
691
|
+
} = g.node().parentNode.getBoundingClientRect();
|
|
692
|
+
groupTranslateY = groupTranslateY + height + legendItemMargin;
|
|
683
693
|
}
|
|
684
|
-
g.attr('transform', "translate(".concat(groupTranslateX, ",
|
|
694
|
+
g.attr('transform', "translate(".concat(groupTranslateX, ", ").concat(groupTranslateY, ")"));
|
|
685
695
|
});
|
|
686
696
|
}
|
|
687
697
|
};
|
|
@@ -733,35 +743,53 @@ class ChartComponent extends _react.Component {
|
|
|
733
743
|
const parentNode = rect.parentNode;
|
|
734
744
|
d3.select(parentNode).append('text').attr('x', legendRectWidth + legendRecTextGap).attr('fill', theme.legendTextColor).attr('font-size', theme.legendFontSize).text(this.formatterLegendName(rect.dataset.text)).attr('data-text', rect.dataset.text).attr('dominant-baseline', 'hanging');
|
|
735
745
|
});
|
|
736
|
-
// update g translateX
|
|
737
746
|
const legendItems = Array.from(legendWrapper.node().children).filter(item => item.getAttribute('class') !== 'legend-flip-page');
|
|
738
747
|
const {
|
|
739
748
|
start,
|
|
740
|
-
end
|
|
749
|
+
end,
|
|
750
|
+
top,
|
|
751
|
+
bottom
|
|
741
752
|
} = this.getLegendBoundary(legendPosition);
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
+
if (top && bottom) {
|
|
754
|
+
// update g translateY
|
|
755
|
+
legendItems.forEach((item, index) => {
|
|
756
|
+
let translateY = top;
|
|
757
|
+
const prevItem = legendItems[index - 1];
|
|
758
|
+
if (index > 0) {
|
|
759
|
+
const {
|
|
760
|
+
height
|
|
761
|
+
} = prevItem.getBoundingClientRect();
|
|
762
|
+
const prevTranslateY = Number(prevItem.getAttribute('data-translateY'));
|
|
763
|
+
translateY = prevTranslateY + height + legendItemMargin;
|
|
764
|
+
}
|
|
765
|
+
d3.select(item).attr('transform', "translate(".concat(start, ",").concat(translateY, ")")).attr('data-translateY', translateY);
|
|
766
|
+
});
|
|
767
|
+
} else {
|
|
768
|
+
// update g translateX
|
|
769
|
+
legendItems.forEach((item, index) => {
|
|
770
|
+
let translateX = start;
|
|
771
|
+
const prevItem = legendItems[index - 1];
|
|
772
|
+
if (index > 0) {
|
|
773
|
+
const {
|
|
774
|
+
width
|
|
775
|
+
} = prevItem.getBoundingClientRect();
|
|
776
|
+
const prevTranslateX = Number(prevItem.getAttribute('data-translateX'));
|
|
777
|
+
translateX = prevTranslateX + width + legendItemMargin;
|
|
778
|
+
}
|
|
779
|
+
d3.select(item).attr('transform', "translate(".concat(translateX, ",0)")).attr('data-translateX', translateX);
|
|
753
780
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
781
|
+
// legend items add offset
|
|
782
|
+
if (legendPosition === 'top-right') {
|
|
783
|
+
d3.select(item).attr('opacity', 0);
|
|
784
|
+
// Execute only once
|
|
785
|
+
if (index === legendItems.length - 1) {
|
|
786
|
+
queueMicrotask(() => {
|
|
787
|
+
this.setLegendItemOffset(legendItems, end);
|
|
788
|
+
});
|
|
789
|
+
}
|
|
762
790
|
}
|
|
763
|
-
}
|
|
764
|
-
}
|
|
791
|
+
});
|
|
792
|
+
}
|
|
765
793
|
});
|
|
766
794
|
};
|
|
767
795
|
this.getLegendDataGroups = legendData => {
|
|
@@ -780,43 +808,77 @@ class ChartComponent extends _react.Component {
|
|
|
780
808
|
} = this.legendConfig;
|
|
781
809
|
const {
|
|
782
810
|
start,
|
|
783
|
-
end
|
|
811
|
+
end,
|
|
812
|
+
top,
|
|
813
|
+
bottom
|
|
784
814
|
} = this.getLegendBoundary(legendPosition);
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
815
|
+
if (top && bottom) {
|
|
816
|
+
let allHeight = top;
|
|
817
|
+
const groupsData = [];
|
|
818
|
+
const newLegendData = (0, _lodashEs.cloneDeep)(legendData);
|
|
819
|
+
let lastIndex = 0;
|
|
820
|
+
legendData.forEach((item, index) => {
|
|
821
|
+
const virtualLegend = this.chart.append('g').attr('opacity', 0);
|
|
822
|
+
virtualLegend.append('rect').attr('width', legendRectWidth).attr('height', legendRectHeight).attr('rx', r);
|
|
823
|
+
virtualLegend.append('text').attr('x', legendRectWidth + legendRecTextGap).attr('font-size', theme.legendFontSize).text(this.formatterLegendName(item[0]));
|
|
824
|
+
const {
|
|
825
|
+
height
|
|
826
|
+
} = virtualLegend.node().getBoundingClientRect();
|
|
827
|
+
const itemHeight = index === legendData.length - 1 ? height : height + legendItemMargin; // last item no used margin
|
|
828
|
+
allHeight = allHeight + itemHeight;
|
|
829
|
+
if (allHeight > bottom) {
|
|
830
|
+
groupsData.push(newLegendData.slice(0, index - lastIndex));
|
|
831
|
+
newLegendData.splice(0, index - lastIndex);
|
|
832
|
+
lastIndex = index;
|
|
833
|
+
allHeight = top + itemHeight;
|
|
834
|
+
}
|
|
835
|
+
virtualLegend.remove();
|
|
836
|
+
});
|
|
837
|
+
const restLegendItems = newLegendData.slice(0);
|
|
838
|
+
restLegendItems.length !== 0 && groupsData.push(restLegendItems);
|
|
839
|
+
return groupsData;
|
|
840
|
+
} else {
|
|
841
|
+
let allWidth = start;
|
|
842
|
+
const groupsData = [];
|
|
843
|
+
const newLegendData = (0, _lodashEs.cloneDeep)(legendData);
|
|
844
|
+
let lastIndex = 0;
|
|
845
|
+
legendData.forEach((item, index) => {
|
|
846
|
+
const virtualLegend = this.chart.append('g').attr('opacity', 0);
|
|
847
|
+
virtualLegend.append('rect').attr('width', legendRectWidth).attr('height', legendRectHeight).attr('rx', r);
|
|
848
|
+
virtualLegend.append('text').attr('x', legendRectWidth + legendRecTextGap).attr('font-size', theme.legendFontSize).text(this.formatterLegendName(item[0]));
|
|
849
|
+
const {
|
|
850
|
+
width
|
|
851
|
+
} = virtualLegend.node().getBoundingClientRect();
|
|
852
|
+
const itemWidth = index === legendData.length - 1 ? width : width + legendItemMargin; // last item no used margin
|
|
853
|
+
allWidth = allWidth + itemWidth;
|
|
854
|
+
if (allWidth > end) {
|
|
855
|
+
groupsData.push(newLegendData.slice(0, index - lastIndex));
|
|
856
|
+
newLegendData.splice(0, index - lastIndex);
|
|
857
|
+
lastIndex = index;
|
|
858
|
+
allWidth = start + itemWidth;
|
|
859
|
+
}
|
|
860
|
+
virtualLegend.remove();
|
|
861
|
+
});
|
|
862
|
+
const restLegendItems = newLegendData.slice(0);
|
|
863
|
+
restLegendItems.length !== 0 && groupsData.push(restLegendItems);
|
|
864
|
+
return groupsData;
|
|
865
|
+
}
|
|
809
866
|
};
|
|
810
867
|
this.getLegendBoundary = legendPosition => {
|
|
811
868
|
const {
|
|
812
|
-
legendPageNavWrapperWidth
|
|
869
|
+
legendPageNavWrapperWidth,
|
|
870
|
+
legendPageNavWrapperHeight
|
|
813
871
|
} = this.legendConfig;
|
|
814
872
|
const {
|
|
815
873
|
width: chartWidth,
|
|
816
|
-
|
|
874
|
+
height: chartHeight,
|
|
875
|
+
insertPadding,
|
|
876
|
+
rightLegendSpace
|
|
817
877
|
} = this.chartBoundingClientRect;
|
|
818
878
|
let start = 0;
|
|
819
879
|
let end = 0;
|
|
880
|
+
let top = 0;
|
|
881
|
+
let bottom = 0;
|
|
820
882
|
if (legendPosition === 'top-left') {
|
|
821
883
|
start = insertPadding;
|
|
822
884
|
end = chartWidth - insertPadding - legendPageNavWrapperWidth;
|
|
@@ -825,9 +887,17 @@ class ChartComponent extends _react.Component {
|
|
|
825
887
|
start = insertPadding + legendPageNavWrapperWidth;
|
|
826
888
|
end = chartWidth - insertPadding;
|
|
827
889
|
}
|
|
890
|
+
if (legendPosition === 'center-right') {
|
|
891
|
+
start = chartWidth - insertPadding - rightLegendSpace;
|
|
892
|
+
end = chartWidth - insertPadding;
|
|
893
|
+
top = insertPadding;
|
|
894
|
+
bottom = chartHeight - insertPadding - legendPageNavWrapperHeight;
|
|
895
|
+
}
|
|
828
896
|
return {
|
|
829
897
|
start,
|
|
830
|
-
end
|
|
898
|
+
end,
|
|
899
|
+
top,
|
|
900
|
+
bottom
|
|
831
901
|
};
|
|
832
902
|
};
|
|
833
903
|
this.handleNavigatorOpacity = (navigator, text) => {
|
|
@@ -1073,7 +1143,7 @@ class ChartComponent extends _react.Component {
|
|
|
1073
1143
|
label_font_size,
|
|
1074
1144
|
text
|
|
1075
1145
|
} = _ref6;
|
|
1076
|
-
d3.select(container).append('text').attr('y', Number(y) - 10).attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1146
|
+
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('y', Number(y) - 10).attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1077
1147
|
const {
|
|
1078
1148
|
width
|
|
1079
1149
|
} = g.node().getBoundingClientRect();
|
|
@@ -1091,7 +1161,7 @@ class ChartComponent extends _react.Component {
|
|
|
1091
1161
|
label_font_size,
|
|
1092
1162
|
text
|
|
1093
1163
|
} = _ref7;
|
|
1094
|
-
d3.select(container).append('text').attr('x', Number(x) + Number(xWidth) + 10).attr('y', Number(y)).attr('fill', theme.labelColor).attr('dominant-baseline', 'hanging').attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1164
|
+
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('x', Number(x) + Number(xWidth) + 10).attr('y', Number(y)).attr('fill', theme.labelColor).attr('dominant-baseline', 'hanging').attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1095
1165
|
if (g.node()) {
|
|
1096
1166
|
var _g$node;
|
|
1097
1167
|
const {
|
|
@@ -1113,7 +1183,7 @@ class ChartComponent extends _react.Component {
|
|
|
1113
1183
|
label_font_size,
|
|
1114
1184
|
text
|
|
1115
1185
|
} = _ref8;
|
|
1116
|
-
d3.select(container).append('text').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1186
|
+
d3.select(container).append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(text).call(g => {
|
|
1117
1187
|
const {
|
|
1118
1188
|
width,
|
|
1119
1189
|
height
|
|
@@ -73,8 +73,8 @@ class Completeness extends _chartComponent.default {
|
|
|
73
73
|
const newSeries = this.getGroupSeries(data);
|
|
74
74
|
|
|
75
75
|
// Y axis
|
|
76
|
-
const fy = d3.scaleBand().domain(newSeries.map(item => item[0])).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.
|
|
77
|
-
const y = d3.scaleBand().domain(new Set(data.map(d => d.groupby))).range([0, fy.bandwidth()]);
|
|
76
|
+
const fy = d3.scaleBand().domain(newSeries.map(item => item[0])).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
77
|
+
const y = d3.scaleBand().domain(new Set(data.map(d => d.groupby))).range([0, fy.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
78
78
|
const yAxis = this.chart.append('g').call(d3.axisLeft(fy).tickSizeOuter(0).tickPadding(0).tickSizeInner(5)).call(g => {
|
|
79
79
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
80
80
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
@@ -76,7 +76,7 @@ class Completeness extends _chartComponent.default {
|
|
|
76
76
|
const newSeries = this.handleSeries(series, data);
|
|
77
77
|
|
|
78
78
|
// Y axis
|
|
79
|
-
const y = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.
|
|
79
|
+
const y = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
80
80
|
const yAxis = this.chart.append('g').call(d3.axisLeft(y).tickSizeOuter(0).tickPadding(0).tickSizeInner(5)).call(g => {
|
|
81
81
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
82
82
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
@@ -91,8 +91,8 @@ class HorizontalBarGroup extends _chartComponent.default {
|
|
|
91
91
|
const groupByColumn = this.getColumn(tables, table_id, column_groupby_column_key);
|
|
92
92
|
const useSingleSelectColumnColor = (groupByColumn === null || groupByColumn === void 0 ? void 0 : groupByColumn.type) === _dtableUtils.CellType.SINGLE_SELECT && color_theme === _colorRules.SUPPORT_SINGLE_SELECT_THEMES_OPTIONS.SINGLE_SELECT_COLUMN_COLORS;
|
|
93
93
|
useSingleSelectColumnColor ? this.setSingleSelectColorMap(data) : this.setColorMap(data, chartColorTheme);
|
|
94
|
-
const fy = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.1);
|
|
95
|
-
const y = d3.scaleBand().domain(new Set(data.map(d => d.group_name))).range([0, fy.bandwidth()]);
|
|
94
|
+
const fy = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
95
|
+
const y = d3.scaleBand().domain(new Set(data.map(d => d.group_name))).range([0, fy.bandwidth()]).paddingInner(0).paddingOuter(0);
|
|
96
96
|
const yAxis = this.chart.append('g').call(d3.axisLeft(fy).tickSizeOuter(0).tickPadding(0).tickSizeInner(5)).call(g => {
|
|
97
97
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
98
98
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
@@ -94,7 +94,7 @@ class HorizontalBarStack extends _chartComponent.default {
|
|
|
94
94
|
return ((_group$get = group.get(String(key))) === null || _group$get === void 0 ? void 0 : _group$get.value) || 0;
|
|
95
95
|
})(d3.index(data, d => d.name, d => d.group_name));
|
|
96
96
|
const newSeries = this.handleSeries(series, data);
|
|
97
|
-
const y = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.
|
|
97
|
+
const y = d3.scaleBand().domain(new Set(data.map(d => d.name))).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
98
98
|
|
|
99
99
|
// Y axis
|
|
100
100
|
const yAxis = this.chart.append('g').call(d3.axisLeft(y).tickSizeOuter(0).tickPadding(0).tickSizeInner(5)).call(g => {
|
|
@@ -88,7 +88,7 @@ class HorizontalBar extends _chartComponent.default {
|
|
|
88
88
|
const colorRules = color_option === _constants.TYPE_COLOR_USING.USE_RULES && horizontal_axis_label_color_rules && (0, _colorUtils.getConvertedColorRules)(horizontal_axis_label_color_rules);
|
|
89
89
|
const tooltipTitle = this.getTitle(tables, table_id, horizontal_axis_summary_type, horizontal_axis_column_key);
|
|
90
90
|
data.reverse();
|
|
91
|
-
const y = d3.scaleBand().domain(data.map(item => item.name)).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.
|
|
91
|
+
const y = d3.scaleBand().domain(data.map(item => item.name)).range([chartHeight - insertPadding, insertPadding]).paddingInner(0.5).paddingOuter(0.1);
|
|
92
92
|
const yAxis = this.chart.append('g').call(d3.axisLeft(y).tickSizeOuter(0).tickPadding(0).tickSizeInner(5)).call(g => {
|
|
93
93
|
g.selectAll('.domain').attr('stroke', theme.XAxisColor);
|
|
94
94
|
g.selectAll('.tick line').attr('stroke', theme.XAxisColor);
|
|
@@ -23,6 +23,10 @@ var _completeness = _interopRequireDefault(require("./completeness"));
|
|
|
23
23
|
var _completenessGroup = _interopRequireDefault(require("./completeness-group"));
|
|
24
24
|
var _line = _interopRequireDefault(require("./line"));
|
|
25
25
|
var _lineGroup = _interopRequireDefault(require("./line-group"));
|
|
26
|
+
var _area = _interopRequireDefault(require("./area"));
|
|
27
|
+
var _areaGroup = _interopRequireDefault(require("./area-group"));
|
|
28
|
+
var _pie = _interopRequireDefault(require("./pie"));
|
|
29
|
+
var _ring = _interopRequireDefault(require("./ring"));
|
|
26
30
|
var _basicNumberCard = _interopRequireDefault(require("./basic-number-card"));
|
|
27
31
|
var _trend = _interopRequireDefault(require("./trend"));
|
|
28
32
|
var _tableElement = _interopRequireDefault(require("./table-element"));
|
|
@@ -209,6 +213,30 @@ const Wrapper = _ref => {
|
|
|
209
213
|
canvasStyle: canvasStyle
|
|
210
214
|
}));
|
|
211
215
|
}
|
|
216
|
+
case _constants.CHART_TYPE.AREA:
|
|
217
|
+
{
|
|
218
|
+
return /*#__PURE__*/_react.default.createElement(_area.default, Object.assign({}, baseProps, {
|
|
219
|
+
canvasStyle: canvasStyle
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
case _constants.CHART_TYPE.AREA_GROUP:
|
|
223
|
+
{
|
|
224
|
+
return /*#__PURE__*/_react.default.createElement(_areaGroup.default, Object.assign({}, baseProps, {
|
|
225
|
+
canvasStyle: canvasStyle
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
case _constants.CHART_TYPE.PIE:
|
|
229
|
+
{
|
|
230
|
+
return /*#__PURE__*/_react.default.createElement(_pie.default, Object.assign({}, baseProps, {
|
|
231
|
+
canvasStyle: canvasStyle
|
|
232
|
+
}));
|
|
233
|
+
}
|
|
234
|
+
case _constants.CHART_TYPE.RING:
|
|
235
|
+
{
|
|
236
|
+
return /*#__PURE__*/_react.default.createElement(_ring.default, Object.assign({}, baseProps, {
|
|
237
|
+
canvasStyle: canvasStyle
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
212
240
|
case _constants.CHART_TYPE.BASIC_NUMBER_CARD:
|
|
213
241
|
{
|
|
214
242
|
return /*#__PURE__*/_react.default.createElement(_basicNumberCard.default, Object.assign({}, baseProps, {
|
|
@@ -209,7 +209,7 @@ class LineGroup extends _chartComponent.default {
|
|
|
209
209
|
// circle label
|
|
210
210
|
if (y_axis_show_value) {
|
|
211
211
|
const curCircleEl = g.node();
|
|
212
|
-
rectsWrapper.append('text').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(curCircleEl.getAttribute('data-text')).call(g => {
|
|
212
|
+
rectsWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(curCircleEl.getAttribute('data-text')).call(g => {
|
|
213
213
|
const {
|
|
214
214
|
width
|
|
215
215
|
} = g.node().getBoundingClientRect();
|
|
@@ -62,7 +62,7 @@ class Line extends _chartComponent.default {
|
|
|
62
62
|
const newTooltipData = {
|
|
63
63
|
title: title,
|
|
64
64
|
items: [{
|
|
65
|
-
color: this.
|
|
65
|
+
color: this.getLineColor(),
|
|
66
66
|
name: data.name,
|
|
67
67
|
value: data.value
|
|
68
68
|
}]
|
|
@@ -85,7 +85,7 @@ class Line extends _chartComponent.default {
|
|
|
85
85
|
const newTooltipData = {
|
|
86
86
|
title: title,
|
|
87
87
|
items: [{
|
|
88
|
-
color: this.
|
|
88
|
+
color: this.getLineColor(),
|
|
89
89
|
name: data.name,
|
|
90
90
|
value: data.value
|
|
91
91
|
}]
|
|
@@ -135,7 +135,7 @@ class Line extends _chartComponent.default {
|
|
|
135
135
|
insertPadding,
|
|
136
136
|
marginTop
|
|
137
137
|
} = this.chartBoundingClientRect;
|
|
138
|
-
const chartBarColor = this.
|
|
138
|
+
const chartBarColor = this.getLineColor();
|
|
139
139
|
const tooltipTitle = this.getTitle(tables, table_id, y_axis_summary_type, y_axis_column_key || y_axis_summary_column_key);
|
|
140
140
|
|
|
141
141
|
// Y axis
|
|
@@ -177,7 +177,7 @@ class Line extends _chartComponent.default {
|
|
|
177
177
|
// circle label
|
|
178
178
|
if (y_axis_show_value) {
|
|
179
179
|
const curCircleEl = g.node();
|
|
180
|
-
rectsWrapper.append('text').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(curCircleEl.getAttribute('data-text')).call(g => {
|
|
180
|
+
rectsWrapper.append('text').attr('stroke', '#fff').attr('stroke-width', 1).attr('paint-order', 'stroke').attr('fill', theme.labelColor).attr('font-size', _utils.BaseUtils.getLabelFontSize(label_font_size)).text(curCircleEl.getAttribute('data-text')).call(g => {
|
|
181
181
|
const {
|
|
182
182
|
width
|
|
183
183
|
} = g.node().getBoundingClientRect();
|
|
@@ -293,7 +293,7 @@ class Line extends _chartComponent.default {
|
|
|
293
293
|
this.hiddenTooltip();
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
this.
|
|
296
|
+
this.getLineColor = () => {
|
|
297
297
|
const {
|
|
298
298
|
chart,
|
|
299
299
|
chartColorTheme
|