billboard.js 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +4511 -7069
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +7862 -11555
- package/dist/billboard.pkgd.min.js +2 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +27 -62
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +303 -528
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +368 -648
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +305 -513
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +306 -500
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2055 -2248
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2826 -3485
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3080 -3996
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2829 -3471
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2970 -3817
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist-esm/billboard.js +30 -27
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -8
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -8
- package/package.json +23 -23
- package/src/ChartInternal/data/IData.ts +8 -2
- package/src/ChartInternal/interactions/interaction.ts +39 -26
- package/types/options.d.ts +7 -0
|
@@ -7,6 +7,7 @@ import {drag as d3Drag} from "d3-drag";
|
|
|
7
7
|
import {$ARC, $AXIS, $COMMON, $SHAPE} from "../../config/classes";
|
|
8
8
|
import {KEY} from "../../module/Cache";
|
|
9
9
|
import {emulateEvent, getPointer, isNumber, isObject} from "../../module/util";
|
|
10
|
+
import type {IArcDataRow} from "../data/IData";
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
selectRectForSingle(context, eventRect, index: number): void {
|
|
@@ -27,24 +28,26 @@ export default {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
main.selectAll(`.${$SHAPE.shape}-${index}`)
|
|
31
|
+
const shapeAtIndex = main.selectAll(`.${$SHAPE.shape}-${index}`)
|
|
31
32
|
.each(function() {
|
|
32
33
|
d3Select(this).classed($COMMON.EXPANDED, true);
|
|
33
34
|
|
|
34
35
|
if (isSelectionEnabled) {
|
|
35
36
|
eventRect.style("cursor", isSelectionGrouped ? "pointer" : null);
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
if (!isTooltipGrouped) {
|
|
39
|
-
$$.hideGridFocus?.();
|
|
40
|
-
$$.hideTooltip();
|
|
41
|
-
|
|
42
|
-
!isSelectionGrouped && $$.setExpand(index);
|
|
43
|
-
}
|
|
44
38
|
})
|
|
45
39
|
.filter(function(d) {
|
|
46
40
|
return $$.isWithinShape(this, d);
|
|
47
|
-
})
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
|
44
|
+
$$.hideGridFocus?.();
|
|
45
|
+
$$.hideTooltip();
|
|
46
|
+
|
|
47
|
+
!isSelectionGrouped && $$.setExpand(index);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
shapeAtIndex
|
|
48
51
|
.call(selected => {
|
|
49
52
|
const d = selected.data();
|
|
50
53
|
|
|
@@ -107,42 +110,52 @@ export default {
|
|
|
107
110
|
* @param {number|object} d data object
|
|
108
111
|
* @private
|
|
109
112
|
*/
|
|
110
|
-
setOverOut(isOver: boolean, d): void {
|
|
113
|
+
setOverOut(isOver: boolean, d: number | IArcDataRow): void {
|
|
111
114
|
const $$ = this;
|
|
112
115
|
const {config, state: {hasRadar}, $el: {main}} = $$;
|
|
113
116
|
const isArc = isObject(d);
|
|
114
117
|
|
|
115
118
|
// Call event handler
|
|
116
119
|
if (isArc || d !== -1) {
|
|
117
|
-
|
|
120
|
+
const callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
118
121
|
|
|
119
122
|
config.color_onover && $$.setOverColor(isOver, d, isArc);
|
|
120
123
|
|
|
121
|
-
if (isArc) {
|
|
122
|
-
callback(d, main.select(`.${$ARC.arc}${$$.getTargetSelectorSuffix(d.id)}`).node());
|
|
124
|
+
if (isArc && "id") {
|
|
125
|
+
callback(d, main.select(`.${$ARC.arc}${$$.getTargetSelectorSuffix((d as IArcDataRow).id)}`).node());
|
|
123
126
|
} else if (!config.tooltip_grouped) {
|
|
124
|
-
|
|
127
|
+
const last = $$.cache.get(KEY.setOverOut) || [];
|
|
125
128
|
|
|
126
|
-
|
|
129
|
+
// select based on the index
|
|
130
|
+
const shapesAtIndex = main.selectAll(`.${$SHAPE.shape}-${d}`)
|
|
127
131
|
.filter(function(d) {
|
|
128
132
|
return $$.isWithinShape(this, d);
|
|
129
133
|
});
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
last.push(this);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
135
|
+
// filter if has new selection
|
|
136
|
+
const shape = shapesAtIndex.filter(function() {
|
|
137
|
+
return last.every(v => v !== this);
|
|
138
|
+
});
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
// call onout callback
|
|
141
|
+
if (!isOver || shapesAtIndex.empty() || (
|
|
142
|
+
last.length === shape.size() && shape.nodes().every(((v, i) => v !== last[i]))
|
|
143
|
+
)) {
|
|
144
|
+
while (last.length) {
|
|
145
|
+
const target = last.pop();
|
|
141
146
|
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
config.data_onout.bind($$.api)(d3Select(target).datum(), target);
|
|
148
|
+
}
|
|
144
149
|
}
|
|
145
150
|
|
|
151
|
+
// call onover callback
|
|
152
|
+
shape.each(function() {
|
|
153
|
+
if (isOver) {
|
|
154
|
+
callback(d3Select(this).datum(), this);
|
|
155
|
+
last.push(this);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
146
159
|
$$.cache.add(KEY.setOverOut, last);
|
|
147
160
|
} else {
|
|
148
161
|
if (isOver) {
|
package/types/options.d.ts
CHANGED
|
@@ -82,6 +82,13 @@ export interface ChartOptions {
|
|
|
82
82
|
height?: number;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
svg?: {
|
|
86
|
+
/**
|
|
87
|
+
* Set svg element's class name
|
|
88
|
+
*/
|
|
89
|
+
classname?: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
85
92
|
/**
|
|
86
93
|
* Set padding of chart, and accepts object or boolean type.
|
|
87
94
|
* - `Object`: Specify each side's padding.
|