billboard.js 4.0.2 → 4.0.3
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 +102 -71
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +16 -17
- package/dist/billboard.pkgd.js +102 -71
- package/dist/billboard.pkgd.min.js +22 -23
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- 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/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +1 -1
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +1 -1
- package/dist-esm/Chart/api/export.js +1 -1
- package/dist-esm/Chart/api/flow.js +1 -1
- package/dist-esm/Chart/api/focus.js +7 -11
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +1 -1
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +1 -1
- package/dist-esm/Chart/api/subchart.js +1 -1
- package/dist-esm/Chart/api/tooltip.js +1 -1
- package/dist-esm/Chart/api/x.js +1 -1
- package/dist-esm/Chart/api/zoom.js +1 -1
- package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
- package/dist-esm/ChartInternal/ChartInternal.js +1 -1
- package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
- package/dist-esm/ChartInternal/data/convert.js +1 -1
- package/dist-esm/ChartInternal/data/data.js +15 -6
- package/dist-esm/ChartInternal/data/load.js +1 -1
- package/dist-esm/ChartInternal/interactions/drag.js +1 -1
- package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
- package/dist-esm/ChartInternal/interactions/flow.js +1 -1
- package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
- package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
- package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +1 -1
- package/dist-esm/ChartInternal/internals/color.js +5 -5
- package/dist-esm/ChartInternal/internals/domain.js +1 -1
- package/dist-esm/ChartInternal/internals/format.js +1 -1
- package/dist-esm/ChartInternal/internals/grid.js +1 -1
- package/dist-esm/ChartInternal/internals/legend.js +1 -1
- package/dist-esm/ChartInternal/internals/redraw.js +1 -1
- package/dist-esm/ChartInternal/internals/region.js +1 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +1 -1
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +2 -2
- package/dist-esm/ChartInternal/internals/text.util.js +1 -1
- package/dist-esm/ChartInternal/internals/title.js +1 -1
- package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +26 -34
- package/dist-esm/ChartInternal/shape/arc.js +1 -1
- package/dist-esm/ChartInternal/shape/area.js +1 -1
- package/dist-esm/ChartInternal/shape/bar.js +23 -7
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +1 -1
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
- package/dist-esm/ChartInternal/shape/funnel.js +1 -1
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +2 -2
- package/dist-esm/ChartInternal/shape/point.js +22 -10
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +19 -4
- package/dist-esm/ChartInternal/shape/treemap.js +1 -1
- package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
- package/dist-esm/canvas/CanvasEngine.js +1 -1
- package/dist-esm/canvas/CanvasPainter.js +1 -1
- package/dist-esm/canvas/CanvasRenderer.js +1 -1
- package/dist-esm/canvas/CanvasTheme.js +1 -1
- package/dist-esm/canvas/HitDetector.js +1 -1
- package/dist-esm/canvas/axisTicks.js +1 -1
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +1 -1
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +1 -1
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -1
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +1 -1
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -1
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +1 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +1 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +1 -1
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +1 -1
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +3 -3
- package/dist-esm/index.canvas.js +1 -1
- package/dist-esm/index.esm.js +1 -1
- package/dist-esm/module/Cache.js +1 -1
- package/dist-esm/module/browser.js +1 -1
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +1 -1
- package/dist-esm/module/generator.js +1 -1
- package/dist-esm/module/sanitize.js +1 -1
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +1 -1
- package/dist-esm/module/util/object.js +1 -1
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +1 -1
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +1 -1
- package/src/Chart/api/focus.ts +8 -12
- package/src/ChartInternal/data/data.ts +15 -5
- package/src/ChartInternal/internals/color.ts +5 -4
- package/src/ChartInternal/internals/text.ts +1 -1
- package/src/ChartInternal/internals/type.ts +26 -32
- package/src/ChartInternal/shape/bar.ts +26 -7
- package/src/ChartInternal/shape/line.ts +1 -1
- package/src/ChartInternal/shape/point.ts +26 -12
- package/src/ChartInternal/shape/shape.ts +25 -3
|
@@ -6,6 +6,26 @@ import {TYPE, TYPE_BY_CATEGORY} from "../../config/const";
|
|
|
6
6
|
import {isArray, isNumber, isString} from "../../module/util";
|
|
7
7
|
import type {IData} from "../data/IData";
|
|
8
8
|
|
|
9
|
+
// Module-level constant: avoids re-creating the list on every isInterpolationType() call
|
|
10
|
+
// https://github.com/d3/d3-shape#curves
|
|
11
|
+
const INTERPOLATION_TYPES = new Set([
|
|
12
|
+
"basis",
|
|
13
|
+
"basis-closed",
|
|
14
|
+
"basis-open",
|
|
15
|
+
"bundle",
|
|
16
|
+
"cardinal",
|
|
17
|
+
"cardinal-closed",
|
|
18
|
+
"cardinal-open",
|
|
19
|
+
"catmull-rom",
|
|
20
|
+
"catmull-rom-closed",
|
|
21
|
+
"catmull-rom-open",
|
|
22
|
+
"linear",
|
|
23
|
+
"linear-closed",
|
|
24
|
+
"monotone-x",
|
|
25
|
+
"monotone-y",
|
|
26
|
+
"natural"
|
|
27
|
+
]);
|
|
28
|
+
|
|
9
29
|
export default {
|
|
10
30
|
/**
|
|
11
31
|
* Check if the given chart type is valid
|
|
@@ -68,29 +88,20 @@ export default {
|
|
|
68
88
|
const {config, state: {current}} = $$;
|
|
69
89
|
const types = config.data_types;
|
|
70
90
|
const targets = targetsValue || $$.data.targets;
|
|
71
|
-
let has = false;
|
|
72
91
|
|
|
73
92
|
if (!checkFromData && current.types?.indexOf(type) > -1) {
|
|
74
|
-
|
|
93
|
+
return true;
|
|
75
94
|
} else if (targets?.length) {
|
|
76
|
-
targets.
|
|
95
|
+
return targets.some(target => {
|
|
77
96
|
const t = types[target.id];
|
|
78
97
|
|
|
79
|
-
|
|
80
|
-
has = true;
|
|
81
|
-
}
|
|
98
|
+
return t === type || (!t && type === "line");
|
|
82
99
|
});
|
|
83
100
|
} else if (Object.keys(types).length) {
|
|
84
|
-
Object.
|
|
85
|
-
if (types[id] === type) {
|
|
86
|
-
has = true;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
has = config.data_type === type;
|
|
101
|
+
return Object.values(types).some(t => t === type);
|
|
91
102
|
}
|
|
92
103
|
|
|
93
|
-
return
|
|
104
|
+
return config.data_type === type;
|
|
94
105
|
},
|
|
95
106
|
|
|
96
107
|
/**
|
|
@@ -266,24 +277,7 @@ export default {
|
|
|
266
277
|
return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
|
|
267
278
|
},
|
|
268
279
|
|
|
269
|
-
// https://github.com/d3/d3-shape#curves
|
|
270
280
|
isInterpolationType(type: string): boolean {
|
|
271
|
-
return
|
|
272
|
-
"basis",
|
|
273
|
-
"basis-closed",
|
|
274
|
-
"basis-open",
|
|
275
|
-
"bundle",
|
|
276
|
-
"cardinal",
|
|
277
|
-
"cardinal-closed",
|
|
278
|
-
"cardinal-open",
|
|
279
|
-
"catmull-rom",
|
|
280
|
-
"catmull-rom-closed",
|
|
281
|
-
"catmull-rom-open",
|
|
282
|
-
"linear",
|
|
283
|
-
"linear-closed",
|
|
284
|
-
"monotone-x",
|
|
285
|
-
"monotone-y",
|
|
286
|
-
"natural"
|
|
287
|
-
].indexOf(type) >= 0;
|
|
281
|
+
return INTERPOLATION_TYPES.has(type);
|
|
288
282
|
}
|
|
289
283
|
};
|
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
|
|
111
111
|
$root.bar = bar.enter().append("path")
|
|
112
112
|
.attr("class", classBar)
|
|
113
|
-
.style("fill", $$.
|
|
113
|
+
.style("fill", $$.generateUpdateBarColor())
|
|
114
114
|
.merge(bar)
|
|
115
115
|
.style("opacity", initialOpacity);
|
|
116
116
|
|
|
@@ -118,6 +118,19 @@ export default {
|
|
|
118
118
|
$$.setRatioForGroupedData($root.bar.data());
|
|
119
119
|
},
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Generate bar color accessor, hoisting the bound color function
|
|
123
|
+
* to be created once per call (not per datum)
|
|
124
|
+
* @returns {function} Color accessor
|
|
125
|
+
* @private
|
|
126
|
+
*/
|
|
127
|
+
generateUpdateBarColor(): (d: IBarData) => string | null {
|
|
128
|
+
const $$ = this;
|
|
129
|
+
const fn = $$.getStylePropValue($$.color) || (() => null);
|
|
130
|
+
|
|
131
|
+
return (d: IBarData) => getShapeColorWithGradient.call($$, d, "bar_linearGradient", fn);
|
|
132
|
+
},
|
|
133
|
+
|
|
121
134
|
/**
|
|
122
135
|
* Update bar color
|
|
123
136
|
* @param {object} d Data object
|
|
@@ -125,10 +138,7 @@ export default {
|
|
|
125
138
|
* @private
|
|
126
139
|
*/
|
|
127
140
|
updateBarColor(d: IBarData): string | null {
|
|
128
|
-
|
|
129
|
-
const fn = $$.getStylePropValue($$.color);
|
|
130
|
-
|
|
131
|
-
return getShapeColorWithGradient.call($$, d, "bar_linearGradient", fn || (() => null));
|
|
141
|
+
return this.generateUpdateBarColor()(d);
|
|
132
142
|
},
|
|
133
143
|
|
|
134
144
|
/**
|
|
@@ -183,7 +193,7 @@ export default {
|
|
|
183
193
|
|
|
184
194
|
return path[0];
|
|
185
195
|
})
|
|
186
|
-
.style("fill", $$.
|
|
196
|
+
.style("fill", $$.generateUpdateBarColor())
|
|
187
197
|
.style("clip-path", d => d.clipPath)
|
|
188
198
|
.style("opacity", null)
|
|
189
199
|
];
|
|
@@ -215,6 +225,7 @@ export default {
|
|
|
215
225
|
const getPoints = $$.generateGetBarPoints(barIndices, isSub);
|
|
216
226
|
const getRadius = getBarRadiusResolver($$);
|
|
217
227
|
const stackingRadiusSet = getRadius ? getStackingBarRadiusSet($$) : new Set<string>();
|
|
228
|
+
const connectLineCache = new Map<string, string | null>();
|
|
218
229
|
|
|
219
230
|
return (d: IBarData, i: number): BarPath => {
|
|
220
231
|
// 4 points that make a bar
|
|
@@ -264,7 +275,15 @@ export default {
|
|
|
264
275
|
|
|
265
276
|
const coords: BarPath = [`M${points[0][indexX]},${points[0][indexY]}${path}z`];
|
|
266
277
|
|
|
267
|
-
|
|
278
|
+
// Memoize per series id: config lookup + regex runs once per id, not per bar
|
|
279
|
+
let connectLineType = connectLineCache.get(d.id);
|
|
280
|
+
|
|
281
|
+
if (connectLineType === undefined) {
|
|
282
|
+
connectLineType = _getConnectLineType.call($$, d.id);
|
|
283
|
+
connectLineCache.set(d.id, connectLineType);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (connectLineType) {
|
|
268
287
|
coords.push(config.axis_rotated ?
|
|
269
288
|
{
|
|
270
289
|
x: points[0][indexX],
|
|
@@ -266,7 +266,7 @@ export default {
|
|
|
266
266
|
if (hasNullDataValue) {
|
|
267
267
|
const dx = x(data.x) - x(prevData.x);
|
|
268
268
|
const dy = y(data.value) - y(prevData.value);
|
|
269
|
-
const dd = Math.sqrt(
|
|
269
|
+
const dd = Math.sqrt(dx * dx + dy * dy);
|
|
270
270
|
|
|
271
271
|
diff = style[0] / dd; // dash
|
|
272
272
|
diffx2 = diff * style[1]; // gap
|
|
@@ -186,7 +186,7 @@ export default {
|
|
|
186
186
|
circles.exit().remove();
|
|
187
187
|
|
|
188
188
|
const pointR = $$.pointR.bind($$);
|
|
189
|
-
const updateCircleColor = $$.
|
|
189
|
+
const updateCircleColor = $$.generateUpdateCircleColor();
|
|
190
190
|
const initialOpacityForCircle = $$.initialOpacityForCircle.bind($$);
|
|
191
191
|
|
|
192
192
|
circles.enter()
|
|
@@ -199,6 +199,21 @@ export default {
|
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Generate circle color accessor, hoisting the bound color function
|
|
204
|
+
* to be created once per call (not per datum)
|
|
205
|
+
* @returns {function} Color accessor
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
generateUpdateCircleColor(): (d: IDataRow) => string | null {
|
|
209
|
+
const $$ = this;
|
|
210
|
+
const fn = $$.getStylePropValue($$.color);
|
|
211
|
+
|
|
212
|
+
return (d: IDataRow) => (
|
|
213
|
+
$$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null)
|
|
214
|
+
);
|
|
215
|
+
},
|
|
216
|
+
|
|
202
217
|
/**
|
|
203
218
|
* Update circle color
|
|
204
219
|
* @param {object} d Data object
|
|
@@ -206,10 +221,7 @@ export default {
|
|
|
206
221
|
* @private
|
|
207
222
|
*/
|
|
208
223
|
updateCircleColor(d: IDataRow): string | null {
|
|
209
|
-
|
|
210
|
-
const fn = $$.getStylePropValue($$.color);
|
|
211
|
-
|
|
212
|
-
return $$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null);
|
|
224
|
+
return this.generateUpdateCircleColor()(d);
|
|
213
225
|
},
|
|
214
226
|
|
|
215
227
|
redrawCircle(cx: Function, cy: Function, withTransition: boolean, flow, isSub = false) {
|
|
@@ -225,6 +237,7 @@ export default {
|
|
|
225
237
|
const posAttr = $$.isCirclePoint() ? "c" : "";
|
|
226
238
|
const t = getRandom();
|
|
227
239
|
const opacityStyleFn = $$.opacityForCircle.bind($$);
|
|
240
|
+
const updateCircleColor = $$.generateUpdateCircleColor();
|
|
228
241
|
|
|
229
242
|
// For standard circle type, batch the update across all circles in one pass
|
|
230
243
|
if ($$.isCirclePoint()) {
|
|
@@ -245,14 +258,14 @@ export default {
|
|
|
245
258
|
$T(sel.filter(function() {
|
|
246
259
|
return !!this.getAttribute("cx");
|
|
247
260
|
}), true, `${t}-pos`)
|
|
248
|
-
.attr("cx", cx).attr("cy", cy).style("fill",
|
|
261
|
+
.attr("cx", cx).attr("cy", cy).style("fill", updateCircleColor);
|
|
249
262
|
|
|
250
263
|
sel.filter(function() {
|
|
251
264
|
return !this.getAttribute("cx");
|
|
252
265
|
})
|
|
253
|
-
.attr("cx", cx).attr("cy", cy).style("fill",
|
|
266
|
+
.attr("cx", cx).attr("cy", cy).style("fill", updateCircleColor);
|
|
254
267
|
} else {
|
|
255
|
-
sel.attr("cx", cx).attr("cy", cy).style("fill",
|
|
268
|
+
sel.attr("cx", cx).attr("cy", cy).style("fill", updateCircleColor);
|
|
256
269
|
}
|
|
257
270
|
|
|
258
271
|
const result = $T(sel, withTransition || !rendered, t)
|
|
@@ -264,7 +277,7 @@ export default {
|
|
|
264
277
|
];
|
|
265
278
|
}
|
|
266
279
|
|
|
267
|
-
const fn = $$.point("update", $$, cx, cy,
|
|
280
|
+
const fn = $$.point("update", $$, cx, cy, updateCircleColor, withTransition,
|
|
268
281
|
flow, selectedCircles);
|
|
269
282
|
const mainCircles: any[] = [];
|
|
270
283
|
|
|
@@ -410,9 +423,10 @@ export default {
|
|
|
410
423
|
cy = y;
|
|
411
424
|
}
|
|
412
425
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
426
|
+
const dx = cx - mouse[0];
|
|
427
|
+
const dy = cy - mouse[1];
|
|
428
|
+
|
|
429
|
+
return Math.sqrt(dx * dx + dy * dy) < (r || pointSensitivity);
|
|
416
430
|
},
|
|
417
431
|
|
|
418
432
|
updatePointClass(d) {
|
|
@@ -700,8 +700,17 @@ export default {
|
|
|
700
700
|
const areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, isSub);
|
|
701
701
|
const yScale = $$.getYScaleById.bind($$);
|
|
702
702
|
|
|
703
|
+
// per-series cache: y0 depends only on the id and is stable within one draw pass
|
|
704
|
+
const y0Cache = new Map<string, number>();
|
|
705
|
+
|
|
703
706
|
return function(d, i) {
|
|
704
|
-
|
|
707
|
+
let y0 = y0Cache.get(d.id);
|
|
708
|
+
|
|
709
|
+
if (y0 === undefined) {
|
|
710
|
+
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)) as number;
|
|
711
|
+
y0Cache.set(d.id, y0);
|
|
712
|
+
}
|
|
713
|
+
|
|
705
714
|
const offset = areaOffset(d, i) || y0;
|
|
706
715
|
const posX = x(d);
|
|
707
716
|
const value = d.value as number;
|
|
@@ -745,12 +754,25 @@ export default {
|
|
|
745
754
|
const barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub);
|
|
746
755
|
const yScale = $$.getYScaleById.bind($$);
|
|
747
756
|
|
|
757
|
+
// per-series cache: y0/isInverted depend only on the id and are stable within one draw pass
|
|
758
|
+
const idCache = new Map<string, {y0: number, isInverted: boolean}>();
|
|
759
|
+
|
|
748
760
|
return (d, i) => {
|
|
749
761
|
const {id} = d;
|
|
750
|
-
|
|
762
|
+
let idInfo = idCache.get(id);
|
|
763
|
+
|
|
764
|
+
if (!idInfo) {
|
|
765
|
+
idInfo = {
|
|
766
|
+
y0: yScale.call($$, id, isSub)($$.getShapeYMin(id)),
|
|
767
|
+
isInverted: config[`axis_${$$.axis.getId(id)}_inverted`]
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
idCache.set(id, idInfo);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
const {y0, isInverted} = idInfo;
|
|
751
774
|
const offset = barOffset(d, i) || y0;
|
|
752
775
|
const width = isNumber(barW) ? barW : barW[d.id] || barW._$width;
|
|
753
|
-
const isInverted = config[`axis_${$$.axis.getId(id)}_inverted`];
|
|
754
776
|
const value = d.value as number;
|
|
755
777
|
const posX = barX(d);
|
|
756
778
|
let posY = barY(d);
|