@vizabi/bubblechart 4.0.1 → 4.1.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.js +23 -8
- package/build/bubblechart.js.map +1 -1
- package/build/stats.html +1 -1
- package/package.json +1 -1
package/build/bubblechart.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// https://github.com/vizabi/bubblechart#readme v4.0
|
|
1
|
+
// https://github.com/vizabi/bubblechart#readme v4.1.0 build 1701715944325 Copyright 2023 Gapminder Foundation and contributors
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@vizabi/shared-components'), require('d3'), require('mobx')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', '@vizabi/shared-components', 'd3', 'mobx'], factory) :
|
|
@@ -2076,6 +2076,8 @@
|
|
|
2076
2076
|
y
|
|
2077
2077
|
} = this.MDL;
|
|
2078
2078
|
|
|
2079
|
+
this.model.encoding.y.scale.d3Scale;
|
|
2080
|
+
|
|
2079
2081
|
const {
|
|
2080
2082
|
graphAll,
|
|
2081
2083
|
eventArea,
|
|
@@ -2121,20 +2123,29 @@
|
|
|
2121
2123
|
this.yScale.range(this._rangeBump([height, 0]));
|
|
2122
2124
|
this.xScale.range(this._rangeBump([0, width]));
|
|
2123
2125
|
|
|
2126
|
+
//only applied to swimming lane sclae
|
|
2127
|
+
const rankScaleModifications = y.scale.type === "rank"
|
|
2128
|
+
? {
|
|
2129
|
+
ticks: y.rollup.map(m => m.tickPosition),
|
|
2130
|
+
formatter: (d) => y.rollup.find(f => f.tickPosition === d).name,
|
|
2131
|
+
repositionLabels: Object.fromEntries(y.rollup.map(m => ([m.tickPosition, { x: 4 * infoElHeight, y: -infoElHeight }])))
|
|
2132
|
+
}
|
|
2133
|
+
: {};
|
|
2134
|
+
|
|
2124
2135
|
//apply scales to axes and redraw
|
|
2125
2136
|
this.yAxis.scale(this.yScale)
|
|
2126
2137
|
.tickSizeInner(-width)
|
|
2127
2138
|
.tickSizeOuter(0)
|
|
2128
2139
|
.tickPadding(6)
|
|
2129
2140
|
.tickSizeMinor(-width, 0)
|
|
2130
|
-
.labelerOptions({
|
|
2141
|
+
.labelerOptions(Object.assign({
|
|
2131
2142
|
scaleType: y.scale.type,
|
|
2132
2143
|
toolMargin: margin,
|
|
2133
2144
|
limitMaxTickNumber: 6,
|
|
2134
2145
|
bump: this.profileConstants.maxRadiusPx / 2,
|
|
2135
2146
|
viewportLength: height,
|
|
2136
2147
|
formatter: this.localise
|
|
2137
|
-
});
|
|
2148
|
+
}, rankScaleModifications));
|
|
2138
2149
|
|
|
2139
2150
|
this.xAxis.scale(this.xScale)
|
|
2140
2151
|
.tickSizeInner(-height)
|
|
@@ -2409,11 +2420,11 @@
|
|
|
2409
2420
|
.attr("x1", this.xScale(valueX) - radius);
|
|
2410
2421
|
}
|
|
2411
2422
|
|
|
2412
|
-
if (this.ui.whenHovering.higlightValueX) xAxisEl.call(
|
|
2423
|
+
if (this.ui.whenHovering.higlightValueX && this.MDL.x.scale.type !== "rank") xAxisEl.call(
|
|
2413
2424
|
this.xAxis.highlightValue(valueX)
|
|
2414
2425
|
);
|
|
2415
2426
|
|
|
2416
|
-
if (this.ui.whenHovering.higlightValueY) yAxisEl.call(
|
|
2427
|
+
if (this.ui.whenHovering.higlightValueY && this.MDL.y.scale.type !== "rank") yAxisEl.call(
|
|
2417
2428
|
this.yAxis.highlightValue(valueY)
|
|
2418
2429
|
);
|
|
2419
2430
|
|
|
@@ -2643,10 +2654,14 @@
|
|
|
2643
2654
|
}
|
|
2644
2655
|
|
|
2645
2656
|
__labelWithoutFrame(d) {
|
|
2657
|
+
const markerSpace = this.model.data.space;
|
|
2646
2658
|
if (typeof d.label == "object")
|
|
2647
2659
|
return Object.entries(d.label)
|
|
2648
|
-
.filter(
|
|
2649
|
-
|
|
2660
|
+
.filter(([k, v]) => k != this.MDL.frame.data.concept)
|
|
2661
|
+
//sort parts of the name along the marker space array, so we get geo, gender instead of gender, geo
|
|
2662
|
+
.sort(([ak, av], [bk, bv]) => markerSpace.indexOf(ak) - markerSpace.indexOf(bk))
|
|
2663
|
+
//add keys where values are numbers, such as "age: 69"
|
|
2664
|
+
.map(([k, v]) => sharedComponents.LegacyUtils.isNumber(v) ? k + ": " + v : v)
|
|
2650
2665
|
.join(", ");
|
|
2651
2666
|
if (d.label != null) return "" + d.label;
|
|
2652
2667
|
return d[Symbol.for("key")];
|
|
@@ -2865,7 +2880,7 @@
|
|
|
2865
2880
|
}
|
|
2866
2881
|
});
|
|
2867
2882
|
|
|
2868
|
-
BubbleChart.versionInfo = { version: "4.0
|
|
2883
|
+
BubbleChart.versionInfo = { version: "4.1.0", build: 1701715944325, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
|
|
2869
2884
|
|
|
2870
2885
|
exports.Base = BubbleChart;
|
|
2871
2886
|
|