@vizabi/bubblechart 3.17.1 → 4.0.0
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/build/bubblechart.css +8 -28
- package/build/bubblechart.js +389 -308
- package/build/bubblechart.js.map +1 -1
- package/build/stats.html +1 -1
- package/package.json +1 -1
package/build/bubblechart.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// https://github.com/vizabi/bubblechart#readme
|
|
1
|
+
// https://github.com/vizabi/bubblechart#readme v4.0.0 build 1687772747236 Copyright 2023 Gapminder Foundation and contributors
|
|
2
2
|
(function (global, factory) {
|
|
3
|
-
typeof exports === 'object' && typeof module !== 'undefined' ?
|
|
4
|
-
typeof define === 'function' && define.amd ? define(['@vizabi/shared-components', 'd3', 'mobx'], factory) :
|
|
5
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BubbleChart =
|
|
6
|
-
})(this, (function (sharedComponents, d3, mobx) { 'use strict';
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@vizabi/shared-components'), require('d3'), require('mobx')) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports', '@vizabi/shared-components', 'd3', 'mobx'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BubbleChart = {}, global.VizabiSharedComponents, global.d3, global.mobx));
|
|
6
|
+
})(this, (function (exports, sharedComponents, d3, mobx) { 'use strict';
|
|
7
7
|
|
|
8
8
|
class PanZoom {
|
|
9
9
|
|
|
@@ -700,6 +700,381 @@
|
|
|
700
700
|
|
|
701
701
|
}
|
|
702
702
|
|
|
703
|
+
const {ICON_QUESTION} = sharedComponents.Icons;
|
|
704
|
+
|
|
705
|
+
class BCAxisTitles extends sharedComponents.BaseComponent {
|
|
706
|
+
|
|
707
|
+
constructor(config) {
|
|
708
|
+
config.template = `
|
|
709
|
+
<g class="vzb-bc-axis-x-title"><text></text></g>
|
|
710
|
+
<g class="vzb-bc-axis-y-title"><text></text></g>
|
|
711
|
+
<g class="vzb-bc-axis-s-title"><text></text></g>
|
|
712
|
+
<g class="vzb-bc-axis-x-subtitle"><text></text></g>
|
|
713
|
+
<g class="vzb-bc-axis-y-subtitle"><text></text></g>
|
|
714
|
+
<g class="vzb-bc-axis-x-info vzb-noexport"></g>
|
|
715
|
+
<g class="vzb-bc-axis-y-info vzb-noexport"></g>
|
|
716
|
+
`;
|
|
717
|
+
super(config);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
setup(){
|
|
721
|
+
this.DOM = {
|
|
722
|
+
xTitle: this.element.select(".vzb-bc-axis-x-title"),
|
|
723
|
+
yTitle: this.element.select(".vzb-bc-axis-y-title"),
|
|
724
|
+
sTitle: this.element.select(".vzb-bc-axis-s-title"),
|
|
725
|
+
xSubTitle: this.element.select(".vzb-bc-axis-x-subtitle"),
|
|
726
|
+
ySubTitle: this.element.select(".vzb-bc-axis-y-subtitle"),
|
|
727
|
+
xInfo: this.element.select(".vzb-bc-axis-x-info"),
|
|
728
|
+
yInfo: this.element.select(".vzb-bc-axis-y-info")
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
this.axisTitleComplimentStrings = {Y: "", X: "", S: "", C: ""};
|
|
732
|
+
|
|
733
|
+
this._initInfoElements();
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
draw(){
|
|
737
|
+
this.localise = this.services.locale.auto();
|
|
738
|
+
|
|
739
|
+
this.addReaction(this.updateUIStrings);
|
|
740
|
+
this.addReaction(this.updateTreemenu);
|
|
741
|
+
this.addReaction(this.updateSize);
|
|
742
|
+
this.addReaction(this.updateInfoElements);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
get MDL(){
|
|
746
|
+
return {
|
|
747
|
+
y: this.model.encoding[this.state.alias?.y || "y"],
|
|
748
|
+
x: this.model.encoding[this.state.alias?.x || "x"],
|
|
749
|
+
size: this.model.encoding.size,
|
|
750
|
+
color: this.model.encoding.color
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
updateTreemenu(){
|
|
755
|
+
const treemenu = this.root.findChild({type: "TreeMenu"});
|
|
756
|
+
|
|
757
|
+
this.DOM.yTitle
|
|
758
|
+
.classed("vzb-disabled", treemenu.state.ownReadiness !== sharedComponents.Utils.STATUS.READY)
|
|
759
|
+
.on("click", () => {
|
|
760
|
+
treemenu
|
|
761
|
+
.encoding(this.parent._alias("y"))
|
|
762
|
+
.alignX(this.services.locale.isRTL() ? "right" : "left")
|
|
763
|
+
.alignY("top")
|
|
764
|
+
.updateView()
|
|
765
|
+
.toggle();
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
this.DOM.xTitle
|
|
769
|
+
.classed("vzb-disabled", treemenu.state.ownReadiness !== sharedComponents.Utils.STATUS.READY)
|
|
770
|
+
.on("click", () => {
|
|
771
|
+
treemenu
|
|
772
|
+
.encoding(this.parent._alias("x"))
|
|
773
|
+
.alignX(this.services.locale.isRTL() ? "right" : "left")
|
|
774
|
+
.alignY("bottom")
|
|
775
|
+
.updateView()
|
|
776
|
+
.toggle();
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
updateUIStrings() {
|
|
781
|
+
const {
|
|
782
|
+
y, x, size, color
|
|
783
|
+
} = this.MDL;
|
|
784
|
+
|
|
785
|
+
this.strings = {
|
|
786
|
+
title: {
|
|
787
|
+
Y: sharedComponents.Utils.getConceptName(y, this.localise),
|
|
788
|
+
X: sharedComponents.Utils.getConceptName(x, this.localise),
|
|
789
|
+
S: sharedComponents.Utils.getConceptName(size, this.localise),
|
|
790
|
+
C: sharedComponents.Utils.getConceptName(color, this.localise)
|
|
791
|
+
},
|
|
792
|
+
title_short: {
|
|
793
|
+
Y: sharedComponents.Utils.getConceptShortName(y, this.localise),
|
|
794
|
+
X: sharedComponents.Utils.getConceptShortName(x, this.localise),
|
|
795
|
+
S: sharedComponents.Utils.getConceptShortName(size, this.localise),
|
|
796
|
+
C: sharedComponents.Utils.getConceptShortName(color, this.localise)
|
|
797
|
+
},
|
|
798
|
+
subtitle: {
|
|
799
|
+
Y: sharedComponents.Utils.getConceptNameMinusShortName(y, this.localise),
|
|
800
|
+
X: sharedComponents.Utils.getConceptNameMinusShortName(x, this.localise)
|
|
801
|
+
},
|
|
802
|
+
unit: {
|
|
803
|
+
Y: sharedComponents.Utils.getConceptUnit(y),
|
|
804
|
+
X: sharedComponents.Utils.getConceptUnit(x),
|
|
805
|
+
S: sharedComponents.Utils.getConceptUnit(size),
|
|
806
|
+
C: sharedComponents.Utils.getConceptUnit(color)
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
Promise.all([
|
|
811
|
+
sharedComponents.Utils.getConceptNameCompliment(y),
|
|
812
|
+
sharedComponents.Utils.getConceptNameCompliment(x),
|
|
813
|
+
sharedComponents.Utils.getConceptNameCompliment(size),
|
|
814
|
+
sharedComponents.Utils.getConceptNameCompliment(color)
|
|
815
|
+
]).then(mobx.action(response => {
|
|
816
|
+
[
|
|
817
|
+
this.axisTitleComplimentStrings.Y,
|
|
818
|
+
this.axisTitleComplimentStrings.X,
|
|
819
|
+
this.axisTitleComplimentStrings.S,
|
|
820
|
+
this.axisTitleComplimentStrings.C
|
|
821
|
+
] = response;
|
|
822
|
+
}));
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
_initInfoElements() {
|
|
827
|
+
const _this = this;
|
|
828
|
+
const dataNotesDialog = () => this.root.findChild({type: "DataNotes"});
|
|
829
|
+
const timeSlider = () => this.root.findChild({type: "TimeSlider"});
|
|
830
|
+
|
|
831
|
+
sharedComponents.LegacyUtils.setIcon(this.DOM.yInfo, ICON_QUESTION)
|
|
832
|
+
.on("click", () => {
|
|
833
|
+
dataNotesDialog().pin();
|
|
834
|
+
})
|
|
835
|
+
.on("mouseover", function() {
|
|
836
|
+
if (timeSlider().ui.dragging) return;
|
|
837
|
+
const rect = this.getBBox();
|
|
838
|
+
const coord = sharedComponents.LegacyUtils.makeAbsoluteContext(this, this.farthestViewportElement)(rect.x - 10, rect.y + rect.height + 10);
|
|
839
|
+
const toolRect = _this.root.element.node().getBoundingClientRect();
|
|
840
|
+
const chartRect = _this.element.node().getBoundingClientRect();
|
|
841
|
+
dataNotesDialog()
|
|
842
|
+
.setEncoding(_this.MDL.y)
|
|
843
|
+
.show()
|
|
844
|
+
.setPos(coord.x + chartRect.left - toolRect.left, coord.y);
|
|
845
|
+
})
|
|
846
|
+
.on("mouseout", () => {
|
|
847
|
+
if (timeSlider().ui.dragging) return;
|
|
848
|
+
dataNotesDialog().hide();
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
sharedComponents.LegacyUtils.setIcon(this.DOM.xInfo, ICON_QUESTION)
|
|
852
|
+
.on("click", () => {
|
|
853
|
+
dataNotesDialog().pin();
|
|
854
|
+
})
|
|
855
|
+
.on("mouseover", function() {
|
|
856
|
+
if (timeSlider().ui.dragging) return;
|
|
857
|
+
const rect = this.getBBox();
|
|
858
|
+
const coord = sharedComponents.LegacyUtils.makeAbsoluteContext(this, this.farthestViewportElement)(rect.x - 10, rect.y + rect.height + 10);
|
|
859
|
+
const toolRect = _this.root.element.node().getBoundingClientRect();
|
|
860
|
+
const chartRect = _this.element.node().getBoundingClientRect();
|
|
861
|
+
dataNotesDialog()
|
|
862
|
+
.setEncoding(_this.MDL.x)
|
|
863
|
+
.show()
|
|
864
|
+
.setPos(coord.x + chartRect.left - toolRect.left, coord.y);
|
|
865
|
+
})
|
|
866
|
+
.on("mouseout", () => {
|
|
867
|
+
if (timeSlider().ui.dragging) return;
|
|
868
|
+
dataNotesDialog().hide();
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
updateInfoElements() {
|
|
873
|
+
this.services.layout.size;
|
|
874
|
+
this.axisTitleComplimentStrings.X;
|
|
875
|
+
this.axisTitleComplimentStrings.Y;
|
|
876
|
+
|
|
877
|
+
const {xInfo, yInfo, xTitle, yTitle} = this.DOM;
|
|
878
|
+
const {x, y} = this.MDL;
|
|
879
|
+
const isRTL = this.services.locale.isRTL();
|
|
880
|
+
const infoElHeight = this.parent.profileConstants.infoElHeight;
|
|
881
|
+
const layoutProfile = this.services.layout.profile;
|
|
882
|
+
|
|
883
|
+
if (yInfo.select("svg").node()) {
|
|
884
|
+
const titleBBox = yTitle.node().getBBox();
|
|
885
|
+
const t = sharedComponents.LegacyUtils.transform(yTitle.node());
|
|
886
|
+
const hTranslate = isRTL ? (titleBBox.x + t.translateX - infoElHeight * 1.4) : (titleBBox.x + t.translateX + titleBBox.width + infoElHeight * 0.4);
|
|
887
|
+
const vTranslate = isRTL ? (t.translateY + infoElHeight * 1.4 + titleBBox.width * 0.5) : (t.translateY - infoElHeight * 0.4 - titleBBox.width * 0.5);
|
|
888
|
+
const conceptPropsY = y.data.conceptProps;
|
|
889
|
+
|
|
890
|
+
yInfo
|
|
891
|
+
.classed("vzb-hidden", !conceptPropsY.description && !conceptPropsY.sourceLink || this.services.layout.projector)
|
|
892
|
+
.attr("transform", layoutProfile !== "SMALL" ?
|
|
893
|
+
`translate(${ t.translateX - infoElHeight * 0.8 }, ${ vTranslate }) rotate(-90)` :
|
|
894
|
+
`translate(${ hTranslate },${ t.translateY - infoElHeight * 0.8 })`)
|
|
895
|
+
.select("svg")
|
|
896
|
+
.attr("width", infoElHeight + "px")
|
|
897
|
+
.attr("height", infoElHeight + "px");
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
if (xInfo.select("svg").node()) {
|
|
901
|
+
const titleBBox = xTitle.node().getBBox();
|
|
902
|
+
const t = sharedComponents.LegacyUtils.transform(xTitle.node());
|
|
903
|
+
const hTranslate = isRTL ? (titleBBox.x + t.translateX - infoElHeight * 1.4) : (titleBBox.x + t.translateX + titleBBox.width + infoElHeight * 0.4);
|
|
904
|
+
const conceptPropsX = x.data.conceptProps;
|
|
905
|
+
|
|
906
|
+
xInfo
|
|
907
|
+
.classed("vzb-hidden", !conceptPropsX.description && !conceptPropsX.sourceLink || this.services.layout.projector)
|
|
908
|
+
.attr("transform", `translate(${ hTranslate }, ${ t.translateY - infoElHeight * 0.8 })`)
|
|
909
|
+
.select("svg")
|
|
910
|
+
.attr("width", infoElHeight + "px")
|
|
911
|
+
.attr("height", infoElHeight + "px");
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
_updateSTitle(width = this.parent.width, height = this.parent.height) {
|
|
917
|
+
const { sTitle } = this.DOM;
|
|
918
|
+
const { size, color } = this.MDL;
|
|
919
|
+
const compl = this.axisTitleComplimentStrings;
|
|
920
|
+
|
|
921
|
+
// vertical text about size and color
|
|
922
|
+
const invisible = this.parent.profileConstants.hideSTitle
|
|
923
|
+
&& this.root.ui.dialogs.dialogs.sidebar.includes("colors")
|
|
924
|
+
&& this.root.ui.dialogs.dialogs.sidebar.includes("size");
|
|
925
|
+
|
|
926
|
+
sTitle.classed("vzb-invisible", invisible);
|
|
927
|
+
if (invisible) return;
|
|
928
|
+
|
|
929
|
+
const sTitleContent = !size.data.constant
|
|
930
|
+
? this.localise("buttons/size") + ": " + this.strings.title.S + (compl.S ? " · " + compl.S : "")
|
|
931
|
+
: "";
|
|
932
|
+
const cTitleContent = !color.data.constant
|
|
933
|
+
? this.localise("buttons/colors") + ": " + this.strings.title.C + (compl.C ? " · " + compl.C : "")
|
|
934
|
+
: "";
|
|
935
|
+
|
|
936
|
+
const sTitleText = sTitle
|
|
937
|
+
.attr("text-anchor", "end")
|
|
938
|
+
.attr("transform", "translate(" + width + "," + 20 + ") rotate(-90)")
|
|
939
|
+
.select("text")
|
|
940
|
+
.style("font-size", null) // reset font size to remove jumpy measurement
|
|
941
|
+
.text(sTitleContent + (sTitleContent && cTitleContent ? ", " : "") + cTitleContent);
|
|
942
|
+
|
|
943
|
+
// reduce font size if the caption doesn't fit
|
|
944
|
+
const sTitleWidth = sTitleText.node().getBBox().width;
|
|
945
|
+
const padding = 30;
|
|
946
|
+
const font = parseInt(sTitleText.style("font-size")) * (height - padding) / sTitleWidth;
|
|
947
|
+
sTitleText.style("font-size", sTitleWidth > (height - padding) ? font + "px" : null);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
_updateYTitle(width = this.parent.width, height = this.parent.height) {
|
|
952
|
+
const { yTitle, ySubTitle } = this.DOM;
|
|
953
|
+
|
|
954
|
+
const {
|
|
955
|
+
margin,
|
|
956
|
+
infoElHeight,
|
|
957
|
+
yAxisTitleBottomMargin,
|
|
958
|
+
} = this.parent.profileConstants;
|
|
959
|
+
|
|
960
|
+
const layoutProfile = this.services.layout.profile;
|
|
961
|
+
|
|
962
|
+
const compl = this.axisTitleComplimentStrings;
|
|
963
|
+
const isRTL = this.services.locale.isRTL();
|
|
964
|
+
|
|
965
|
+
if (layoutProfile !== "SMALL") {
|
|
966
|
+
ySubTitle
|
|
967
|
+
.attr("transform", "translate(" + 0 + "," + 0 + ") rotate(-90)")
|
|
968
|
+
.select("text")
|
|
969
|
+
.attr("dy", infoElHeight * 0.6)
|
|
970
|
+
.style("font-size", (infoElHeight * 0.8) + "px")
|
|
971
|
+
.text(this.strings.subtitle.Y);
|
|
972
|
+
|
|
973
|
+
const yTitleText = yTitle.select("text")
|
|
974
|
+
.style("font-size", infoElHeight + "px")
|
|
975
|
+
.text(this.strings.title_short.Y + (compl.Y ? " · " + compl.Y : ""));
|
|
976
|
+
|
|
977
|
+
yTitleText.append("tspan")
|
|
978
|
+
.classed("vzb-noexport", true)
|
|
979
|
+
.style("font-size", (infoElHeight * 0.7) + "px")
|
|
980
|
+
.attr("dx", ( (isRTL ? -1 : 1) * infoElHeight * 0.25) + "px")
|
|
981
|
+
.text("▼");
|
|
982
|
+
|
|
983
|
+
const doesntFit = yTitle.node().getBBox().width > height;
|
|
984
|
+
|
|
985
|
+
yTitle
|
|
986
|
+
.attr("text-anchor", doesntFit ? "start" : "middle")
|
|
987
|
+
.attr("transform", "translate(" + (-margin.left - yAxisTitleBottomMargin) + "," + (doesntFit ? (isRTL ? 0 : height) : height / 2 ) + ") rotate(-90)");
|
|
988
|
+
|
|
989
|
+
} else {
|
|
990
|
+
ySubTitle.select("text").text("");
|
|
991
|
+
|
|
992
|
+
const yTitleText = yTitle
|
|
993
|
+
.select("text")
|
|
994
|
+
.text(this.strings.title.Y + (compl.Y ? " · " + compl.Y : ""));
|
|
995
|
+
|
|
996
|
+
const doesntFit = yTitleText.node().getBBox().width > width;
|
|
997
|
+
if (doesntFit) yTitleText.text(this.strings.title_short.Y + (compl.Y ? " · " + compl.Y : ""));
|
|
998
|
+
|
|
999
|
+
yTitle
|
|
1000
|
+
.attr("text-anchor", "start")
|
|
1001
|
+
.attr("transform", "translate(" + (isRTL ? width : 10 - margin.left) + ", -" + yAxisTitleBottomMargin + ")");
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
_updateXTitle(width = this.parent.width, height = this.parent.height) {
|
|
1007
|
+
const { xTitle, xSubTitle } = this.DOM;
|
|
1008
|
+
|
|
1009
|
+
const {
|
|
1010
|
+
margin,
|
|
1011
|
+
infoElHeight,
|
|
1012
|
+
xAxisTitleBottomMargin,
|
|
1013
|
+
} = this.parent.profileConstants;
|
|
1014
|
+
|
|
1015
|
+
const layoutProfile = this.services.layout.profile;
|
|
1016
|
+
|
|
1017
|
+
const compl = this.axisTitleComplimentStrings;
|
|
1018
|
+
const isRTL = this.services.locale.isRTL();
|
|
1019
|
+
|
|
1020
|
+
if (layoutProfile !== "SMALL") {
|
|
1021
|
+
xSubTitle
|
|
1022
|
+
.attr("transform", "translate(" + width + "," + height + ")")
|
|
1023
|
+
.select("text")
|
|
1024
|
+
.attr("dy", -infoElHeight * 0.3)
|
|
1025
|
+
.style("font-size", (infoElHeight * 0.8) + "px")
|
|
1026
|
+
.text(this.strings.subtitle.X);
|
|
1027
|
+
|
|
1028
|
+
const xTitleText = xTitle.select("text")
|
|
1029
|
+
.style("font-size", infoElHeight + "px")
|
|
1030
|
+
.text(this.strings.title_short.X + (compl.X ? " · " + compl.X : ""));
|
|
1031
|
+
|
|
1032
|
+
xTitleText
|
|
1033
|
+
.append("tspan")
|
|
1034
|
+
.classed("vzb-noexport", true)
|
|
1035
|
+
.style("font-size", (infoElHeight * 0.7) + "px")
|
|
1036
|
+
.attr("dx", ( (isRTL ? -1 : 1) * infoElHeight * 0.25) + "px")
|
|
1037
|
+
.text("▼");
|
|
1038
|
+
|
|
1039
|
+
} else {
|
|
1040
|
+
xSubTitle.select("text").text("");
|
|
1041
|
+
|
|
1042
|
+
xTitle.select("text")
|
|
1043
|
+
.text(this.strings.title.X + (compl.X ? " · " + compl.X : ""));
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
const doesntFit = xTitle.node().getBBox().width > width - 100;
|
|
1047
|
+
xTitle
|
|
1048
|
+
.attr("text-anchor", doesntFit ? "start" : "middle")
|
|
1049
|
+
.attr("transform", "translate(" + (doesntFit ? (isRTL ? width : 0) : width / 2) + "," + (height + margin.bottom - xAxisTitleBottomMargin) + ")");
|
|
1050
|
+
|
|
1051
|
+
if (doesntFit && layoutProfile === "SMALL") xTitle.select("text").text(this.strings.title_short.X) + (compl.X ? " · " + compl.X : "");
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
updateSize() {
|
|
1056
|
+
this.services.layout.size;
|
|
1057
|
+
|
|
1058
|
+
const {
|
|
1059
|
+
margin,
|
|
1060
|
+
leftMarginRatio
|
|
1061
|
+
} = this.parent.profileConstants;
|
|
1062
|
+
|
|
1063
|
+
const height = (this.parent.elementHeight - margin.top - margin.bottom) || 0;
|
|
1064
|
+
const width = (this.parent.elementWidth - margin.left * leftMarginRatio - margin.right) || 0;
|
|
1065
|
+
|
|
1066
|
+
this._updateSTitle(width, height);
|
|
1067
|
+
this._updateYTitle(width, height);
|
|
1068
|
+
this._updateXTitle(width, height);
|
|
1069
|
+
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const decorated = mobx.decorate(BCAxisTitles, {
|
|
1074
|
+
"MDL": mobx.computed,
|
|
1075
|
+
"axisTitleComplimentStrings": mobx.observable
|
|
1076
|
+
});
|
|
1077
|
+
|
|
703
1078
|
class BCDecorations{
|
|
704
1079
|
constructor(){
|
|
705
1080
|
}
|
|
@@ -868,7 +1243,6 @@
|
|
|
868
1243
|
}
|
|
869
1244
|
}
|
|
870
1245
|
|
|
871
|
-
const {ICON_QUESTION} = sharedComponents.Icons;
|
|
872
1246
|
const COLOR_WHITEISH = "rgb(253, 253, 253)";
|
|
873
1247
|
const COLOR_BLACKISH = "rgb(51, 51, 51)";
|
|
874
1248
|
const THICK_LINE_THRESHOLD_FOR_DARKER_COLOR = 3;
|
|
@@ -955,6 +1329,9 @@
|
|
|
955
1329
|
},{
|
|
956
1330
|
type: sharedComponents.DateTimeBackground,
|
|
957
1331
|
placeholder: ".vzb-bc-date"
|
|
1332
|
+
},{
|
|
1333
|
+
type: decorated,
|
|
1334
|
+
placeholder: ".vzb-bc-axis-titles"
|
|
958
1335
|
}];
|
|
959
1336
|
|
|
960
1337
|
config.template = `
|
|
@@ -970,11 +1347,8 @@
|
|
|
970
1347
|
</svg>
|
|
971
1348
|
<svg class="vzb-bubblechart-svg-main">
|
|
972
1349
|
<g class="vzb-bc-graph">
|
|
973
|
-
<g class="vzb-bc-axis-
|
|
974
|
-
<g class="vzb-bc-axis-x-info vzb-noexport"></g>
|
|
1350
|
+
<g class="vzb-bc-axis-titles"></g>
|
|
975
1351
|
|
|
976
|
-
<g class="vzb-bc-axis-y-title"><text></text></g>
|
|
977
|
-
<g class="vzb-bc-axis-y-info vzb-noexport"></g>
|
|
978
1352
|
<svg class="vzb-bc-bubbles-crop">
|
|
979
1353
|
<g class="vzb-zoom-selection"></g>
|
|
980
1354
|
<rect class="vzb-bc-eventarea"></rect>
|
|
@@ -983,11 +1357,6 @@
|
|
|
983
1357
|
<rect class="vzb-bc-forecastoverlay vzb-hidden" x="0" y="0" width="100%" height="100%" fill="url(#vzb-bc-pattern-lines-${config.id})" pointer-events='none'></rect>
|
|
984
1358
|
</svg>
|
|
985
1359
|
|
|
986
|
-
<g class="vzb-bc-axis-y-subtitle"><text></text></g>
|
|
987
|
-
<g class="vzb-bc-axis-x-subtitle"><text></text></g>
|
|
988
|
-
<g class="vzb-bc-axis-s-title"><text></text></g>
|
|
989
|
-
<g class="vzb-bc-axis-c-title"><text></text></g>
|
|
990
|
-
|
|
991
1360
|
<rect class="vzb-bc-zoom-rect"></rect>
|
|
992
1361
|
</g>
|
|
993
1362
|
<g class="vzb-datawarning-button vzb-noexport"></g>
|
|
@@ -1046,14 +1415,6 @@
|
|
|
1046
1415
|
this.DOM.chartSvg.select(".vzb-bc-graph").call(graph =>
|
|
1047
1416
|
Object.assign(this.DOM, {
|
|
1048
1417
|
graph: graph,
|
|
1049
|
-
ySubTitleEl: graph.select(".vzb-bc-axis-y-subtitle"),
|
|
1050
|
-
xSubTitleEl: graph.select(".vzb-bc-axis-x-subtitle"),
|
|
1051
|
-
yTitleEl: graph.select(".vzb-bc-axis-y-title"),
|
|
1052
|
-
xTitleEl: graph.select(".vzb-bc-axis-x-title"),
|
|
1053
|
-
sTitleEl: graph.select(".vzb-bc-axis-s-title"),
|
|
1054
|
-
cTitleEl: graph.select(".vzb-bc-axis-c-title"),
|
|
1055
|
-
yInfoEl: graph.select(".vzb-bc-axis-y-info"),
|
|
1056
|
-
xInfoEl: graph.select(".vzb-bc-axis-x-info"),
|
|
1057
1418
|
trailsContainer: graph.select(".vzb-bc-trails"),
|
|
1058
1419
|
bubbleContainer: graph.select(".vzb-bc-bubbles"),
|
|
1059
1420
|
bubbleContainerCrop: graph.select(".vzb-bc-bubbles-crop"),
|
|
@@ -1092,12 +1453,10 @@
|
|
|
1092
1453
|
this._labels = this.findChild({type: "Labels"});
|
|
1093
1454
|
this._panZoom = new PanZoom(this);
|
|
1094
1455
|
this.decorations = new BCDecorations(this);
|
|
1095
|
-
this._initInfoElements();
|
|
1096
1456
|
|
|
1097
1457
|
this.xAxis = sharedComponents.axisSmart("bottom");
|
|
1098
1458
|
this.yAxis = sharedComponents.axisSmart("left");
|
|
1099
1459
|
|
|
1100
|
-
this.axisTitleComplimentStrings = {Y: "", X: "", S: "", C: ""};
|
|
1101
1460
|
|
|
1102
1461
|
this.isCanvasPreviouslyExpanded = false;
|
|
1103
1462
|
this.draggingNow = null;
|
|
@@ -1144,51 +1503,6 @@
|
|
|
1144
1503
|
|
|
1145
1504
|
}
|
|
1146
1505
|
|
|
1147
|
-
_initInfoElements() {
|
|
1148
|
-
const _this = this;
|
|
1149
|
-
const dataNotesDialog = () => this.root.findChild({type: "DataNotes"});
|
|
1150
|
-
const timeSlider = () => this.root.findChild({type: "TimeSlider"});
|
|
1151
|
-
|
|
1152
|
-
sharedComponents.LegacyUtils.setIcon(this.DOM.yInfoEl, ICON_QUESTION)
|
|
1153
|
-
.on("click", () => {
|
|
1154
|
-
dataNotesDialog().pin();
|
|
1155
|
-
})
|
|
1156
|
-
.on("mouseover", function() {
|
|
1157
|
-
if (timeSlider().ui.dragging) return;
|
|
1158
|
-
const rect = this.getBBox();
|
|
1159
|
-
const coord = sharedComponents.LegacyUtils.makeAbsoluteContext(this, this.farthestViewportElement)(rect.x - 10, rect.y + rect.height + 10);
|
|
1160
|
-
const toolRect = _this.root.element.node().getBoundingClientRect();
|
|
1161
|
-
const chartRect = _this.element.node().getBoundingClientRect();
|
|
1162
|
-
dataNotesDialog()
|
|
1163
|
-
.setEncoding(_this.MDL.y)
|
|
1164
|
-
.show()
|
|
1165
|
-
.setPos(coord.x + chartRect.left - toolRect.left, coord.y);
|
|
1166
|
-
})
|
|
1167
|
-
.on("mouseout", () => {
|
|
1168
|
-
if (timeSlider().ui.dragging) return;
|
|
1169
|
-
dataNotesDialog().hide();
|
|
1170
|
-
});
|
|
1171
|
-
|
|
1172
|
-
sharedComponents.LegacyUtils.setIcon(this.DOM.xInfoEl, ICON_QUESTION)
|
|
1173
|
-
.on("click", () => {
|
|
1174
|
-
dataNotesDialog().pin();
|
|
1175
|
-
})
|
|
1176
|
-
.on("mouseover", function() {
|
|
1177
|
-
if (timeSlider().ui.dragging) return;
|
|
1178
|
-
const rect = this.getBBox();
|
|
1179
|
-
const coord = sharedComponents.LegacyUtils.makeAbsoluteContext(this, this.farthestViewportElement)(rect.x - 10, rect.y + rect.height + 10);
|
|
1180
|
-
const toolRect = _this.root.element.node().getBoundingClientRect();
|
|
1181
|
-
const chartRect = _this.element.node().getBoundingClientRect();
|
|
1182
|
-
dataNotesDialog()
|
|
1183
|
-
.setEncoding(_this.MDL.x)
|
|
1184
|
-
.show()
|
|
1185
|
-
.setPos(coord.x + chartRect.left - toolRect.left, coord.y);
|
|
1186
|
-
})
|
|
1187
|
-
.on("mouseout", () => {
|
|
1188
|
-
if (timeSlider().ui.dragging) return;
|
|
1189
|
-
dataNotesDialog().hide();
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
1506
|
|
|
1193
1507
|
get MDL(){
|
|
1194
1508
|
return {
|
|
@@ -1218,10 +1532,7 @@
|
|
|
1218
1532
|
|
|
1219
1533
|
if (this._updateLayoutProfile()) return; //return if exists with error
|
|
1220
1534
|
this.addReaction(this._updateScales);
|
|
1221
|
-
this.addReaction(this.updateUIStrings);
|
|
1222
|
-
this.addReaction(this.updateTreemenu);
|
|
1223
1535
|
this.addReaction(this._updateSize);
|
|
1224
|
-
this.addReaction(this.updateInfoElements);
|
|
1225
1536
|
// this.addReaction(this._resetZoomMinMaxXReaction, this._resetZoomMinMaxX);
|
|
1226
1537
|
// this.addReaction(this._resetZoomMinMaxYReaction, this._resetZoomMinMaxY);
|
|
1227
1538
|
this.addReaction(this._updateOpacity);
|
|
@@ -1755,76 +2066,7 @@
|
|
|
1755
2066
|
return this.MDL.color.scale.d3Scale;
|
|
1756
2067
|
}
|
|
1757
2068
|
|
|
1758
|
-
updateUIStrings() {
|
|
1759
|
-
const {
|
|
1760
|
-
y, x, size, color
|
|
1761
|
-
} = this.MDL;
|
|
1762
|
-
|
|
1763
|
-
this.strings = {
|
|
1764
|
-
title: {
|
|
1765
|
-
Y: sharedComponents.Utils.getConceptName(y, this.localise),
|
|
1766
|
-
X: sharedComponents.Utils.getConceptName(x, this.localise),
|
|
1767
|
-
S: sharedComponents.Utils.getConceptName(size, this.localise),
|
|
1768
|
-
C: sharedComponents.Utils.getConceptName(color, this.localise)
|
|
1769
|
-
},
|
|
1770
|
-
title_short: {
|
|
1771
|
-
Y: sharedComponents.Utils.getConceptShortName(y, this.localise),
|
|
1772
|
-
X: sharedComponents.Utils.getConceptShortName(x, this.localise),
|
|
1773
|
-
S: sharedComponents.Utils.getConceptShortName(size, this.localise),
|
|
1774
|
-
C: sharedComponents.Utils.getConceptShortName(color, this.localise)
|
|
1775
|
-
},
|
|
1776
|
-
subtitle: {
|
|
1777
|
-
Y: sharedComponents.Utils.getConceptNameMinusShortName(y, this.localise),
|
|
1778
|
-
X: sharedComponents.Utils.getConceptNameMinusShortName(x, this.localise)
|
|
1779
|
-
},
|
|
1780
|
-
unit: {
|
|
1781
|
-
Y: sharedComponents.Utils.getConceptUnit(y),
|
|
1782
|
-
X: sharedComponents.Utils.getConceptUnit(x),
|
|
1783
|
-
S: sharedComponents.Utils.getConceptUnit(size),
|
|
1784
|
-
C: sharedComponents.Utils.getConceptUnit(color)
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
|
-
Promise.all([
|
|
1789
|
-
sharedComponents.Utils.getConceptNameCompliment(y),
|
|
1790
|
-
sharedComponents.Utils.getConceptNameCompliment(x),
|
|
1791
|
-
sharedComponents.Utils.getConceptNameCompliment(size),
|
|
1792
|
-
sharedComponents.Utils.getConceptNameCompliment(color)
|
|
1793
|
-
]).then(mobx.action(response => {
|
|
1794
|
-
[
|
|
1795
|
-
this.axisTitleComplimentStrings.Y,
|
|
1796
|
-
this.axisTitleComplimentStrings.X,
|
|
1797
|
-
this.axisTitleComplimentStrings.S,
|
|
1798
|
-
this.axisTitleComplimentStrings.C
|
|
1799
|
-
] = response;
|
|
1800
|
-
}));
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
updateTreemenu(){
|
|
1804
|
-
const treemenu = this.root.findChild({type: "TreeMenu"});
|
|
1805
|
-
|
|
1806
|
-
this.DOM.yTitleEl
|
|
1807
|
-
.classed("vzb-disabled", treemenu.state.ownReadiness !== sharedComponents.Utils.STATUS.READY)
|
|
1808
|
-
.on("click", () => {
|
|
1809
|
-
treemenu
|
|
1810
|
-
.encoding(this._alias("y"))
|
|
1811
|
-
.alignX(this.services.locale.isRTL() ? "right" : "left")
|
|
1812
|
-
.alignY("top")
|
|
1813
|
-
.updateView()
|
|
1814
|
-
.toggle();
|
|
1815
|
-
});
|
|
1816
2069
|
|
|
1817
|
-
this.DOM.xTitleEl
|
|
1818
|
-
.classed("vzb-disabled", treemenu.state.ownReadiness !== sharedComponents.Utils.STATUS.READY)
|
|
1819
|
-
.on("click", () => {
|
|
1820
|
-
treemenu
|
|
1821
|
-
.encoding(this._alias("x"))
|
|
1822
|
-
.alignX(this.services.locale.isRTL() ? "right" : "left")
|
|
1823
|
-
.alignY("bottom")
|
|
1824
|
-
.updateView()
|
|
1825
|
-
.toggle();
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
2070
|
|
|
1829
2071
|
_updateSize() {
|
|
1830
2072
|
this.services.layout.size;
|
|
@@ -1845,11 +2087,6 @@
|
|
|
1845
2087
|
yAxisEl,
|
|
1846
2088
|
projectionX,
|
|
1847
2089
|
projectionY,
|
|
1848
|
-
sTitleEl,
|
|
1849
|
-
xTitleEl,
|
|
1850
|
-
yTitleEl,
|
|
1851
|
-
xSubTitleEl,
|
|
1852
|
-
ySubTitleEl,
|
|
1853
2090
|
xAxisGroupsEl,
|
|
1854
2091
|
} = this.DOM;
|
|
1855
2092
|
|
|
@@ -1881,17 +2118,6 @@
|
|
|
1881
2118
|
.attr("width", width)
|
|
1882
2119
|
.attr("height", Math.max(0, height));
|
|
1883
2120
|
|
|
1884
|
-
//update scales to the new range
|
|
1885
|
-
// // if (this.model.marker.y.scaleType !== "ordinal") {
|
|
1886
|
-
// // this.yScale.range(this._rangeBump([height, 0]));
|
|
1887
|
-
// // } else {
|
|
1888
|
-
// // this.yScale.rangePoints([height, 0], _this.profileConstants.padding).range();
|
|
1889
|
-
// // }
|
|
1890
|
-
// // if (this.model.marker.x.scaleType !== "ordinal") {
|
|
1891
|
-
// // this.xScale.range(this._rangeBump([0, width]));
|
|
1892
|
-
// // } else {
|
|
1893
|
-
// // this.xScale.rangePoints([0, width], _this.profileConstants.padding).range();
|
|
1894
|
-
// // }
|
|
1895
2121
|
this.yScale.range(this._rangeBump([height, 0]));
|
|
1896
2122
|
this.xScale.range(this._rangeBump([0, width]));
|
|
1897
2123
|
|
|
@@ -1954,61 +2180,6 @@
|
|
|
1954
2180
|
projectionX.attr("y1", _this.yScale.range()[0] + rangeBump);
|
|
1955
2181
|
projectionY.attr("x2", _this.xScale.range()[0] - rangeBump);
|
|
1956
2182
|
|
|
1957
|
-
|
|
1958
|
-
// reduce font size if the caption doesn't fit
|
|
1959
|
-
this._updateSTitle();
|
|
1960
|
-
sTitleEl
|
|
1961
|
-
.attr("text-anchor", "end")
|
|
1962
|
-
.attr("transform", "translate(" + width + "," + 20 + ") rotate(-90)");
|
|
1963
|
-
|
|
1964
|
-
const compl = this.axisTitleComplimentStrings;
|
|
1965
|
-
if (layoutProfile !== "SMALL") {
|
|
1966
|
-
ySubTitleEl.select("text").attr("dy", infoElHeight * 0.6).text(this.strings.subtitle.Y);
|
|
1967
|
-
xSubTitleEl.select("text").attr("dy", -infoElHeight * 0.3).text(this.strings.subtitle.X);
|
|
1968
|
-
|
|
1969
|
-
yTitleEl.select("text").text(this.strings.title_short.Y + (compl.Y ? " · " + compl.Y : "") + " ")
|
|
1970
|
-
.append("tspan")
|
|
1971
|
-
.classed("vzb-noexport", true)
|
|
1972
|
-
.style("font-size", (infoElHeight * 0.7) + "px")
|
|
1973
|
-
.text("▼");
|
|
1974
|
-
xTitleEl.select("text").text(this.strings.title_short.X + (compl.X ? " · " + compl.X : "") + " ")
|
|
1975
|
-
.append("tspan")
|
|
1976
|
-
.classed("vzb-noexport", true)
|
|
1977
|
-
.style("font-size", (infoElHeight * 0.7) + "px")
|
|
1978
|
-
.text("▼");
|
|
1979
|
-
} else {
|
|
1980
|
-
ySubTitleEl.select("text").text("");
|
|
1981
|
-
xSubTitleEl.select("text").text("");
|
|
1982
|
-
|
|
1983
|
-
const yTitleText = yTitleEl.select("text").text(this.strings.title.Y + (compl.Y ? " · " + compl.Y : ""));
|
|
1984
|
-
if (yTitleText.node().getBBox().width > width) yTitleText.text(this.strings.title_short.Y + (compl.Y ? " · " + compl.Y : ""));
|
|
1985
|
-
|
|
1986
|
-
const xTitleText = xTitleEl.select("text").text(this.strings.title.X + (compl.X ? " · " + compl.X : ""));
|
|
1987
|
-
if (xTitleText.node().getBBox().width > width - 100) xTitleText.text(this.strings.title_short.X) + (compl.X ? " · " + compl.X : "");
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
const isRTL = this.services.locale.isRTL();
|
|
1991
|
-
ySubTitleEl
|
|
1992
|
-
.style("font-size", (infoElHeight * 0.8) + "px")
|
|
1993
|
-
.attr("transform", "translate(" + 0 + "," + 0 + ") rotate(-90)");
|
|
1994
|
-
xSubTitleEl
|
|
1995
|
-
.style("font-size", (infoElHeight * 0.8) + "px")
|
|
1996
|
-
.attr("transform", "translate(" + width + "," + height + ")");
|
|
1997
|
-
|
|
1998
|
-
yTitleEl
|
|
1999
|
-
.style("font-size", infoElHeight + "px")
|
|
2000
|
-
.attr("transform", layoutProfile !== "SMALL" ?
|
|
2001
|
-
"translate(" + (-margin.left - this.profileConstants.yAxisTitleBottomMargin) + "," + (height * 0.5) + ") rotate(-90)"
|
|
2002
|
-
:
|
|
2003
|
-
"translate(" + (isRTL ? width : 10 - this.profileConstants.margin.left) + ", -" + this.profileConstants.yAxisTitleBottomMargin + ")");
|
|
2004
|
-
|
|
2005
|
-
xTitleEl
|
|
2006
|
-
.style("font-size", infoElHeight + "px")
|
|
2007
|
-
.attr("transform", layoutProfile !== "SMALL" ?
|
|
2008
|
-
"translate(" + (width * 0.5) + "," + (height + margin.bottom - xAxisTitleBottomMargin) + ")"
|
|
2009
|
-
:
|
|
2010
|
-
"translate(" + (isRTL ? width : 0) + "," + (height + margin.bottom - xAxisTitleBottomMargin) + ")");
|
|
2011
|
-
|
|
2012
2183
|
xAxisGroupsEl
|
|
2013
2184
|
.style("font-size", infoElHeight * 0.8 + "px");
|
|
2014
2185
|
|
|
@@ -2020,65 +2191,11 @@
|
|
|
2020
2191
|
right: margin.right,
|
|
2021
2192
|
bottom: xAxisTitleBottomMargin,
|
|
2022
2193
|
wLimit: (layoutProfile !== "SMALL" ? 0.5 : 1) *
|
|
2023
|
-
(this.elementWidth -
|
|
2194
|
+
(this.elementWidth - this.DOM.graph.select(".vzb-bc-axis-x-title").node().getBBox().width - infoElHeight * 3)
|
|
2024
2195
|
});
|
|
2025
2196
|
|
|
2026
|
-
//this.services.layout.setHGrid([this.elementWidth - marginRightAdjusted]);
|
|
2027
|
-
//this.ui.margin.set("left", margin.left * this.profileConstants.leftMarginRatio, false, false);
|
|
2028
|
-
|
|
2029
|
-
// (function(xMin, xMax, yMin, yMax) {
|
|
2030
|
-
// if ((xMin && xMax && yMin && yMax) === null) return;
|
|
2031
|
-
// _this._panZoom.zoomer.dontFeedToState = true;
|
|
2032
|
-
// _this._panZoom.rerun(); // includes redraw data points and trail resize
|
|
2033
|
-
// _this._panZoom.zoomToMaxMin(xMin, xMax, yMin, yMax, 0, true);
|
|
2034
|
-
// })(_this._zoomedXYMinMax.x.zoomedMin,
|
|
2035
|
-
// _this._zoomedXYMinMax.x.zoomedMax,
|
|
2036
|
-
// _this._zoomedXYMinMax.y.zoomedMin,
|
|
2037
|
-
// _this._zoomedXYMinMax.y.zoomedMax);
|
|
2038
2197
|
}
|
|
2039
2198
|
|
|
2040
|
-
updateInfoElements() {
|
|
2041
|
-
this.services.layout.size;
|
|
2042
|
-
this.axisTitleComplimentStrings.X;
|
|
2043
|
-
this.axisTitleComplimentStrings.Y;
|
|
2044
|
-
|
|
2045
|
-
const {xInfoEl, yInfoEl, xTitleEl, yTitleEl} = this.DOM;
|
|
2046
|
-
const {x, y} = this.MDL;
|
|
2047
|
-
const isRTL = this.services.locale.isRTL();
|
|
2048
|
-
const infoElHeight = this.profileConstants.infoElHeight;
|
|
2049
|
-
const layoutProfile = this.services.layout.profile;
|
|
2050
|
-
|
|
2051
|
-
if (yInfoEl.select("svg").node()) {
|
|
2052
|
-
const titleBBox = yTitleEl.node().getBBox();
|
|
2053
|
-
const t = sharedComponents.LegacyUtils.transform(yTitleEl.node());
|
|
2054
|
-
const hTranslate = isRTL ? (titleBBox.x + t.translateX - infoElHeight * 1.4) : (titleBBox.x + t.translateX + titleBBox.width + infoElHeight * 0.4);
|
|
2055
|
-
const vTranslate = isRTL ? (t.translateY + infoElHeight * 1.4 + titleBBox.width * 0.5) : (t.translateY - infoElHeight * 0.4 - titleBBox.width * 0.5);
|
|
2056
|
-
const conceptPropsY = y.data.conceptProps;
|
|
2057
|
-
|
|
2058
|
-
yInfoEl
|
|
2059
|
-
.classed("vzb-hidden", !conceptPropsY.description && !conceptPropsY.sourceLink || this.services.layout.projector)
|
|
2060
|
-
.attr("transform", layoutProfile !== "SMALL" ?
|
|
2061
|
-
`translate(${ t.translateX - infoElHeight * 0.8 }, ${ vTranslate }) rotate(-90)` :
|
|
2062
|
-
`translate(${ hTranslate },${ t.translateY - infoElHeight * 0.8 })`)
|
|
2063
|
-
.select("svg")
|
|
2064
|
-
.attr("width", infoElHeight + "px")
|
|
2065
|
-
.attr("height", infoElHeight + "px");
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
if (xInfoEl.select("svg").node()) {
|
|
2069
|
-
const titleBBox = xTitleEl.node().getBBox();
|
|
2070
|
-
const t = sharedComponents.LegacyUtils.transform(xTitleEl.node());
|
|
2071
|
-
const hTranslate = isRTL ? (titleBBox.x + t.translateX - infoElHeight * 1.4) : (titleBBox.x + t.translateX + titleBBox.width + infoElHeight * 0.4);
|
|
2072
|
-
const conceptPropsX = x.data.conceptProps;
|
|
2073
|
-
|
|
2074
|
-
xInfoEl
|
|
2075
|
-
.classed("vzb-hidden", !conceptPropsX.description && !conceptPropsX.sourceLink || this.services.layout.projector)
|
|
2076
|
-
.attr("transform", `translate(${ hTranslate }, ${ t.translateY - infoElHeight * 0.8 })`)
|
|
2077
|
-
.select("svg")
|
|
2078
|
-
.attr("width", infoElHeight + "px")
|
|
2079
|
-
.attr("height", infoElHeight + "px");
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
2199
|
|
|
2083
2200
|
_rangeBump(arg, undo) {
|
|
2084
2201
|
const bump = this.profileConstants.maxRadiusPx;
|
|
@@ -2104,40 +2221,6 @@
|
|
|
2104
2221
|
sharedComponents.LegacyUtils.warn("rangeBump error: input is not an array or empty");
|
|
2105
2222
|
}
|
|
2106
2223
|
|
|
2107
|
-
_updateSTitle(titleS, titleC) {
|
|
2108
|
-
const { sTitleEl } = this.DOM;
|
|
2109
|
-
const {
|
|
2110
|
-
size,
|
|
2111
|
-
color
|
|
2112
|
-
} = this.MDL;
|
|
2113
|
-
const compl = this.axisTitleComplimentStrings;
|
|
2114
|
-
// vertical text about size and color
|
|
2115
|
-
if (this.profileConstants.hideSTitle
|
|
2116
|
-
&& this.root.ui.dialogs.dialogs.sidebar.indexOf("colors") > -1
|
|
2117
|
-
&& this.root.ui.dialogs.dialogs.sidebar.indexOf("size") > -1) {
|
|
2118
|
-
sTitleEl.classed("vzb-invisible", true);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
if (sTitleEl.classed("vzb-invisible")) {
|
|
2122
|
-
sTitleEl.classed("vzb-invisible", false);
|
|
2123
|
-
}
|
|
2124
|
-
const sTitleContentON = !size.data.constant;
|
|
2125
|
-
const cTitleContentON = !color.data.constant;
|
|
2126
|
-
const sTitleText = sTitleEl.select("text")
|
|
2127
|
-
// reset font size to remove jumpy measurement
|
|
2128
|
-
.style("font-size", null)
|
|
2129
|
-
.text(
|
|
2130
|
-
(sTitleContentON ? this.localise("buttons/size") + ": " + (titleS ? titleS : this.strings.title.S) : "") +
|
|
2131
|
-
(compl.S ? " · " + compl.S : "") +
|
|
2132
|
-
(sTitleContentON && cTitleContentON ? ", " : "") +
|
|
2133
|
-
(cTitleContentON ? this.localise("buttons/colors") + ": " + (titleC ? titleC : this.strings.title.C) : "") +
|
|
2134
|
-
(compl.C ? " · " + compl.C : "")
|
|
2135
|
-
);
|
|
2136
|
-
const sTitleWidth = sTitleText.node().getBBox().width;
|
|
2137
|
-
const remainigHeight = this.height - 30;
|
|
2138
|
-
const font = parseInt(sTitleText.style("font-size")) * remainigHeight / sTitleWidth;
|
|
2139
|
-
sTitleText.style("font-size", sTitleWidth > remainigHeight ? font + "px" : null);
|
|
2140
|
-
}
|
|
2141
2224
|
|
|
2142
2225
|
processFrameData() {
|
|
2143
2226
|
return this.__dataProcessed = this.model.dataArray;
|
|
@@ -2372,8 +2455,6 @@
|
|
|
2372
2455
|
const c = _this.__getColor(selectedKey, d.color);
|
|
2373
2456
|
let entityOutOfView = false;
|
|
2374
2457
|
|
|
2375
|
-
////const titles = _this._formatSTitleValues(values.size[utils.getKey(d, dataKeys.size)], values.color[utils.getKey(d, dataKeys.color)]);
|
|
2376
|
-
////_this._updateSTitle(titles[0], titles[1]);
|
|
2377
2458
|
if (x + s < 0 || x - s > this.width || y + s < 0 || y - s > this.height) {
|
|
2378
2459
|
entityOutOfView = true;
|
|
2379
2460
|
}
|
|
@@ -2421,7 +2502,6 @@
|
|
|
2421
2502
|
this._axisProjections();
|
|
2422
2503
|
////this._trails.run(["opacityHandler"]);
|
|
2423
2504
|
//hide tooltip
|
|
2424
|
-
//this._updateSTitle();
|
|
2425
2505
|
this._setTooltip();
|
|
2426
2506
|
this._setBubbleCrown();
|
|
2427
2507
|
this._labels.highlight(null, false);
|
|
@@ -2624,7 +2704,6 @@
|
|
|
2624
2704
|
//export default BubbleChart;
|
|
2625
2705
|
const VizabiBubbleChart = mobx.decorate(_VizabiBubbleChart, {
|
|
2626
2706
|
"MDL": mobx.computed,
|
|
2627
|
-
"axisTitleComplimentStrings": mobx.observable,
|
|
2628
2707
|
"cScale": mobx.computed
|
|
2629
2708
|
});
|
|
2630
2709
|
|
|
@@ -2786,9 +2865,11 @@
|
|
|
2786
2865
|
}
|
|
2787
2866
|
});
|
|
2788
2867
|
|
|
2789
|
-
BubbleChart.versionInfo = { version: "
|
|
2868
|
+
BubbleChart.versionInfo = { version: "4.0.0", build: 1687772747236, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
|
|
2869
|
+
|
|
2870
|
+
exports.Base = BubbleChart;
|
|
2790
2871
|
|
|
2791
|
-
|
|
2872
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2792
2873
|
|
|
2793
2874
|
}));
|
|
2794
2875
|
//# sourceMappingURL=bubblechart.js.map
|