billboard.js 3.2.2 → 3.3.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 +818 -468
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +4765 -3104
- package/dist/billboard.pkgd.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
- 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.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-sparkline.js +145 -99
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-stanford.js +144 -98
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-tableview.js +13 -128
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-textoverlap.js +11 -126
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +3980 -2669
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +4119 -2762
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +4117 -2760
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +3970 -2774
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3969 -2773
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +787 -464
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +131 -79
- package/dist-esm/plugin/billboardjs-plugin-stanford.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +135 -80
- package/dist-esm/plugin/billboardjs-plugin-tableview.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -7
- package/package.json +45 -44
- package/src/Chart/api/chart.ts +7 -1
- package/src/Chart/api/data.ts +3 -4
- package/src/Chart/api/focus.ts +8 -8
- package/src/Chart/api/regions.ts +3 -3
- package/src/Chart/api/selection.ts +15 -15
- package/src/Chart/api/subchart.ts +3 -3
- package/src/ChartInternal/Axis/Axis.ts +26 -19
- package/src/ChartInternal/ChartInternal.ts +18 -8
- package/src/ChartInternal/data/IData.ts +9 -0
- package/src/ChartInternal/data/convert.ts +1 -1
- package/src/ChartInternal/data/data.ts +29 -12
- package/src/ChartInternal/data/load.ts +2 -2
- package/src/ChartInternal/interactions/drag.ts +15 -15
- package/src/ChartInternal/interactions/eventrect.ts +18 -18
- package/src/ChartInternal/interactions/interaction.ts +46 -14
- package/src/ChartInternal/interactions/zoom.ts +4 -4
- package/src/ChartInternal/internals/color.ts +4 -4
- package/src/ChartInternal/internals/domain.ts +5 -3
- package/src/ChartInternal/internals/grid.ts +32 -32
- package/src/ChartInternal/internals/legend.ts +27 -27
- package/src/ChartInternal/internals/redraw.ts +3 -3
- package/src/ChartInternal/internals/region.ts +3 -3
- package/src/ChartInternal/internals/scale.ts +3 -2
- package/src/ChartInternal/internals/selection.ts +16 -15
- package/src/ChartInternal/internals/size.ts +35 -4
- package/src/ChartInternal/internals/text.ts +10 -10
- package/src/ChartInternal/internals/title.ts +4 -4
- package/src/ChartInternal/internals/tooltip.ts +9 -6
- package/src/ChartInternal/internals/transform.ts +5 -5
- package/src/ChartInternal/shape/arc.ts +24 -22
- package/src/ChartInternal/shape/area.ts +4 -4
- package/src/ChartInternal/shape/bar.ts +87 -40
- package/src/ChartInternal/shape/candlestick.ts +8 -8
- package/src/ChartInternal/shape/gauge.ts +8 -8
- package/src/ChartInternal/shape/line.ts +7 -7
- package/src/ChartInternal/shape/point.ts +18 -18
- package/src/ChartInternal/shape/radar.ts +12 -10
- package/src/ChartInternal/shape/shape.ts +76 -13
- package/src/Plugin/sparkline/index.ts +4 -4
- package/src/Plugin/stanford/index.ts +3 -3
- package/src/Plugin/stanford/util.ts +0 -1
- package/src/Plugin/tableview/index.ts +1 -1
- package/src/config/Options/axis/x.ts +27 -7
- package/src/config/Options/axis/y.ts +24 -3
- package/src/config/Options/axis/y2.ts +24 -3
- package/src/config/Options/common/main.ts +11 -1
- package/src/config/Options/data/data.ts +22 -0
- package/src/config/Options/shape/bar.ts +9 -2
- package/src/config/classes.ts +154 -66
- package/src/module/util.ts +17 -17
- package/types/axis.d.ts +22 -8
- package/types/chart.d.ts +1 -1
- package/types/options.d.ts +40 -33
- package/types/plugin/tableview/index.d.ts +3 -3
- package/types/plugin/tableview/options.d.ts +1 -1
- package/types/types.d.ts +4 -4
package/dist-esm/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.3.1
|
|
9
9
|
*/
|
|
10
10
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
11
11
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
@@ -167,120 +167,6 @@ function __spreadArray(to, from, pack) {
|
|
|
167
167
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
/**
|
|
171
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
172
|
-
* billboard.js project is licensed under the MIT license
|
|
173
|
-
*/
|
|
174
|
-
/**
|
|
175
|
-
* CSS class names definition
|
|
176
|
-
* @private
|
|
177
|
-
*/
|
|
178
|
-
var CLASS = {
|
|
179
|
-
arc: "bb-arc",
|
|
180
|
-
arcLabelLine: "bb-arc-label-line",
|
|
181
|
-
arcs: "bb-arcs",
|
|
182
|
-
area: "bb-area",
|
|
183
|
-
areas: "bb-areas",
|
|
184
|
-
axis: "bb-axis",
|
|
185
|
-
axisX: "bb-axis-x",
|
|
186
|
-
axisXLabel: "bb-axis-x-label",
|
|
187
|
-
axisY: "bb-axis-y",
|
|
188
|
-
axisY2: "bb-axis-y2",
|
|
189
|
-
axisY2Label: "bb-axis-y2-label",
|
|
190
|
-
axisYLabel: "bb-axis-y-label",
|
|
191
|
-
bar: "bb-bar",
|
|
192
|
-
bars: "bb-bars",
|
|
193
|
-
brush: "bb-brush",
|
|
194
|
-
button: "bb-button",
|
|
195
|
-
buttonZoomReset: "bb-zoom-reset",
|
|
196
|
-
candlestick: "bb-candlestick",
|
|
197
|
-
candlesticks: "bb-candlesticks",
|
|
198
|
-
chart: "bb-chart",
|
|
199
|
-
chartArc: "bb-chart-arc",
|
|
200
|
-
chartArcs: "bb-chart-arcs",
|
|
201
|
-
chartArcsBackground: "bb-chart-arcs-background",
|
|
202
|
-
chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
|
203
|
-
chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
|
204
|
-
chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
|
205
|
-
chartArcsTitle: "bb-chart-arcs-title",
|
|
206
|
-
chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
|
207
|
-
chartBar: "bb-chart-bar",
|
|
208
|
-
chartBars: "bb-chart-bars",
|
|
209
|
-
chartCandlestick: "bb-chart-candlestick",
|
|
210
|
-
chartCandlesticks: "bb-chart-candlesticks",
|
|
211
|
-
chartCircles: "bb-chart-circles",
|
|
212
|
-
chartLine: "bb-chart-line",
|
|
213
|
-
chartLines: "bb-chart-lines",
|
|
214
|
-
chartRadar: "bb-chart-radar",
|
|
215
|
-
chartRadars: "bb-chart-radars",
|
|
216
|
-
chartText: "bb-chart-text",
|
|
217
|
-
chartTexts: "bb-chart-texts",
|
|
218
|
-
circle: "bb-circle",
|
|
219
|
-
circles: "bb-circles",
|
|
220
|
-
colorPattern: "bb-color-pattern",
|
|
221
|
-
colorScale: "bb-colorscale",
|
|
222
|
-
defocused: "bb-defocused",
|
|
223
|
-
dragarea: "bb-dragarea",
|
|
224
|
-
empty: "bb-empty",
|
|
225
|
-
eventRect: "bb-event-rect",
|
|
226
|
-
eventRects: "bb-event-rects",
|
|
227
|
-
eventRectsMultiple: "bb-event-rects-multiple",
|
|
228
|
-
eventRectsSingle: "bb-event-rects-single",
|
|
229
|
-
focused: "bb-focused",
|
|
230
|
-
gaugeValue: "bb-gauge-value",
|
|
231
|
-
grid: "bb-grid",
|
|
232
|
-
gridLines: "bb-grid-lines",
|
|
233
|
-
legend: "bb-legend",
|
|
234
|
-
legendBackground: "bb-legend-background",
|
|
235
|
-
legendItem: "bb-legend-item",
|
|
236
|
-
legendItemEvent: "bb-legend-item-event",
|
|
237
|
-
legendItemFocused: "bb-legend-item-focused",
|
|
238
|
-
legendItemHidden: "bb-legend-item-hidden",
|
|
239
|
-
legendItemPoint: "bb-legend-item-point",
|
|
240
|
-
legendItemTile: "bb-legend-item-tile",
|
|
241
|
-
level: "bb-level",
|
|
242
|
-
levels: "bb-levels",
|
|
243
|
-
line: "bb-line",
|
|
244
|
-
lines: "bb-lines",
|
|
245
|
-
main: "bb-main",
|
|
246
|
-
region: "bb-region",
|
|
247
|
-
regions: "bb-regions",
|
|
248
|
-
selectedCircle: "bb-selected-circle",
|
|
249
|
-
selectedCircles: "bb-selected-circles",
|
|
250
|
-
shape: "bb-shape",
|
|
251
|
-
shapes: "bb-shapes",
|
|
252
|
-
stanfordElements: "bb-stanford-elements",
|
|
253
|
-
stanfordLine: "bb-stanford-line",
|
|
254
|
-
stanfordLines: "bb-stanford-lines",
|
|
255
|
-
stanfordRegion: "bb-stanford-region",
|
|
256
|
-
stanfordRegions: "bb-stanford-regions",
|
|
257
|
-
subchart: "bb-subchart",
|
|
258
|
-
target: "bb-target",
|
|
259
|
-
text: "bb-text",
|
|
260
|
-
texts: "bb-texts",
|
|
261
|
-
title: "bb-title",
|
|
262
|
-
tooltip: "bb-tooltip",
|
|
263
|
-
tooltipContainer: "bb-tooltip-container",
|
|
264
|
-
tooltipName: "bb-tooltip-name",
|
|
265
|
-
valueDown: "bb-value-down",
|
|
266
|
-
valueUp: "bb-value-up",
|
|
267
|
-
xgrid: "bb-xgrid",
|
|
268
|
-
xgridFocus: "bb-xgrid-focus",
|
|
269
|
-
xgridLine: "bb-xgrid-line",
|
|
270
|
-
xgridLines: "bb-xgrid-lines",
|
|
271
|
-
xgrids: "bb-xgrids",
|
|
272
|
-
ygrid: "bb-ygrid",
|
|
273
|
-
ygridFocus: "bb-ygrid-focus",
|
|
274
|
-
ygridLine: "bb-ygrid-line",
|
|
275
|
-
ygridLines: "bb-ygrid-lines",
|
|
276
|
-
ygrids: "bb-ygrids",
|
|
277
|
-
zoomBrush: "bb-zoom-brush",
|
|
278
|
-
EXPANDED: "_expanded_",
|
|
279
|
-
SELECTED: "_selected_",
|
|
280
|
-
INCLUDED: "_included_",
|
|
281
|
-
TextOverlapping: "text-overlapping"
|
|
282
|
-
};
|
|
283
|
-
|
|
284
170
|
var isValue = function (v) { return v || v === 0; };
|
|
285
171
|
var isFunction = function (v) { return typeof v === "function"; };
|
|
286
172
|
var isString = function (v) { return typeof v === "string"; };
|
|
@@ -338,17 +224,18 @@ function hasValue(dict, value) {
|
|
|
338
224
|
/**
|
|
339
225
|
* Call function with arguments
|
|
340
226
|
* @param {Function} fn Function to be called
|
|
341
|
-
* @param {*}
|
|
227
|
+
* @param {*} thisArg "this" value for fn
|
|
228
|
+
* @param {*} args Arguments for fn
|
|
342
229
|
* @returns {boolean} true: fn is function, false: fn is not function
|
|
343
230
|
* @private
|
|
344
231
|
*/
|
|
345
|
-
function callFn(fn) {
|
|
232
|
+
function callFn(fn, thisArg) {
|
|
346
233
|
var args = [];
|
|
347
|
-
for (var _i =
|
|
348
|
-
args[_i -
|
|
234
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
235
|
+
args[_i - 2] = arguments[_i];
|
|
349
236
|
}
|
|
350
237
|
var isFn = isFunction(fn);
|
|
351
|
-
isFn && fn.call.apply(fn, args);
|
|
238
|
+
isFn && fn.call.apply(fn, __spreadArray([thisArg], args, false));
|
|
352
239
|
return isFn;
|
|
353
240
|
}
|
|
354
241
|
/**
|
|
@@ -488,7 +375,7 @@ function getBrushSelection(ctx) {
|
|
|
488
375
|
selection = event.selection;
|
|
489
376
|
// check from brush area selection
|
|
490
377
|
}
|
|
491
|
-
else if (main && (selection = main.select("."
|
|
378
|
+
else if (main && (selection = main.select(".bb-brush").node())) {
|
|
492
379
|
selection = brushSelection(selection);
|
|
493
380
|
}
|
|
494
381
|
return selection;
|
|
@@ -933,6 +820,160 @@ function logError(head, tail) {
|
|
|
933
820
|
throw Error("".concat(prefix, " ").concat(head.replace(/\%c([a-z-]+)/i, "'$1' "), " ").concat(tail));
|
|
934
821
|
}
|
|
935
822
|
|
|
823
|
+
/**
|
|
824
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
825
|
+
* billboard.js project is licensed under the MIT license
|
|
826
|
+
*/
|
|
827
|
+
/**
|
|
828
|
+
* CSS class names definition
|
|
829
|
+
* @private
|
|
830
|
+
*/
|
|
831
|
+
var $COMMON = {
|
|
832
|
+
button: "bb-button",
|
|
833
|
+
chart: "bb-chart",
|
|
834
|
+
empty: "bb-empty",
|
|
835
|
+
main: "bb-main",
|
|
836
|
+
target: "bb-target",
|
|
837
|
+
EXPANDED: "_expanded_"
|
|
838
|
+
};
|
|
839
|
+
var $ARC = {
|
|
840
|
+
arc: "bb-arc",
|
|
841
|
+
arcLabelLine: "bb-arc-label-line",
|
|
842
|
+
arcs: "bb-arcs",
|
|
843
|
+
chartArc: "bb-chart-arc",
|
|
844
|
+
chartArcs: "bb-chart-arcs",
|
|
845
|
+
chartArcsBackground: "bb-chart-arcs-background",
|
|
846
|
+
chartArcsTitle: "bb-chart-arcs-title"
|
|
847
|
+
};
|
|
848
|
+
var $AREA = {
|
|
849
|
+
area: "bb-area",
|
|
850
|
+
areas: "bb-areas"
|
|
851
|
+
};
|
|
852
|
+
var $AXIS = {
|
|
853
|
+
axis: "bb-axis",
|
|
854
|
+
axisX: "bb-axis-x",
|
|
855
|
+
axisXLabel: "bb-axis-x-label",
|
|
856
|
+
axisY: "bb-axis-y",
|
|
857
|
+
axisY2: "bb-axis-y2",
|
|
858
|
+
axisY2Label: "bb-axis-y2-label",
|
|
859
|
+
axisYLabel: "bb-axis-y-label"
|
|
860
|
+
};
|
|
861
|
+
var $BAR = {
|
|
862
|
+
bar: "bb-bar",
|
|
863
|
+
bars: "bb-bars",
|
|
864
|
+
chartBar: "bb-chart-bar",
|
|
865
|
+
chartBars: "bb-chart-bars"
|
|
866
|
+
};
|
|
867
|
+
var $CANDLESTICK = {
|
|
868
|
+
candlestick: "bb-candlestick",
|
|
869
|
+
candlesticks: "bb-candlesticks",
|
|
870
|
+
chartCandlestick: "bb-chart-candlestick",
|
|
871
|
+
chartCandlesticks: "bb-chart-candlesticks",
|
|
872
|
+
valueDown: "bb-value-down",
|
|
873
|
+
valueUp: "bb-value-up"
|
|
874
|
+
};
|
|
875
|
+
var $CIRCLE = {
|
|
876
|
+
chartCircles: "bb-chart-circles",
|
|
877
|
+
circle: "bb-circle",
|
|
878
|
+
circles: "bb-circles"
|
|
879
|
+
};
|
|
880
|
+
var $COLOR = {
|
|
881
|
+
colorPattern: "bb-color-pattern",
|
|
882
|
+
colorScale: "bb-colorscale"
|
|
883
|
+
};
|
|
884
|
+
var $DRAG = {
|
|
885
|
+
dragarea: "bb-dragarea",
|
|
886
|
+
INCLUDED: "_included_"
|
|
887
|
+
};
|
|
888
|
+
var $GAUGE = {
|
|
889
|
+
chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
|
890
|
+
chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
|
891
|
+
chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
|
892
|
+
chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
|
893
|
+
gaugeValue: "bb-gauge-value"
|
|
894
|
+
};
|
|
895
|
+
var $LEGEND = {
|
|
896
|
+
legend: "bb-legend",
|
|
897
|
+
legendBackground: "bb-legend-background",
|
|
898
|
+
legendItem: "bb-legend-item",
|
|
899
|
+
legendItemEvent: "bb-legend-item-event",
|
|
900
|
+
legendItemHidden: "bb-legend-item-hidden",
|
|
901
|
+
legendItemPoint: "bb-legend-item-point",
|
|
902
|
+
legendItemTile: "bb-legend-item-tile"
|
|
903
|
+
};
|
|
904
|
+
var $LINE = {
|
|
905
|
+
chartLine: "bb-chart-line",
|
|
906
|
+
chartLines: "bb-chart-lines",
|
|
907
|
+
line: "bb-line",
|
|
908
|
+
lines: "bb-lines"
|
|
909
|
+
};
|
|
910
|
+
var $EVENT = {
|
|
911
|
+
eventRect: "bb-event-rect",
|
|
912
|
+
eventRects: "bb-event-rects",
|
|
913
|
+
eventRectsMultiple: "bb-event-rects-multiple",
|
|
914
|
+
eventRectsSingle: "bb-event-rects-single"
|
|
915
|
+
};
|
|
916
|
+
var $FOCUS = {
|
|
917
|
+
focused: "bb-focused",
|
|
918
|
+
defocused: "bb-defocused",
|
|
919
|
+
legendItemFocused: "bb-legend-item-focused",
|
|
920
|
+
xgridFocus: "bb-xgrid-focus",
|
|
921
|
+
ygridFocus: "bb-ygrid-focus"
|
|
922
|
+
};
|
|
923
|
+
var $GRID = {
|
|
924
|
+
grid: "bb-grid",
|
|
925
|
+
gridLines: "bb-grid-lines",
|
|
926
|
+
xgrid: "bb-xgrid",
|
|
927
|
+
xgridLine: "bb-xgrid-line",
|
|
928
|
+
xgridLines: "bb-xgrid-lines",
|
|
929
|
+
xgrids: "bb-xgrids",
|
|
930
|
+
ygrid: "bb-ygrid",
|
|
931
|
+
ygridLine: "bb-ygrid-line",
|
|
932
|
+
ygridLines: "bb-ygrid-lines",
|
|
933
|
+
ygrids: "bb-ygrids"
|
|
934
|
+
};
|
|
935
|
+
var $RADAR = {
|
|
936
|
+
chartRadar: "bb-chart-radar",
|
|
937
|
+
chartRadars: "bb-chart-radars",
|
|
938
|
+
level: "bb-level",
|
|
939
|
+
levels: "bb-levels"
|
|
940
|
+
};
|
|
941
|
+
var $REGION = {
|
|
942
|
+
region: "bb-region",
|
|
943
|
+
regions: "bb-regions"
|
|
944
|
+
};
|
|
945
|
+
var $SELECT = {
|
|
946
|
+
selectedCircle: "bb-selected-circle",
|
|
947
|
+
selectedCircles: "bb-selected-circles",
|
|
948
|
+
SELECTED: "_selected_"
|
|
949
|
+
};
|
|
950
|
+
var $SHAPE = {
|
|
951
|
+
shape: "bb-shape",
|
|
952
|
+
shapes: "bb-shapes"
|
|
953
|
+
};
|
|
954
|
+
var $SUBCHART = {
|
|
955
|
+
brush: "bb-brush",
|
|
956
|
+
subchart: "bb-subchart"
|
|
957
|
+
};
|
|
958
|
+
var $TEXT = {
|
|
959
|
+
chartText: "bb-chart-text",
|
|
960
|
+
chartTexts: "bb-chart-texts",
|
|
961
|
+
text: "bb-text",
|
|
962
|
+
texts: "bb-texts",
|
|
963
|
+
title: "bb-title",
|
|
964
|
+
TextOverlapping: "text-overlapping"
|
|
965
|
+
};
|
|
966
|
+
var $TOOLTIP = {
|
|
967
|
+
tooltip: "bb-tooltip",
|
|
968
|
+
tooltipContainer: "bb-tooltip-container",
|
|
969
|
+
tooltipName: "bb-tooltip-name"
|
|
970
|
+
};
|
|
971
|
+
var $ZOOM = {
|
|
972
|
+
buttonZoomReset: "bb-zoom-reset",
|
|
973
|
+
zoomBrush: "bb-zoom-brush"
|
|
974
|
+
};
|
|
975
|
+
var CLASS = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM);
|
|
976
|
+
|
|
936
977
|
/**
|
|
937
978
|
* Elements class.
|
|
938
979
|
* @class Elements
|
|
@@ -1262,12 +1303,21 @@ var main = {
|
|
|
1262
1303
|
* @name padding
|
|
1263
1304
|
* @memberof Options
|
|
1264
1305
|
* @type {object}
|
|
1265
|
-
* @property {object} [padding] padding object
|
|
1306
|
+
* @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
|
|
1307
|
+
* - `Object`: Specify each side's padding.
|
|
1308
|
+
* - `false`: Remove padding completely and make shape to fully occupy the container element.
|
|
1309
|
+
* - In this case, axes and subchart will be hidden.
|
|
1310
|
+
* - To adjust some padding from this state, use `axis.[x|y].padding` option.
|
|
1266
1311
|
* @property {number} [padding.top] padding on the top of chart
|
|
1267
1312
|
* @property {number} [padding.right] padding on the right of chart
|
|
1268
1313
|
* @property {number} [padding.bottom] padding on the bottom of chart
|
|
1269
1314
|
* @property {number} [padding.left] padding on the left of chart
|
|
1315
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.Padding)
|
|
1270
1316
|
* @example
|
|
1317
|
+
* // remove padding completely.
|
|
1318
|
+
* padding: false,
|
|
1319
|
+
*
|
|
1320
|
+
* // or specify padding value for each side
|
|
1271
1321
|
* padding: {
|
|
1272
1322
|
* top: 20,
|
|
1273
1323
|
* right: 20,
|
|
@@ -1275,6 +1325,7 @@ var main = {
|
|
|
1275
1325
|
* left: 20
|
|
1276
1326
|
* }
|
|
1277
1327
|
*/
|
|
1328
|
+
padding: true,
|
|
1278
1329
|
padding_left: undefined,
|
|
1279
1330
|
padding_right: undefined,
|
|
1280
1331
|
padding_top: undefined,
|
|
@@ -2090,6 +2141,18 @@ var data$2 = {
|
|
|
2090
2141
|
* ]
|
|
2091
2142
|
* }
|
|
2092
2143
|
*
|
|
2144
|
+
* // for 'bar' type, data can contain:
|
|
2145
|
+
* // - an array of [start, end] data following the order
|
|
2146
|
+
* data: {
|
|
2147
|
+
* rows: [
|
|
2148
|
+
* ["data1", "data2"],
|
|
2149
|
+
* [[100, 150], 120],
|
|
2150
|
+
* [[200, 300], 55],
|
|
2151
|
+
* [[-400, 500], 60]
|
|
2152
|
+
* ],
|
|
2153
|
+
* type: "bar"
|
|
2154
|
+
* }
|
|
2155
|
+
*
|
|
2093
2156
|
* // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
|
|
2094
2157
|
* // - an array of [high, mid, low] data following the order
|
|
2095
2158
|
* // - or an object with 'high', 'mid' and 'low' key value
|
|
@@ -2165,6 +2228,16 @@ var data$2 = {
|
|
|
2165
2228
|
* ]
|
|
2166
2229
|
* }
|
|
2167
2230
|
*
|
|
2231
|
+
* // for 'bar' type, data can contain:
|
|
2232
|
+
* // - an array of [start, end] data following the order
|
|
2233
|
+
* data: {
|
|
2234
|
+
* columns: [
|
|
2235
|
+
* ["data1", -100, 50, [100, 200], [200, 300]],
|
|
2236
|
+
* ["data2", -200, 300, [-100, 100], [-50, -30]],
|
|
2237
|
+
* ],
|
|
2238
|
+
* type: "bar"
|
|
2239
|
+
* }
|
|
2240
|
+
*
|
|
2168
2241
|
* // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
|
|
2169
2242
|
* // - an array of [high, mid, low] data following the order
|
|
2170
2243
|
* // - or an object with 'high', 'mid' and 'low' key value
|
|
@@ -3383,7 +3456,7 @@ var data$1 = {
|
|
|
3383
3456
|
var value = $$.filterTargetsToShow($$.data.targets)
|
|
3384
3457
|
.map(function (t) { return $$.addName($$.getValueOnIndex(t.values, index)); });
|
|
3385
3458
|
if (filterNull) {
|
|
3386
|
-
value = value.filter(function (v) { return isValue(v.value); });
|
|
3459
|
+
value = value.filter(function (v) { return v && "value" in v && isValue(v.value); });
|
|
3387
3460
|
}
|
|
3388
3461
|
return value;
|
|
3389
3462
|
},
|
|
@@ -3735,6 +3808,7 @@ var data$1 = {
|
|
|
3735
3808
|
},
|
|
3736
3809
|
/**
|
|
3737
3810
|
* Sort targets data
|
|
3811
|
+
* Note: For stacked bar, will sort from the total sum of data series, not for each stacked bar
|
|
3738
3812
|
* @param {Array} targetsValue Target value
|
|
3739
3813
|
* @returns {Array}
|
|
3740
3814
|
* @private
|
|
@@ -3763,8 +3837,8 @@ var data$1 = {
|
|
|
3763
3837
|
if (orderAsc || orderDesc) {
|
|
3764
3838
|
var reducer_1 = function (p, c) { return p + Math.abs(c.value); };
|
|
3765
3839
|
fn = function (t1, t2) {
|
|
3766
|
-
var t1Sum = t1.values.reduce(reducer_1, 0);
|
|
3767
|
-
var t2Sum = t2.values.reduce(reducer_1, 0);
|
|
3840
|
+
var t1Sum = "values" in t1 ? t1.values.reduce(reducer_1, 0) : t1.value;
|
|
3841
|
+
var t2Sum = "values" in t2 ? t2.values.reduce(reducer_1, 0) : t2.value;
|
|
3768
3842
|
return isArc ?
|
|
3769
3843
|
(orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum) :
|
|
3770
3844
|
(orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum);
|
|
@@ -3859,18 +3933,21 @@ var data$1 = {
|
|
|
3859
3933
|
var data = values.filter(function (v) { return v && isValue(v.value); });
|
|
3860
3934
|
var minDist = config.point_sensitivity;
|
|
3861
3935
|
var closest;
|
|
3862
|
-
// find mouseovering bar
|
|
3936
|
+
// find mouseovering bar/candlestick
|
|
3937
|
+
// https://github.com/naver/billboard.js/issues/2434
|
|
3863
3938
|
data
|
|
3864
|
-
.filter(function (v) { return $$.isBarType(v.id); })
|
|
3939
|
+
.filter(function (v) { return $$.isBarType(v.id) || $$.isCandlestickType(v.id); })
|
|
3865
3940
|
.forEach(function (v) {
|
|
3866
|
-
var
|
|
3867
|
-
|
|
3941
|
+
var selector = $$.isBarType(v.id) ?
|
|
3942
|
+
".".concat($BAR.chartBar, ".").concat($COMMON.target).concat($$.getTargetSelectorSuffix(v.id), " .").concat($BAR.bar, "-").concat(v.index) :
|
|
3943
|
+
".".concat($CANDLESTICK.chartCandlestick, ".").concat($COMMON.target).concat($$.getTargetSelectorSuffix(v.id), " .").concat($CANDLESTICK.candlestick, "-").concat(v.index, " path");
|
|
3944
|
+
if (!closest && $$.isWithinBar(main.select(selector).node())) {
|
|
3868
3945
|
closest = v;
|
|
3869
3946
|
}
|
|
3870
3947
|
});
|
|
3871
|
-
// find closest point from non-bar
|
|
3948
|
+
// find closest point from non-bar/candlestick
|
|
3872
3949
|
data
|
|
3873
|
-
.filter(function (v) { return !$$.isBarType(v.id); })
|
|
3950
|
+
.filter(function (v) { return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id); })
|
|
3874
3951
|
.forEach(function (v) {
|
|
3875
3952
|
var d = $$.dist(v, pos);
|
|
3876
3953
|
if (d < minDist) {
|
|
@@ -4055,6 +4132,17 @@ var data$1 = {
|
|
|
4055
4132
|
return $$.isBubbleType(d) && ((isObject(d.value) && ("z" in d.value || "y" in d.value)) ||
|
|
4056
4133
|
(isArray(d.value) && d.value.length === 2));
|
|
4057
4134
|
},
|
|
4135
|
+
/**
|
|
4136
|
+
* Determine if bar has ranged data
|
|
4137
|
+
* @param {Array} d data value
|
|
4138
|
+
* @returns {boolean}
|
|
4139
|
+
* @private
|
|
4140
|
+
*/
|
|
4141
|
+
isBarRangeType: function (d) {
|
|
4142
|
+
var $$ = this;
|
|
4143
|
+
var value = d.value;
|
|
4144
|
+
return $$.isBarType(d) && isArray(value) && value.length === 2 && value.every(function (v) { return isNumber(v); });
|
|
4145
|
+
},
|
|
4058
4146
|
/**
|
|
4059
4147
|
* Get data object by id
|
|
4060
4148
|
* @param {string} id data id
|
|
@@ -4155,7 +4243,7 @@ var dataLoad = {
|
|
|
4155
4243
|
state.withoutFadeIn[id] = false;
|
|
4156
4244
|
// Remove target's elements
|
|
4157
4245
|
if ($el.legend) {
|
|
4158
|
-
$el.legend.selectAll(".".concat(
|
|
4246
|
+
$el.legend.selectAll(".".concat($LEGEND.legendItem).concat($$.getTargetSelectorSuffix(id))).remove();
|
|
4159
4247
|
}
|
|
4160
4248
|
// Remove target
|
|
4161
4249
|
$$.data.targets = $$.data.targets.filter(function (t) { return t.id !== id; });
|
|
@@ -4186,10 +4274,10 @@ var interaction = {
|
|
|
4186
4274
|
return;
|
|
4187
4275
|
}
|
|
4188
4276
|
}
|
|
4189
|
-
main.selectAll(".".concat(
|
|
4277
|
+
main.selectAll(".".concat($SHAPE.shape, "-").concat(index))
|
|
4190
4278
|
.each(function () {
|
|
4191
4279
|
var _a;
|
|
4192
|
-
select(this).classed(
|
|
4280
|
+
select(this).classed($COMMON.EXPANDED, true);
|
|
4193
4281
|
if (isSelectionEnabled) {
|
|
4194
4282
|
eventRect.style("cursor", isSelectionGrouped ? "pointer" : null);
|
|
4195
4283
|
}
|
|
@@ -4246,8 +4334,8 @@ var interaction = {
|
|
|
4246
4334
|
["bar", "candlestick"]
|
|
4247
4335
|
.filter(function (v) { return $$.$el[v]; })
|
|
4248
4336
|
.forEach(function (v) {
|
|
4249
|
-
reset && $$.$el[v].classed(
|
|
4250
|
-
$$.getShapeByIndex(v, i, id).classed(
|
|
4337
|
+
reset && $$.$el[v].classed($COMMON.EXPANDED, false);
|
|
4338
|
+
$$.getShapeByIndex(v, i, id).classed($COMMON.EXPANDED, expand);
|
|
4251
4339
|
});
|
|
4252
4340
|
},
|
|
4253
4341
|
/**
|
|
@@ -4265,11 +4353,11 @@ var interaction = {
|
|
|
4265
4353
|
var callback_1 = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
4266
4354
|
config.color_onover && $$.setOverColor(isOver, d, isArc);
|
|
4267
4355
|
if (isArc) {
|
|
4268
|
-
callback_1(d, main.select(".".concat(
|
|
4356
|
+
callback_1(d, main.select(".".concat($ARC.arc).concat($$.getTargetSelectorSuffix(d.id))).node());
|
|
4269
4357
|
}
|
|
4270
4358
|
else if (!config.tooltip_grouped) {
|
|
4271
4359
|
var last_1 = $$.cache.get(KEY.setOverOut) || [];
|
|
4272
|
-
var shape = main.selectAll(".".concat(
|
|
4360
|
+
var shape = main.selectAll(".".concat($SHAPE.shape, "-").concat(d))
|
|
4273
4361
|
.filter(function (d) {
|
|
4274
4362
|
return $$.isWithinShape(this, d);
|
|
4275
4363
|
});
|
|
@@ -4294,7 +4382,7 @@ var interaction = {
|
|
|
4294
4382
|
$$.showCircleFocus($$.getAllValuesOnIndex(d, true)) :
|
|
4295
4383
|
$$.setExpand(d, null, true);
|
|
4296
4384
|
}
|
|
4297
|
-
!$$.isMultipleX() && main.selectAll(".".concat(
|
|
4385
|
+
!$$.isMultipleX() && main.selectAll(".".concat($SHAPE.shape, "-").concat(d))
|
|
4298
4386
|
.each(function (d) {
|
|
4299
4387
|
callback_1(d, this);
|
|
4300
4388
|
});
|
|
@@ -4349,7 +4437,7 @@ var interaction = {
|
|
|
4349
4437
|
var $$ = this;
|
|
4350
4438
|
var config = $$.config, _a = $$.state, eventReceiver = _a.eventReceiver, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar, _b = $$.$el, eventRect = _b.eventRect, arcs = _b.arcs, radar = _b.radar;
|
|
4351
4439
|
var isMultipleX = $$.isMultipleX();
|
|
4352
|
-
var element = (hasRadar ? radar.axes.select(".".concat(
|
|
4440
|
+
var element = (hasRadar ? radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text")) : (eventRect || arcs.selectAll(".".concat($COMMON.target, " path")).filter(function (d, i) { return i === index; }))).node();
|
|
4353
4441
|
var _c = element.getBoundingClientRect(), width = _c.width, left = _c.left, top = _c.top;
|
|
4354
4442
|
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
4355
4443
|
var coords = eventReceiver.coords[index];
|
|
@@ -4377,10 +4465,39 @@ var interaction = {
|
|
|
4377
4465
|
unbindZoomEvent: function () {
|
|
4378
4466
|
var $$ = this;
|
|
4379
4467
|
var _a = $$.$el, eventRect = _a.eventRect, zoomResetBtn = _a.zoomResetBtn;
|
|
4380
|
-
eventRect
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4468
|
+
eventRect === null || eventRect === void 0 ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
|
4469
|
+
zoomResetBtn === null || zoomResetBtn === void 0 ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
|
4470
|
+
},
|
|
4471
|
+
/**
|
|
4472
|
+
* Unbind all attached events
|
|
4473
|
+
* @private
|
|
4474
|
+
*/
|
|
4475
|
+
unbindAllEvents: function () {
|
|
4476
|
+
var _a;
|
|
4477
|
+
var $$ = this;
|
|
4478
|
+
var _b = $$.$el, arcs = _b.arcs, eventRect = _b.eventRect, legend = _b.legend, region = _b.region, svg = _b.svg, brush = $$.brush;
|
|
4479
|
+
var list = [
|
|
4480
|
+
"wheel",
|
|
4481
|
+
"click",
|
|
4482
|
+
"mouseover",
|
|
4483
|
+
"mousemove",
|
|
4484
|
+
"mouseout",
|
|
4485
|
+
"touchstart",
|
|
4486
|
+
"touchmove",
|
|
4487
|
+
"touchend",
|
|
4488
|
+
"touchstart.eventRect",
|
|
4489
|
+
"touchmove.eventRect",
|
|
4490
|
+
"touchend.eventRect",
|
|
4491
|
+
".brush",
|
|
4492
|
+
".drag",
|
|
4493
|
+
".zoom",
|
|
4494
|
+
"wheel.zoom",
|
|
4495
|
+
"dblclick.zoom"
|
|
4496
|
+
].join(" ");
|
|
4497
|
+
// detach all possible event types
|
|
4498
|
+
[svg, eventRect, region === null || region === void 0 ? void 0 : region.list, brush === null || brush === void 0 ? void 0 : brush.getSelection(), arcs === null || arcs === void 0 ? void 0 : arcs.selectAll("path"), legend === null || legend === void 0 ? void 0 : legend.selectAll("g")]
|
|
4499
|
+
.forEach(function (v) { return v === null || v === void 0 ? void 0 : v.on(list, null); });
|
|
4500
|
+
(_a = $$.unbindZoomEvent) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
4384
4501
|
}
|
|
4385
4502
|
};
|
|
4386
4503
|
|
|
@@ -4539,7 +4656,7 @@ var color = {
|
|
|
4539
4656
|
if (!pattern) {
|
|
4540
4657
|
var delimiter = ";";
|
|
4541
4658
|
var span = doc.createElement("span");
|
|
4542
|
-
span.className =
|
|
4659
|
+
span.className = $COLOR.colorPattern;
|
|
4543
4660
|
span.style.display = "none";
|
|
4544
4661
|
body.appendChild(span);
|
|
4545
4662
|
var content = win.getComputedStyle(span).backgroundImage;
|
|
@@ -4676,8 +4793,8 @@ var color = {
|
|
|
4676
4793
|
}
|
|
4677
4794
|
main.selectAll(isObject(d) ?
|
|
4678
4795
|
// when is Arc type
|
|
4679
|
-
".".concat(
|
|
4680
|
-
".".concat(
|
|
4796
|
+
".".concat($ARC.arc).concat($$.getTargetSelectorSuffix(d.id)) :
|
|
4797
|
+
".".concat($SHAPE.shape, "-").concat(d)).style("fill", color);
|
|
4681
4798
|
}
|
|
4682
4799
|
};
|
|
4683
4800
|
|
|
@@ -4765,7 +4882,7 @@ var domain = {
|
|
|
4765
4882
|
var yDomainMax = $$.getYDomainMinMax(yTargets, "max");
|
|
4766
4883
|
var isZeroBased = __spreadArray([TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER], TYPE_BY_CATEGORY.Line, true).some(function (v) {
|
|
4767
4884
|
var type = v.indexOf("area") > -1 ? "area" : v;
|
|
4768
|
-
return $$.hasType(v, yTargets) && config["".concat(type, "_zerobased")];
|
|
4885
|
+
return $$.hasType(v, yTargets, true) && config["".concat(type, "_zerobased")];
|
|
4769
4886
|
});
|
|
4770
4887
|
// MEMO: avoid inverting domain unexpectedly
|
|
4771
4888
|
yDomainMin = isValue(yMin) ? yMin :
|
|
@@ -4814,6 +4931,7 @@ var domain = {
|
|
|
4814
4931
|
padding[v] += $$.convertPixelToScale("y", lengths_1[i], domainLength);
|
|
4815
4932
|
});
|
|
4816
4933
|
}
|
|
4934
|
+
padding = $$.getResettedPadding(padding);
|
|
4817
4935
|
// if padding is set, the domain will be updated relative the current domain value
|
|
4818
4936
|
// ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6
|
|
4819
4937
|
var p = config["".concat(pfx, "_padding")];
|
|
@@ -4866,7 +4984,7 @@ var domain = {
|
|
|
4866
4984
|
defaultValue = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;
|
|
4867
4985
|
}
|
|
4868
4986
|
else {
|
|
4869
|
-
defaultValue = diff * 0.01;
|
|
4987
|
+
defaultValue = $$.getResettedPadding(diff * 0.01);
|
|
4870
4988
|
}
|
|
4871
4989
|
var _a = isNumber(padding) ?
|
|
4872
4990
|
{ left: padding, right: padding } : padding, _b = _a.left, left = _b === void 0 ? defaultValue : _b, _c = _a.right, right = _c === void 0 ? defaultValue : _c;
|
|
@@ -5083,7 +5201,7 @@ var legend$1 = {
|
|
|
5083
5201
|
if (config.legend_show) {
|
|
5084
5202
|
if (!config.legend_contents_bindto) {
|
|
5085
5203
|
$el.legend = $$.$el.svg.append("g")
|
|
5086
|
-
.classed(
|
|
5204
|
+
.classed($LEGEND.legend, true)
|
|
5087
5205
|
.attr("transform", $$.getTranslate("legend"));
|
|
5088
5206
|
}
|
|
5089
5207
|
// MEMO: call here to update legend box and translate for all
|
|
@@ -5118,8 +5236,8 @@ var legend$1 = {
|
|
|
5118
5236
|
$$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
|
5119
5237
|
}
|
|
5120
5238
|
// toggle legend state
|
|
5121
|
-
$el.legend.selectAll(".".concat(
|
|
5122
|
-
.classed(
|
|
5239
|
+
$el.legend.selectAll(".".concat($LEGEND.legendItem))
|
|
5240
|
+
.classed($LEGEND.legendItemHidden, function (id) {
|
|
5123
5241
|
var hide = !$$.isTargetToShow(id);
|
|
5124
5242
|
if (hide) {
|
|
5125
5243
|
this.style.opacity = null;
|
|
@@ -5235,7 +5353,7 @@ var legend$1 = {
|
|
|
5235
5353
|
updateLegendItemColor: function (id, color) {
|
|
5236
5354
|
var legend = this.$el.legend;
|
|
5237
5355
|
if (legend) {
|
|
5238
|
-
legend.select(".".concat(
|
|
5356
|
+
legend.select(".".concat($LEGEND.legendItem, "-").concat(id, " line"))
|
|
5239
5357
|
.style("stroke", color);
|
|
5240
5358
|
}
|
|
5241
5359
|
},
|
|
@@ -5268,7 +5386,7 @@ var legend$1 = {
|
|
|
5268
5386
|
* @private
|
|
5269
5387
|
*/
|
|
5270
5388
|
opacityForUnfocusedLegend: function (legendItem) {
|
|
5271
|
-
return legendItem.classed(
|
|
5389
|
+
return legendItem.classed($LEGEND.legendItemHidden) ? null : "0.3";
|
|
5272
5390
|
},
|
|
5273
5391
|
/**
|
|
5274
5392
|
* Toggles the focus of the legend
|
|
@@ -5280,9 +5398,9 @@ var legend$1 = {
|
|
|
5280
5398
|
var $$ = this;
|
|
5281
5399
|
var legend = $$.$el.legend, $T = $$.$T;
|
|
5282
5400
|
var targetIdz = $$.mapToTargetIds(targetIds);
|
|
5283
|
-
legend && $T(legend.selectAll(".".concat(
|
|
5401
|
+
legend && $T(legend.selectAll(".".concat($LEGEND.legendItem))
|
|
5284
5402
|
.filter(function (id) { return targetIdz.indexOf(id) >= 0; })
|
|
5285
|
-
.classed(
|
|
5403
|
+
.classed($FOCUS.legendItemFocused, focus))
|
|
5286
5404
|
.style("opacity", function () {
|
|
5287
5405
|
return focus ? null :
|
|
5288
5406
|
$$.opacityForUnfocusedLegend.call($$, select(this));
|
|
@@ -5295,8 +5413,8 @@ var legend$1 = {
|
|
|
5295
5413
|
revertLegend: function () {
|
|
5296
5414
|
var $$ = this;
|
|
5297
5415
|
var legend = $$.$el.legend, $T = $$.$T;
|
|
5298
|
-
legend && $T(legend.selectAll(".".concat(
|
|
5299
|
-
.classed(
|
|
5416
|
+
legend && $T(legend.selectAll(".".concat($LEGEND.legendItem))
|
|
5417
|
+
.classed($FOCUS.legendItemFocused, false))
|
|
5300
5418
|
.style("opacity", null);
|
|
5301
5419
|
},
|
|
5302
5420
|
/**
|
|
@@ -5351,7 +5469,7 @@ var legend$1 = {
|
|
|
5351
5469
|
if (id) {
|
|
5352
5470
|
data = (!state.redrawing && cache.get(cacheKey)) || {};
|
|
5353
5471
|
if (!data[id]) {
|
|
5354
|
-
data[id] = $$.getTextRect(textElement,
|
|
5472
|
+
data[id] = $$.getTextRect(textElement, $LEGEND.legendItem);
|
|
5355
5473
|
cache.add(cacheKey, data);
|
|
5356
5474
|
}
|
|
5357
5475
|
data = data[id];
|
|
@@ -5372,7 +5490,7 @@ var legend$1 = {
|
|
|
5372
5490
|
.attr("class", function (id) {
|
|
5373
5491
|
var node = select(this);
|
|
5374
5492
|
var itemClass = (!node.empty() && node.attr("class")) || "";
|
|
5375
|
-
return itemClass + $$.generateClass(
|
|
5493
|
+
return itemClass + $$.generateClass($LEGEND.legendItem, id);
|
|
5376
5494
|
})
|
|
5377
5495
|
.style("visibility", function (id) { return ($$.isLegendToShow(id) ? null : "hidden"); });
|
|
5378
5496
|
if (config.interaction_enabled) {
|
|
@@ -5387,7 +5505,7 @@ var legend$1 = {
|
|
|
5387
5505
|
else {
|
|
5388
5506
|
api.toggle(id);
|
|
5389
5507
|
select(this)
|
|
5390
|
-
.classed(
|
|
5508
|
+
.classed($FOCUS.legendItemFocused, false);
|
|
5391
5509
|
}
|
|
5392
5510
|
}
|
|
5393
5511
|
isTouch && $$.hideTooltip();
|
|
@@ -5395,18 +5513,18 @@ var legend$1 = {
|
|
|
5395
5513
|
!isTouch && item
|
|
5396
5514
|
.on("mouseout", function (event, id) {
|
|
5397
5515
|
if (!callFn(config.legend_item_onout, api, id)) {
|
|
5398
|
-
select(this).classed(
|
|
5516
|
+
select(this).classed($FOCUS.legendItemFocused, false);
|
|
5399
5517
|
if (hasGauge) {
|
|
5400
|
-
$$.undoMarkOverlapped($$, ".".concat(
|
|
5518
|
+
$$.undoMarkOverlapped($$, ".".concat($GAUGE.gaugeValue));
|
|
5401
5519
|
}
|
|
5402
5520
|
$$.api.revert();
|
|
5403
5521
|
}
|
|
5404
5522
|
})
|
|
5405
5523
|
.on("mouseover", function (event, id) {
|
|
5406
5524
|
if (!callFn(config.legend_item_onover, api, id)) {
|
|
5407
|
-
select(this).classed(
|
|
5525
|
+
select(this).classed($FOCUS.legendItemFocused, true);
|
|
5408
5526
|
if (hasGauge) {
|
|
5409
|
-
$$.markOverlapped(id, $$, ".".concat(
|
|
5527
|
+
$$.markOverlapped(id, $$, ".".concat($GAUGE.gaugeValue));
|
|
5410
5528
|
}
|
|
5411
5529
|
if (!state.transiting && $$.isTargetToShow(id)) {
|
|
5412
5530
|
api.focus(id);
|
|
@@ -5534,7 +5652,7 @@ var legend$1 = {
|
|
|
5534
5652
|
var yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; };
|
|
5535
5653
|
var pos = -200;
|
|
5536
5654
|
// Define g for legend area
|
|
5537
|
-
var l = legend.selectAll(".".concat(
|
|
5655
|
+
var l = legend.selectAll(".".concat($LEGEND.legendItem))
|
|
5538
5656
|
.data(targetIdz)
|
|
5539
5657
|
.enter()
|
|
5540
5658
|
.append("g");
|
|
@@ -5548,7 +5666,7 @@ var legend$1 = {
|
|
|
5548
5666
|
.attr("x", isLegendRightOrInset ? xForLegendText : pos)
|
|
5549
5667
|
.attr("y", isLegendRightOrInset ? pos : yForLegendText);
|
|
5550
5668
|
l.append("rect")
|
|
5551
|
-
.attr("class",
|
|
5669
|
+
.attr("class", $LEGEND.legendItemEvent)
|
|
5552
5670
|
.style("fill-opacity", "0")
|
|
5553
5671
|
.attr("x", isLegendRightOrInset ? xForLegendRect : pos)
|
|
5554
5672
|
.attr("y", isLegendRightOrInset ? pos : yForLegendRect);
|
|
@@ -5571,7 +5689,7 @@ var legend$1 = {
|
|
|
5571
5689
|
}
|
|
5572
5690
|
return doc.createElementNS(namespaces.svg, ("hasValidPointType" in $$) && $$.hasValidPointType(point) ? point : "use");
|
|
5573
5691
|
})
|
|
5574
|
-
.attr("class",
|
|
5692
|
+
.attr("class", $LEGEND.legendItemPoint)
|
|
5575
5693
|
.style("fill", getColor)
|
|
5576
5694
|
.style("pointer-events", "none")
|
|
5577
5695
|
.attr("href", function (data, idx, selection) {
|
|
@@ -5583,7 +5701,7 @@ var legend$1 = {
|
|
|
5583
5701
|
}
|
|
5584
5702
|
else {
|
|
5585
5703
|
l.append("line")
|
|
5586
|
-
.attr("class",
|
|
5704
|
+
.attr("class", $LEGEND.legendItemTile)
|
|
5587
5705
|
.style("stroke", getColor)
|
|
5588
5706
|
.style("pointer-events", "none")
|
|
5589
5707
|
.attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos)
|
|
@@ -5593,10 +5711,10 @@ var legend$1 = {
|
|
|
5593
5711
|
.attr("stroke-width", config.legend_item_tile_height);
|
|
5594
5712
|
}
|
|
5595
5713
|
// Set background for inset legend
|
|
5596
|
-
background = legend.select(".".concat(
|
|
5714
|
+
background = legend.select(".".concat($LEGEND.legendBackground, " rect"));
|
|
5597
5715
|
if (state.isLegendInset && maxWidth > 0 && background.size() === 0) {
|
|
5598
|
-
background = legend.insert("g", ".".concat(
|
|
5599
|
-
.attr("class",
|
|
5716
|
+
background = legend.insert("g", ".".concat($LEGEND.legendItem))
|
|
5717
|
+
.attr("class", $LEGEND.legendBackground)
|
|
5600
5718
|
.append("rect");
|
|
5601
5719
|
}
|
|
5602
5720
|
var texts = legend.selectAll("text")
|
|
@@ -5608,7 +5726,7 @@ var legend$1 = {
|
|
|
5608
5726
|
$T(texts, withTransition)
|
|
5609
5727
|
.attr("x", xForLegendText)
|
|
5610
5728
|
.attr("y", yForLegendText);
|
|
5611
|
-
var rects = legend.selectAll("rect.".concat(
|
|
5729
|
+
var rects = legend.selectAll("rect.".concat($LEGEND.legendItemEvent))
|
|
5612
5730
|
.data(targetIdz);
|
|
5613
5731
|
$T(rects, withTransition)
|
|
5614
5732
|
.attr("width", function (id) { return widths[id]; })
|
|
@@ -5616,7 +5734,7 @@ var legend$1 = {
|
|
|
5616
5734
|
.attr("x", xForLegendRect)
|
|
5617
5735
|
.attr("y", yForLegendRect);
|
|
5618
5736
|
if (usePoint) {
|
|
5619
|
-
var tiles = legend.selectAll(".".concat(
|
|
5737
|
+
var tiles = legend.selectAll(".".concat($LEGEND.legendItemPoint))
|
|
5620
5738
|
.data(targetIdz);
|
|
5621
5739
|
$T(tiles, withTransition)
|
|
5622
5740
|
.each(function () {
|
|
@@ -5652,7 +5770,7 @@ var legend$1 = {
|
|
|
5652
5770
|
});
|
|
5653
5771
|
}
|
|
5654
5772
|
else {
|
|
5655
|
-
var tiles = legend.selectAll("line.".concat(
|
|
5773
|
+
var tiles = legend.selectAll("line.".concat($LEGEND.legendItemTile))
|
|
5656
5774
|
.data(targetIdz);
|
|
5657
5775
|
$T(tiles, withTransition)
|
|
5658
5776
|
.style("stroke", getColor)
|
|
@@ -5712,7 +5830,7 @@ var redraw = {
|
|
|
5712
5830
|
// @TODO: Make 'init' state to be accessible everywhere not passing as argument.
|
|
5713
5831
|
$$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
|
|
5714
5832
|
// Data empty label positioning and text.
|
|
5715
|
-
config.data_empty_label_text && main.select("text.".concat(
|
|
5833
|
+
config.data_empty_label_text && main.select("text.".concat($TEXT.text, ".").concat($COMMON.empty))
|
|
5716
5834
|
.attr("x", state.width / 2)
|
|
5717
5835
|
.attr("y", state.height / 2)
|
|
5718
5836
|
.text(config.data_empty_label_text)
|
|
@@ -5728,7 +5846,7 @@ var redraw = {
|
|
|
5728
5846
|
}
|
|
5729
5847
|
});
|
|
5730
5848
|
// circles for select
|
|
5731
|
-
$el.text && main.selectAll(".".concat(
|
|
5849
|
+
$el.text && main.selectAll(".".concat($SELECT.selectedCircles))
|
|
5732
5850
|
.filter($$.isBarType.bind($$))
|
|
5733
5851
|
.selectAll("circle")
|
|
5734
5852
|
.remove();
|
|
@@ -5998,16 +6116,17 @@ var scale = {
|
|
|
5998
6116
|
var axis = $$.axis, config = $$.config, format = $$.format, org = $$.org, scale = $$.scale, _c = $$.state, width = _c.width, height = _c.height, width2 = _c.width2, height2 = _c.height2, hasAxis = _c.hasAxis;
|
|
5999
6117
|
if (hasAxis) {
|
|
6000
6118
|
var isRotated = config.axis_rotated;
|
|
6119
|
+
var resettedPadding = $$.getResettedPadding(1);
|
|
6001
6120
|
// update edges
|
|
6002
6121
|
var min = {
|
|
6003
|
-
x: isRotated ?
|
|
6122
|
+
x: isRotated ? resettedPadding : 0,
|
|
6004
6123
|
y: isRotated ? 0 : height,
|
|
6005
6124
|
subX: isRotated ? 1 : 0,
|
|
6006
6125
|
subY: isRotated ? 0 : height2
|
|
6007
6126
|
};
|
|
6008
6127
|
var max = {
|
|
6009
6128
|
x: isRotated ? height : width,
|
|
6010
|
-
y: isRotated ? width :
|
|
6129
|
+
y: isRotated ? width : resettedPadding,
|
|
6011
6130
|
subX: isRotated ? height : width,
|
|
6012
6131
|
subY: isRotated ? width2 : 1
|
|
6013
6132
|
};
|
|
@@ -6112,6 +6231,19 @@ var shape = {
|
|
|
6112
6231
|
}
|
|
6113
6232
|
return shape;
|
|
6114
6233
|
},
|
|
6234
|
+
/**
|
|
6235
|
+
* Get shape's indices according it's position
|
|
6236
|
+
*
|
|
6237
|
+
* From the below example, indices will be:
|
|
6238
|
+
* ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
|
|
6239
|
+
*
|
|
6240
|
+
* data1 data3 data1 data3
|
|
6241
|
+
* data2 data4 data2 data4
|
|
6242
|
+
* -------------------------
|
|
6243
|
+
* 0 1
|
|
6244
|
+
* @param {Function} typeFilter Chart type filter function
|
|
6245
|
+
* @returns {object} Indices object with its position
|
|
6246
|
+
*/
|
|
6115
6247
|
getShapeIndices: function (typeFilter) {
|
|
6116
6248
|
var $$ = this;
|
|
6117
6249
|
var config = $$.config;
|
|
@@ -6151,12 +6283,25 @@ var shape = {
|
|
|
6151
6283
|
/**
|
|
6152
6284
|
* Get indices value based on data ID value
|
|
6153
6285
|
* @param {object} indices Indices object
|
|
6154
|
-
* @param {
|
|
6286
|
+
* @param {object} d Data row
|
|
6287
|
+
* @param {string} caller Caller function name (Used only for 'sparkline' plugin)
|
|
6155
6288
|
* @returns {object} Indices object
|
|
6156
6289
|
* @private
|
|
6157
6290
|
*/
|
|
6158
|
-
getIndices: function (indices,
|
|
6159
|
-
var
|
|
6291
|
+
getIndices: function (indices, d, caller) {
|
|
6292
|
+
var $$ = this;
|
|
6293
|
+
var _a = $$.config, xs = _a.data_xs, removeNull = _a.bar_indices_removeNull;
|
|
6294
|
+
var id = d.id, index = d.index;
|
|
6295
|
+
if ($$.isBarType(id) && removeNull) {
|
|
6296
|
+
var ind_1 = {};
|
|
6297
|
+
// redefine bar indices order
|
|
6298
|
+
$$.getAllValuesOnIndex(index, true)
|
|
6299
|
+
.forEach(function (v, i) {
|
|
6300
|
+
ind_1[v.id] = i;
|
|
6301
|
+
ind_1.__max__ = i;
|
|
6302
|
+
});
|
|
6303
|
+
return ind_1;
|
|
6304
|
+
}
|
|
6160
6305
|
return notEmpty(xs) ?
|
|
6161
6306
|
indices[xs[id]] : indices;
|
|
6162
6307
|
},
|
|
@@ -6181,7 +6326,7 @@ var shape = {
|
|
|
6181
6326
|
var sum = function (p, c) { return p + c; };
|
|
6182
6327
|
var halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
|
|
6183
6328
|
return function (d) {
|
|
6184
|
-
var ind = $$.getIndices(indices, d
|
|
6329
|
+
var ind = $$.getIndices(indices, d, "getShapeX");
|
|
6185
6330
|
var index = d.id in ind ? ind[d.id] : 0;
|
|
6186
6331
|
var targetsNum = (ind.__max__ || 0) + 1;
|
|
6187
6332
|
var x = 0;
|
|
@@ -6225,6 +6370,10 @@ var shape = {
|
|
|
6225
6370
|
else if ($$.isBubbleZType(d)) {
|
|
6226
6371
|
value = $$.getBubbleZData(d.value, "y");
|
|
6227
6372
|
}
|
|
6373
|
+
else if ($$.isBarRangeType(d)) {
|
|
6374
|
+
// TODO use range.getEnd() like method
|
|
6375
|
+
value = value[1];
|
|
6376
|
+
}
|
|
6228
6377
|
return $$.getYScaleById(d.id, isSub)(value);
|
|
6229
6378
|
};
|
|
6230
6379
|
},
|
|
@@ -6236,9 +6385,11 @@ var shape = {
|
|
|
6236
6385
|
*/
|
|
6237
6386
|
getShapeYMin: function (id) {
|
|
6238
6387
|
var $$ = this;
|
|
6239
|
-
var
|
|
6388
|
+
var axisId = $$.axis.getId(id);
|
|
6389
|
+
var scale = $$.scale[axisId];
|
|
6240
6390
|
var yMin = scale.domain()[0];
|
|
6241
|
-
|
|
6391
|
+
var inverted = $$.config["axis_".concat(axisId, "_inverted")];
|
|
6392
|
+
return !$$.isGrouped(id) && !inverted && yMin > 0 ? yMin : 0;
|
|
6242
6393
|
},
|
|
6243
6394
|
/**
|
|
6244
6395
|
* Get Shape's offset data
|
|
@@ -6281,8 +6432,12 @@ var shape = {
|
|
|
6281
6432
|
var _a = $$.getShapeOffsetData(typeFilter), shapeOffsetTargets = _a.shapeOffsetTargets, indexMapByTargetId = _a.indexMapByTargetId;
|
|
6282
6433
|
return function (d, idx) {
|
|
6283
6434
|
var id = d.id, value = d.value, x = d.x;
|
|
6284
|
-
var ind = $$.getIndices(indices,
|
|
6435
|
+
var ind = $$.getIndices(indices, d);
|
|
6285
6436
|
var scale = $$.getYScaleById(id, isSub);
|
|
6437
|
+
if ($$.isBarRangeType(d)) {
|
|
6438
|
+
// TODO use range.getStart()
|
|
6439
|
+
return scale(value[0]);
|
|
6440
|
+
}
|
|
6286
6441
|
var y0 = scale($$.getShapeYMin(id));
|
|
6287
6442
|
var dataXAsNumber = Number(x);
|
|
6288
6443
|
var offset = y0;
|
|
@@ -6290,6 +6445,7 @@ var shape = {
|
|
|
6290
6445
|
.filter(function (t) { return t.id !== id; })
|
|
6291
6446
|
.forEach(function (t) {
|
|
6292
6447
|
var tid = t.id, rowValueMapByXValue = t.rowValueMapByXValue, rowValues = t.rowValues, tvalues = t.values;
|
|
6448
|
+
// for same stacked group (ind[tid] === ind[id])
|
|
6293
6449
|
if (ind[tid] === ind[id] && indexMapByTargetId[tid] < indexMapByTargetId[id]) {
|
|
6294
6450
|
var row = rowValues[idx];
|
|
6295
6451
|
// check if the x values line up
|
|
@@ -6409,6 +6565,24 @@ var shape = {
|
|
|
6409
6565
|
return $$.isSplineType(d) ?
|
|
6410
6566
|
interpolation : ($$.isStepType(d) ?
|
|
6411
6567
|
config.line_step_type : "linear");
|
|
6568
|
+
},
|
|
6569
|
+
isWithinBar: function (that) {
|
|
6570
|
+
var mouse = getPointer(this.state.event, that);
|
|
6571
|
+
var list = getRectSegList(that);
|
|
6572
|
+
var seg0 = list[0], seg1 = list[1];
|
|
6573
|
+
var x = Math.min(seg0.x, seg1.x);
|
|
6574
|
+
var y = Math.min(seg0.y, seg1.y);
|
|
6575
|
+
var offset = this.config.bar_sensitivity;
|
|
6576
|
+
var _a = that.getBBox(), width = _a.width, height = _a.height;
|
|
6577
|
+
var sx = x - offset;
|
|
6578
|
+
var ex = x + width + offset;
|
|
6579
|
+
var sy = y + height + offset;
|
|
6580
|
+
var ey = y - offset;
|
|
6581
|
+
var isWithin = sx < mouse[0] &&
|
|
6582
|
+
mouse[0] < ex &&
|
|
6583
|
+
ey < mouse[1] &&
|
|
6584
|
+
mouse[1] < sy;
|
|
6585
|
+
return isWithin;
|
|
6412
6586
|
}
|
|
6413
6587
|
};
|
|
6414
6588
|
|
|
@@ -6554,7 +6728,7 @@ var size = {
|
|
|
6554
6728
|
var $$ = this;
|
|
6555
6729
|
var config = $$.config, $el = $$.$el;
|
|
6556
6730
|
var hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner);
|
|
6557
|
-
var leftAxisClass = config.axis_rotated ?
|
|
6731
|
+
var leftAxisClass = config.axis_rotated ? $AXIS.axisX : $AXIS.axisY;
|
|
6558
6732
|
var leftAxis = $el.main.select(".".concat(leftAxisClass)).node();
|
|
6559
6733
|
var svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 };
|
|
6560
6734
|
var chartRect = $el.chart.node().getBoundingClientRect();
|
|
@@ -6582,7 +6756,7 @@ var size = {
|
|
|
6582
6756
|
.attr("width", current.width)
|
|
6583
6757
|
.attr("height", current.height);
|
|
6584
6758
|
if (hasAxis) {
|
|
6585
|
-
var brush = svg.select(".".concat(
|
|
6759
|
+
var brush = svg.select(".".concat($SUBCHART.brush, " .overlay"));
|
|
6586
6760
|
var brushSize = { width: 0, height: 0 };
|
|
6587
6761
|
if (brush.size()) {
|
|
6588
6762
|
brushSize.width = +brush.attr("width");
|
|
@@ -6604,6 +6778,31 @@ var size = {
|
|
|
6604
6778
|
.attr("height", brushSize.height);
|
|
6605
6779
|
}
|
|
6606
6780
|
},
|
|
6781
|
+
/**
|
|
6782
|
+
* Get resetted padding values when 'padding=false' option is set
|
|
6783
|
+
* https://github.com/naver/billboard.js/issues/2367
|
|
6784
|
+
* @param {number|object} v Padding values to be resetted
|
|
6785
|
+
* @returns {number|object} Padding value
|
|
6786
|
+
* @private
|
|
6787
|
+
*/
|
|
6788
|
+
getResettedPadding: function (v) {
|
|
6789
|
+
var $$ = this;
|
|
6790
|
+
var config = $$.config;
|
|
6791
|
+
var isNum = isNumber(v);
|
|
6792
|
+
var p = isNum ? 0 : {};
|
|
6793
|
+
if (config.padding === false) {
|
|
6794
|
+
!isNum && Object.keys(v).forEach(function (key) {
|
|
6795
|
+
// when data.lables=true, do not reset top padding
|
|
6796
|
+
p[key] = (!isEmpty(config.data_labels) &&
|
|
6797
|
+
config.data_labels !== false &&
|
|
6798
|
+
key === "top") ? v[key] : 0;
|
|
6799
|
+
});
|
|
6800
|
+
}
|
|
6801
|
+
else {
|
|
6802
|
+
p = v;
|
|
6803
|
+
}
|
|
6804
|
+
return p;
|
|
6805
|
+
},
|
|
6607
6806
|
/**
|
|
6608
6807
|
* Update size values
|
|
6609
6808
|
* @param {boolean} isInit If is called at initialization
|
|
@@ -6641,6 +6840,7 @@ var size = {
|
|
|
6641
6840
|
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
|
6642
6841
|
left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
|
6643
6842
|
};
|
|
6843
|
+
state.margin = $$.getResettedPadding(state.margin);
|
|
6644
6844
|
// for subchart
|
|
6645
6845
|
state.margin2 = isRotated ? {
|
|
6646
6846
|
top: state.margin.top,
|
|
@@ -6709,8 +6909,8 @@ var text = {
|
|
|
6709
6909
|
*/
|
|
6710
6910
|
initText: function () {
|
|
6711
6911
|
var $el = this.$el;
|
|
6712
|
-
$el.main.select(".".concat(
|
|
6713
|
-
.attr("class",
|
|
6912
|
+
$el.main.select(".".concat($COMMON.chart)).append("g")
|
|
6913
|
+
.attr("class", $TEXT.chartTexts);
|
|
6714
6914
|
},
|
|
6715
6915
|
/**
|
|
6716
6916
|
* Update chartText
|
|
@@ -6722,7 +6922,7 @@ var text = {
|
|
|
6722
6922
|
var classChartText = $$.getChartClass("Text");
|
|
6723
6923
|
var classTexts = $$.getClass("texts", "id");
|
|
6724
6924
|
var classFocus = $$.classFocus.bind($$);
|
|
6725
|
-
var mainTextUpdate = $$.$el.main.select(".".concat(
|
|
6925
|
+
var mainTextUpdate = $$.$el.main.select(".".concat($TEXT.chartTexts)).selectAll(".".concat($TEXT.chartText))
|
|
6726
6926
|
.data(targets)
|
|
6727
6927
|
.attr("class", function (d) { return classChartText(d) + classFocus(d); });
|
|
6728
6928
|
var mainTextEnter = mainTextUpdate.enter().append("g")
|
|
@@ -6740,8 +6940,8 @@ var text = {
|
|
|
6740
6940
|
var $$ = this;
|
|
6741
6941
|
var $el = $$.$el, $T = $$.$T, config = $$.config;
|
|
6742
6942
|
var classText = $$.getClass("text", "index");
|
|
6743
|
-
var text = $el.main.selectAll(".".concat(
|
|
6744
|
-
.selectAll(".".concat(
|
|
6943
|
+
var text = $el.main.selectAll(".".concat($TEXT.texts))
|
|
6944
|
+
.selectAll(".".concat($TEXT.text))
|
|
6745
6945
|
.data($$.labelishData.bind($$));
|
|
6746
6946
|
$T(text.exit())
|
|
6747
6947
|
.style("fill-opacity", "0")
|
|
@@ -6965,13 +7165,14 @@ var text = {
|
|
|
6965
7165
|
* @private
|
|
6966
7166
|
*/
|
|
6967
7167
|
getXForText: function (points, d, textElement) {
|
|
7168
|
+
var _a;
|
|
6968
7169
|
var $$ = this;
|
|
6969
7170
|
var config = $$.config, state = $$.state;
|
|
6970
7171
|
var isRotated = config.axis_rotated;
|
|
6971
7172
|
var xPos = points[0][0];
|
|
6972
|
-
if ($$.
|
|
7173
|
+
if ($$.isCandlestickType(d)) {
|
|
6973
7174
|
if (isRotated) {
|
|
6974
|
-
xPos = $$.getCandlestickData(d)._isUp ?
|
|
7175
|
+
xPos = ((_a = $$.getCandlestickData(d)) === null || _a === void 0 ? void 0 : _a._isUp) ?
|
|
6975
7176
|
points[2][2] + 4 : points[2][1] - 4;
|
|
6976
7177
|
}
|
|
6977
7178
|
else {
|
|
@@ -7094,7 +7295,7 @@ var text = {
|
|
|
7094
7295
|
Math.ceil(nodeForWidth.node().getComputedTextLength());
|
|
7095
7296
|
var overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) <
|
|
7096
7297
|
parseInt(textNode.style("font-size"), 10);
|
|
7097
|
-
filteredTextNode.classed(
|
|
7298
|
+
filteredTextNode.classed($TEXT.TextOverlapping, overlapsX && overlapsY);
|
|
7098
7299
|
});
|
|
7099
7300
|
},
|
|
7100
7301
|
/**
|
|
@@ -7108,7 +7309,7 @@ var text = {
|
|
|
7108
7309
|
$$.$el.arcs.selectAll(selector)
|
|
7109
7310
|
.each(function () {
|
|
7110
7311
|
selectAll([this, this.previousSibling])
|
|
7111
|
-
.classed(
|
|
7312
|
+
.classed($TEXT.TextOverlapping, false);
|
|
7112
7313
|
});
|
|
7113
7314
|
},
|
|
7114
7315
|
/**
|
|
@@ -7166,7 +7367,7 @@ var title = {
|
|
|
7166
7367
|
var text = $el.title
|
|
7167
7368
|
.append("text")
|
|
7168
7369
|
.style("text-anchor", getTextPos(config.title_position))
|
|
7169
|
-
.attr("class",
|
|
7370
|
+
.attr("class", $TEXT.title);
|
|
7170
7371
|
setTextValue(text, config.title_text, [0.3, 1.5]);
|
|
7171
7372
|
}
|
|
7172
7373
|
},
|
|
@@ -7196,7 +7397,7 @@ var title = {
|
|
|
7196
7397
|
var $$ = this;
|
|
7197
7398
|
var config = $$.config, current = $$.state.current;
|
|
7198
7399
|
var position = config.title_position || "left";
|
|
7199
|
-
var textRectWidth = $$.getTextRect($$.$el.title,
|
|
7400
|
+
var textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width;
|
|
7200
7401
|
var x;
|
|
7201
7402
|
if (/(right|center)/.test(position)) {
|
|
7202
7403
|
x = current.width - textRectWidth;
|
|
@@ -7220,7 +7421,7 @@ var title = {
|
|
|
7220
7421
|
yForTitle: function () {
|
|
7221
7422
|
var $$ = this;
|
|
7222
7423
|
return ($$.config.title_padding.top || 0) +
|
|
7223
|
-
$$.getTextRect($$.$el.title,
|
|
7424
|
+
$$.getTextRect($$.$el.title, $TEXT.title).height;
|
|
7224
7425
|
},
|
|
7225
7426
|
/**
|
|
7226
7427
|
* Get title padding
|
|
@@ -7244,9 +7445,8 @@ var tooltip$1 = {
|
|
|
7244
7445
|
$el.tooltip = select(config.tooltip_contents.bindto);
|
|
7245
7446
|
if ($el.tooltip.empty()) {
|
|
7246
7447
|
$el.tooltip = $el.chart
|
|
7247
|
-
.style("position", "relative")
|
|
7248
7448
|
.append("div")
|
|
7249
|
-
.attr("class",
|
|
7449
|
+
.attr("class", $TOOLTIP.tooltipContainer)
|
|
7250
7450
|
.style("position", "absolute")
|
|
7251
7451
|
.style("pointer-events", "none")
|
|
7252
7452
|
.style("display", "none");
|
|
@@ -7369,12 +7569,12 @@ var tooltip$1 = {
|
|
|
7369
7569
|
var title = (state.hasAxis || state.hasRadar) &&
|
|
7370
7570
|
sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
|
7371
7571
|
text = tplProcess(tpl[0], {
|
|
7372
|
-
CLASS_TOOLTIP:
|
|
7572
|
+
CLASS_TOOLTIP: $TOOLTIP.tooltip,
|
|
7373
7573
|
TITLE: isValue(title) ? (tplStr ? title : "<tr><th colspan=\"2\">".concat(title, "</th></tr>")) : ""
|
|
7374
7574
|
});
|
|
7375
7575
|
}
|
|
7376
7576
|
if (!row.ratio && $$.$el.arcs) {
|
|
7377
|
-
row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path.".concat(
|
|
7577
|
+
row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path.".concat($ARC.arc, "-").concat(row.id)).data()[0]);
|
|
7378
7578
|
}
|
|
7379
7579
|
param = [row.ratio, row.id, row.index, d];
|
|
7380
7580
|
value = sanitise(valueFormat.apply(void 0, __spreadArray([getRowValue(row)], param, false)));
|
|
@@ -7386,6 +7586,10 @@ var tooltip$1 = {
|
|
|
7386
7586
|
var _c = ["open", "high", "low", "close", "volume"].map(function (v) { return sanitise(valueFormat.apply(void 0, __spreadArray([$$.getRangedData(row, v, "candlestick")], param, false))); }), open_1 = _c[0], high = _c[1], low = _c[2], close_1 = _c[3], volume = _c[4];
|
|
7387
7587
|
value = "<b>Open:</b> ".concat(open_1, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low, " <b>Close:</b> ").concat(close_1).concat(volume ? " <b>Volume:</b> ".concat(volume) : "");
|
|
7388
7588
|
}
|
|
7589
|
+
else if ($$.isBarRangeType(row)) {
|
|
7590
|
+
var _d = row.value, start = _d[0], end = _d[1];
|
|
7591
|
+
value = "".concat(valueFormat(start), " ~ ").concat(valueFormat(end));
|
|
7592
|
+
}
|
|
7389
7593
|
if (value !== undefined) {
|
|
7390
7594
|
// Skip elements when their name is set to null
|
|
7391
7595
|
if (row.name === null) {
|
|
@@ -7394,7 +7598,7 @@ var tooltip$1 = {
|
|
|
7394
7598
|
var name_1 = sanitise(nameFormat.apply(void 0, __spreadArray([row.name], param, false)));
|
|
7395
7599
|
var color_1 = getBgColor(row);
|
|
7396
7600
|
var contentValue_1 = {
|
|
7397
|
-
CLASS_TOOLTIP_NAME:
|
|
7601
|
+
CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
|
7398
7602
|
COLOR: (tplStr || !$$.patterns) ? color_1 : "<svg><rect style=\"fill:".concat(color_1, "\" width=\"10\" height=\"10\"></rect></svg>"),
|
|
7399
7603
|
NAME: name_1,
|
|
7400
7604
|
VALUE: value
|
|
@@ -7671,19 +7875,19 @@ var transform = {
|
|
|
7671
7875
|
var main = $$.$el.main, $T = $$.$T;
|
|
7672
7876
|
var xAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisX) ?
|
|
7673
7877
|
transitions.axisX :
|
|
7674
|
-
$T(main.select(".".concat(
|
|
7878
|
+
$T(main.select(".".concat($AXIS.axisX)), withTransition);
|
|
7675
7879
|
var yAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY) ?
|
|
7676
7880
|
transitions.axisY :
|
|
7677
|
-
$T(main.select(".".concat(
|
|
7881
|
+
$T(main.select(".".concat($AXIS.axisY)), withTransition);
|
|
7678
7882
|
var y2Axis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY2) ?
|
|
7679
7883
|
transitions.axisY2 :
|
|
7680
|
-
$T(main.select(".".concat(
|
|
7884
|
+
$T(main.select(".".concat($AXIS.axisY2)), withTransition);
|
|
7681
7885
|
$T(main, withTransition)
|
|
7682
7886
|
.attr("transform", $$.getTranslate("main"));
|
|
7683
7887
|
xAxis.attr("transform", $$.getTranslate("x"));
|
|
7684
7888
|
yAxis.attr("transform", $$.getTranslate("y"));
|
|
7685
7889
|
y2Axis.attr("transform", $$.getTranslate("y2"));
|
|
7686
|
-
main.select(".".concat(
|
|
7890
|
+
main.select(".".concat($ARC.chartArcs))
|
|
7687
7891
|
.attr("transform", $$.getTranslate("arc"));
|
|
7688
7892
|
},
|
|
7689
7893
|
transformAll: function (withTransition, transitions) {
|
|
@@ -8028,6 +8232,13 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8028
8232
|
checkModuleImport($$);
|
|
8029
8233
|
state.hasAxis = !$$.hasArcType();
|
|
8030
8234
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
8235
|
+
// when 'padding=false' is set, disable axes and subchart. Because they are useless.
|
|
8236
|
+
if (config.padding === false) {
|
|
8237
|
+
config.axis_x_show = false;
|
|
8238
|
+
config.axis_y_show = false;
|
|
8239
|
+
config.axis_y2_show = false;
|
|
8240
|
+
config.subchart_show = false;
|
|
8241
|
+
}
|
|
8031
8242
|
$$.initParams();
|
|
8032
8243
|
var bindto = {
|
|
8033
8244
|
element: config.bindto,
|
|
@@ -8043,7 +8254,9 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8043
8254
|
if ($el.chart.empty()) {
|
|
8044
8255
|
$el.chart = select(doc.body.appendChild(doc.createElement("div")));
|
|
8045
8256
|
}
|
|
8046
|
-
$el.chart.html("")
|
|
8257
|
+
$el.chart.html("")
|
|
8258
|
+
.classed(bindto.classname, true)
|
|
8259
|
+
.style("position", "relative");
|
|
8047
8260
|
$$.initToRender();
|
|
8048
8261
|
};
|
|
8049
8262
|
/**
|
|
@@ -8111,7 +8324,8 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8111
8324
|
config.legend_inset_anchor === "top-right";
|
|
8112
8325
|
state.isLegendLeft = config.legend_inset_anchor === "top-left" ||
|
|
8113
8326
|
config.legend_inset_anchor === "bottom-left";
|
|
8114
|
-
state.
|
|
8327
|
+
state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
|
|
8328
|
+
state.rotatedPadding.right = isRotated && !config.axis_x_show ? 0 : 30;
|
|
8115
8329
|
state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
|
|
8116
8330
|
};
|
|
8117
8331
|
ChartInternal.prototype.initWithData = function (data) {
|
|
@@ -8192,7 +8406,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8192
8406
|
$$.bindResize();
|
|
8193
8407
|
// Define regions
|
|
8194
8408
|
var main = $el.svg.append("g")
|
|
8195
|
-
.classed(
|
|
8409
|
+
.classed($COMMON.main, true)
|
|
8196
8410
|
.attr("transform", $$.getTranslate("main"));
|
|
8197
8411
|
$el.main = main;
|
|
8198
8412
|
// initialize subchart when subchart show option is set
|
|
@@ -8204,7 +8418,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8204
8418
|
// text when empty
|
|
8205
8419
|
if (config.data_empty_label_text) {
|
|
8206
8420
|
main.append("text")
|
|
8207
|
-
.attr("class", "".concat(
|
|
8421
|
+
.attr("class", "".concat($TEXT.text, " ").concat($COMMON.empty))
|
|
8208
8422
|
.attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
|
|
8209
8423
|
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
|
|
8210
8424
|
}
|
|
@@ -8215,7 +8429,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8215
8429
|
!config.clipPath && $$.axis.init();
|
|
8216
8430
|
}
|
|
8217
8431
|
// Define g for chart area
|
|
8218
|
-
main.append("g").attr("class",
|
|
8432
|
+
main.append("g").attr("class", $COMMON.chart)
|
|
8219
8433
|
.attr("clip-path", state.clip.path);
|
|
8220
8434
|
$$.callPluginHook("$init");
|
|
8221
8435
|
if (hasAxis) {
|
|
@@ -8374,7 +8588,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8374
8588
|
ChartInternal.prototype.showTargets = function () {
|
|
8375
8589
|
var $$ = this;
|
|
8376
8590
|
var svg = $$.$el.svg, $T = $$.$T;
|
|
8377
|
-
$T(svg.selectAll(".".concat(
|
|
8591
|
+
$T(svg.selectAll(".".concat($COMMON.target))
|
|
8378
8592
|
.filter(function (d) { return $$.isTargetToShow(d.id); })).style("opacity", null);
|
|
8379
8593
|
};
|
|
8380
8594
|
ChartInternal.prototype.getWithOption = function (options) {
|
|
@@ -8608,11 +8822,16 @@ var apiChart = {
|
|
|
8608
8822
|
if (notEmpty($$)) {
|
|
8609
8823
|
$$.callPluginHook("$willDestroy");
|
|
8610
8824
|
$$.charts.splice($$.charts.indexOf(this), 1);
|
|
8825
|
+
// detach events
|
|
8826
|
+
$$.unbindAllEvents();
|
|
8611
8827
|
// clear timers && pending transition
|
|
8612
8828
|
svg.select("*").interrupt();
|
|
8613
8829
|
$$.resizeFunction.clear();
|
|
8614
8830
|
win.removeEventListener("resize", $$.resizeFunction);
|
|
8615
|
-
chart.classed("bb", false)
|
|
8831
|
+
chart.classed("bb", false)
|
|
8832
|
+
.style("position", null)
|
|
8833
|
+
.selectChildren()
|
|
8834
|
+
.remove();
|
|
8616
8835
|
// releasing own references
|
|
8617
8836
|
Object.keys(this).forEach(function (key) {
|
|
8618
8837
|
key === "internal" && Object.keys($$).forEach(function (k) {
|
|
@@ -8999,11 +9218,11 @@ var apiFocus = {
|
|
|
8999
9218
|
var candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
9000
9219
|
this.revert();
|
|
9001
9220
|
this.defocus();
|
|
9002
|
-
candidates.classed(
|
|
9221
|
+
candidates.classed($FOCUS.focused, true).classed($FOCUS.defocused, false);
|
|
9003
9222
|
if ($$.hasArcType() && !state.hasRadar) {
|
|
9004
9223
|
$$.expandArc(targetIds);
|
|
9005
9224
|
$$.hasType("gauge") &&
|
|
9006
|
-
$$.markOverlapped(targetIdsValue, $$, ".".concat(
|
|
9225
|
+
$$.markOverlapped(targetIdsValue, $$, ".".concat($GAUGE.gaugeValue));
|
|
9007
9226
|
}
|
|
9008
9227
|
$$.toggleFocusLegend(targetIds, true);
|
|
9009
9228
|
state.focusedTargetIds = targetIds;
|
|
@@ -9031,11 +9250,11 @@ var apiFocus = {
|
|
|
9031
9250
|
var state = $$.state;
|
|
9032
9251
|
var targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
9033
9252
|
var candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
9034
|
-
candidates.classed(
|
|
9253
|
+
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, true);
|
|
9035
9254
|
if ($$.hasArcType()) {
|
|
9036
9255
|
$$.unexpandArc(targetIds);
|
|
9037
9256
|
$$.hasType("gauge") &&
|
|
9038
|
-
$$.undoMarkOverlapped($$, ".".concat(
|
|
9257
|
+
$$.undoMarkOverlapped($$, ".".concat($GAUGE.gaugeValue));
|
|
9039
9258
|
}
|
|
9040
9259
|
$$.toggleFocusLegend(targetIds, false);
|
|
9041
9260
|
state.focusedTargetIds = state.focusedTargetIds.filter(function (id) { return targetIds.indexOf(id) < 0; });
|
|
@@ -9063,15 +9282,15 @@ var apiFocus = {
|
|
|
9063
9282
|
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
9064
9283
|
var targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
9065
9284
|
var candidates = $el.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets
|
|
9066
|
-
candidates.classed(
|
|
9285
|
+
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
9067
9286
|
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
9068
9287
|
if (config.legend_show) {
|
|
9069
9288
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
9070
9289
|
$el.legend.selectAll($$.selectorLegends(targetIds))
|
|
9071
9290
|
.filter(function () {
|
|
9072
|
-
return select(this).classed(
|
|
9291
|
+
return select(this).classed($FOCUS.legendItemFocused);
|
|
9073
9292
|
})
|
|
9074
|
-
.classed(
|
|
9293
|
+
.classed($FOCUS.legendItemFocused, false);
|
|
9075
9294
|
}
|
|
9076
9295
|
state.focusedTargetIds = [];
|
|
9077
9296
|
state.defocusedTargetIds = [];
|
|
@@ -10209,8 +10428,8 @@ extend(regions, {
|
|
|
10209
10428
|
var $$ = this.internal;
|
|
10210
10429
|
var config = $$.config, $T = $$.$T;
|
|
10211
10430
|
var options = optionsValue || {};
|
|
10212
|
-
var classes = getOption(options, "classes", [
|
|
10213
|
-
var regions = $$.$el.main.select(".".concat(
|
|
10431
|
+
var classes = getOption(options, "classes", [$REGION.region]);
|
|
10432
|
+
var regions = $$.$el.main.select(".".concat($REGION.regions))
|
|
10214
10433
|
.selectAll(classes.map(function (c) { return ".".concat(c); }));
|
|
10215
10434
|
$T(regions)
|
|
10216
10435
|
.style("opacity", "0")
|
|
@@ -11084,7 +11303,7 @@ var Axis = /** @class */ (function () {
|
|
|
11084
11303
|
this.setOrient();
|
|
11085
11304
|
}
|
|
11086
11305
|
Axis.prototype.getAxisClassName = function (id) {
|
|
11087
|
-
return "".concat(
|
|
11306
|
+
return "".concat($AXIS.axis, " ").concat($AXIS["axis".concat(capitalize(id))]);
|
|
11088
11307
|
};
|
|
11089
11308
|
Axis.prototype.isHorizontal = function ($$, forHorizontal) {
|
|
11090
11309
|
var isRotated = $$.config.axis_rotated;
|
|
@@ -11129,7 +11348,7 @@ var Axis = /** @class */ (function () {
|
|
|
11129
11348
|
config.axis_y2_show && target.push("y2");
|
|
11130
11349
|
target.forEach(function (v) {
|
|
11131
11350
|
var classAxis = _this.getAxisClassName(v);
|
|
11132
|
-
var classLabel =
|
|
11351
|
+
var classLabel = $AXIS["axis".concat(v.toUpperCase(), "Label")];
|
|
11133
11352
|
axis[v] = main.append("g")
|
|
11134
11353
|
.attr("class", classAxis)
|
|
11135
11354
|
.attr("clip-path", function () {
|
|
@@ -11208,7 +11427,7 @@ var Axis = /** @class */ (function () {
|
|
|
11208
11427
|
Axis.prototype.updateAxes = function () {
|
|
11209
11428
|
var _this = this;
|
|
11210
11429
|
var $$ = this.owner;
|
|
11211
|
-
var config = $$.config, main = $$.$el.main;
|
|
11430
|
+
var config = $$.config, main = $$.$el.main, $T = $$.$T;
|
|
11212
11431
|
Object.keys(this.axesList).forEach(function (id) {
|
|
11213
11432
|
var axesConfig = config["axis_".concat(id, "_axes")];
|
|
11214
11433
|
var scale = $$.scale[id].copy();
|
|
@@ -11230,7 +11449,7 @@ var Axis = /** @class */ (function () {
|
|
|
11230
11449
|
}
|
|
11231
11450
|
else {
|
|
11232
11451
|
axesConfig[i].domain && scale.domain(axesConfig[i].domain);
|
|
11233
|
-
|
|
11452
|
+
$T(g).call(v.scale(scale));
|
|
11234
11453
|
}
|
|
11235
11454
|
g.attr("transform", $$.getTranslate(id, i + 1));
|
|
11236
11455
|
});
|
|
@@ -11634,9 +11853,9 @@ var Axis = /** @class */ (function () {
|
|
|
11634
11853
|
var $$ = this.owner;
|
|
11635
11854
|
var main = $$.$el.main, $T = $$.$T;
|
|
11636
11855
|
var labels = {
|
|
11637
|
-
x: main.select(".".concat(
|
|
11638
|
-
y: main.select(".".concat(
|
|
11639
|
-
y2: main.select(".".concat(
|
|
11856
|
+
x: main.select(".".concat($AXIS.axisX, " .").concat($AXIS.axisXLabel)),
|
|
11857
|
+
y: main.select(".".concat($AXIS.axisY, " .").concat($AXIS.axisYLabel)),
|
|
11858
|
+
y2: main.select(".".concat($AXIS.axisY2, " .").concat($AXIS.axisY2Label))
|
|
11640
11859
|
};
|
|
11641
11860
|
Object.keys(labels).filter(function (id) { return !labels[id].empty(); })
|
|
11642
11861
|
.forEach(function (v) {
|
|
@@ -11756,10 +11975,11 @@ var Axis = /** @class */ (function () {
|
|
|
11756
11975
|
xDomainForZoom = scale.x.orgDomain();
|
|
11757
11976
|
}
|
|
11758
11977
|
["y", "y2"].forEach(function (key) {
|
|
11978
|
+
var prefix = "axis_".concat(key, "_");
|
|
11759
11979
|
var axisScale = scale[key];
|
|
11760
|
-
if (axisScale) {
|
|
11761
|
-
var tickValues = config["
|
|
11762
|
-
var tickCount = config["
|
|
11980
|
+
if (config["".concat(prefix, "show")] && axisScale) {
|
|
11981
|
+
var tickValues = config["".concat(prefix, "tick_values")];
|
|
11982
|
+
var tickCount = config["".concat(prefix, "tick_count")];
|
|
11763
11983
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
11764
11984
|
if (!tickValues && tickCount) {
|
|
11765
11985
|
var axis = $$.axis[key];
|
|
@@ -11793,12 +12013,14 @@ var Axis = /** @class */ (function () {
|
|
|
11793
12013
|
var axis = $el.axis[type];
|
|
11794
12014
|
// subchart x axis should be aligned with x axis culling
|
|
11795
12015
|
var id = type === "subX" ? "x" : type;
|
|
11796
|
-
var
|
|
12016
|
+
var cullingOptionPrefix = "axis_".concat(id, "_tick_culling");
|
|
12017
|
+
var toCull = config[cullingOptionPrefix];
|
|
11797
12018
|
if (axis && toCull) {
|
|
11798
|
-
var
|
|
11799
|
-
var tickValues_1 = sortValue(
|
|
12019
|
+
var tickNodes = axis.selectAll(".tick");
|
|
12020
|
+
var tickValues_1 = sortValue(tickNodes.data());
|
|
11800
12021
|
var tickSize = tickValues_1.length;
|
|
11801
|
-
var cullingMax = config["
|
|
12022
|
+
var cullingMax = config["".concat(cullingOptionPrefix, "_max")];
|
|
12023
|
+
var lines_1 = config["".concat(cullingOptionPrefix, "_lines")];
|
|
11802
12024
|
var intervalForCulling_1;
|
|
11803
12025
|
if (tickSize) {
|
|
11804
12026
|
for (var i = 1; i < tickSize; i++) {
|
|
@@ -11807,17 +12029,20 @@ var Axis = /** @class */ (function () {
|
|
|
11807
12029
|
break;
|
|
11808
12030
|
}
|
|
11809
12031
|
}
|
|
11810
|
-
|
|
11811
|
-
|
|
12032
|
+
tickNodes.each(function (d) {
|
|
12033
|
+
if (tickValues_1.indexOf(d) % intervalForCulling_1) {
|
|
12034
|
+
(lines_1 ? this.querySelector("text") : this)
|
|
12035
|
+
.style.display = "none";
|
|
12036
|
+
}
|
|
11812
12037
|
});
|
|
11813
12038
|
}
|
|
11814
12039
|
else {
|
|
11815
|
-
|
|
12040
|
+
tickNodes.style("display", null);
|
|
11816
12041
|
}
|
|
11817
12042
|
// set/unset x_axis_tick_clippath
|
|
11818
12043
|
if (type === "x") {
|
|
11819
12044
|
var clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null;
|
|
11820
|
-
$el.svg.selectAll(".".concat(
|
|
12045
|
+
$el.svg.selectAll(".".concat($AXIS.axisX, " .tick text"))
|
|
11821
12046
|
.attr("clip-path", clipPath);
|
|
11822
12047
|
}
|
|
11823
12048
|
}
|
|
@@ -11838,9 +12063,9 @@ var eventrect = {
|
|
|
11838
12063
|
*/
|
|
11839
12064
|
initEventRect: function () {
|
|
11840
12065
|
var $$ = this;
|
|
11841
|
-
$$.$el.main.select(".".concat(
|
|
12066
|
+
$$.$el.main.select(".".concat($COMMON.chart))
|
|
11842
12067
|
.append("g")
|
|
11843
|
-
.attr("class",
|
|
12068
|
+
.attr("class", $EVENT.eventRects)
|
|
11844
12069
|
.style("fill-opacity", "0");
|
|
11845
12070
|
},
|
|
11846
12071
|
/**
|
|
@@ -11856,12 +12081,12 @@ var eventrect = {
|
|
|
11856
12081
|
$$.updateEventRect($el.eventRect, true);
|
|
11857
12082
|
}
|
|
11858
12083
|
else {
|
|
11859
|
-
var eventRects = $$.$el.main.select(".".concat(
|
|
12084
|
+
var eventRects = $$.$el.main.select(".".concat($EVENT.eventRects))
|
|
11860
12085
|
.style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? (config.axis_rotated ? "ns-resize" : "ew-resize") : null)
|
|
11861
|
-
.classed(
|
|
11862
|
-
.classed(
|
|
12086
|
+
.classed($EVENT.eventRectsMultiple, isMultipleX)
|
|
12087
|
+
.classed($EVENT.eventRectsSingle, !isMultipleX);
|
|
11863
12088
|
// append event <rect>
|
|
11864
|
-
var eventRectUpdate = eventRects.selectAll(".".concat(
|
|
12089
|
+
var eventRectUpdate = eventRects.selectAll(".".concat($EVENT.eventRect))
|
|
11865
12090
|
.data([0])
|
|
11866
12091
|
.enter()
|
|
11867
12092
|
.append("rect");
|
|
@@ -11942,7 +12167,7 @@ var eventrect = {
|
|
|
11942
12167
|
})
|
|
11943
12168
|
.on("touchstart.eventRect touchmove.eventRect", function (event) {
|
|
11944
12169
|
state.event = event;
|
|
11945
|
-
if (!eventRect.empty() && eventRect.classed(
|
|
12170
|
+
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
11946
12171
|
// if touch points are > 1, means doing zooming interaction. In this case do not execute tooltip codes.
|
|
11947
12172
|
if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
|
|
11948
12173
|
return;
|
|
@@ -11956,7 +12181,7 @@ var eventrect = {
|
|
|
11956
12181
|
}, true)
|
|
11957
12182
|
.on("touchend.eventRect", function (event) {
|
|
11958
12183
|
state.event = event;
|
|
11959
|
-
if (!eventRect.empty() && eventRect.classed(
|
|
12184
|
+
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
11960
12185
|
if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
|
|
11961
12186
|
state.cancelClick && (state.cancelClick = false);
|
|
11962
12187
|
}
|
|
@@ -11993,7 +12218,7 @@ var eventrect = {
|
|
|
11993
12218
|
.attr("height", height);
|
|
11994
12219
|
// only for init
|
|
11995
12220
|
if (!rendered) {
|
|
11996
|
-
rectElement.attr("class",
|
|
12221
|
+
rectElement.attr("class", $EVENT.eventRect);
|
|
11997
12222
|
}
|
|
11998
12223
|
}
|
|
11999
12224
|
updateClientRect();
|
|
@@ -12105,7 +12330,7 @@ var eventrect = {
|
|
|
12105
12330
|
$$.showGridFocus(selectedData);
|
|
12106
12331
|
// Show cursor as pointer if point is close to mouse position
|
|
12107
12332
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
|
12108
|
-
$$.$el.svg.select(".".concat(
|
|
12333
|
+
$$.$el.svg.select(".".concat($EVENT.eventRect)).style("cursor", "pointer");
|
|
12109
12334
|
if (!state.mouseover) {
|
|
12110
12335
|
config.data_onover.call($$.api, closest);
|
|
12111
12336
|
state.mouseover = closest;
|
|
@@ -12119,7 +12344,7 @@ var eventrect = {
|
|
|
12119
12344
|
unselectRect: function () {
|
|
12120
12345
|
var $$ = this;
|
|
12121
12346
|
var config = $$.config, _a = $$.$el, circle = _a.circle, tooltip = _a.tooltip;
|
|
12122
|
-
$$.$el.svg.select(".".concat(
|
|
12347
|
+
$$.$el.svg.select(".".concat($EVENT.eventRect)).style("cursor", null);
|
|
12123
12348
|
$$.hideGridFocus();
|
|
12124
12349
|
if (tooltip) {
|
|
12125
12350
|
$$.hideTooltip();
|
|
@@ -12131,8 +12356,8 @@ var eventrect = {
|
|
|
12131
12356
|
/**
|
|
12132
12357
|
* Create eventRect for each data on the x-axis.
|
|
12133
12358
|
* Register touch and drag events.
|
|
12134
|
-
* @param {object} eventRectEnter d3.select(
|
|
12135
|
-
* @returns {object} d3.select(
|
|
12359
|
+
* @param {object} eventRectEnter d3.select($EVENT.eventRects) object.
|
|
12360
|
+
* @returns {object} d3.select($EVENT.eventRects) object.
|
|
12136
12361
|
* @private
|
|
12137
12362
|
*/
|
|
12138
12363
|
generateEventRectsForSingleX: function (eventRectEnter) {
|
|
@@ -12215,7 +12440,7 @@ var eventrect = {
|
|
|
12215
12440
|
return;
|
|
12216
12441
|
}
|
|
12217
12442
|
var index = d.index;
|
|
12218
|
-
main.selectAll(".".concat(
|
|
12443
|
+
main.selectAll(".".concat($SHAPE.shape, "-").concat(index))
|
|
12219
12444
|
.each(function (d2) {
|
|
12220
12445
|
var _a;
|
|
12221
12446
|
if (config.data_selection_grouped || $$.isWithinShape(this, d2)) {
|
|
@@ -12227,7 +12452,7 @@ var eventrect = {
|
|
|
12227
12452
|
/**
|
|
12228
12453
|
* Create an eventRect,
|
|
12229
12454
|
* Register touch and drag events.
|
|
12230
|
-
* @param {object} eventRectEnter d3.select(
|
|
12455
|
+
* @param {object} eventRectEnter d3.select($EVENT.eventRects) object.
|
|
12231
12456
|
* @private
|
|
12232
12457
|
*/
|
|
12233
12458
|
generateEventRectsForMultipleXs: function (eventRectEnter) {
|
|
@@ -12268,8 +12493,8 @@ var eventrect = {
|
|
|
12268
12493
|
}
|
|
12269
12494
|
// select if selection enabled
|
|
12270
12495
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
|
12271
|
-
$$.$el.main.selectAll(".".concat(
|
|
12272
|
-
.selectAll(".".concat(
|
|
12496
|
+
$$.$el.main.selectAll(".".concat($SHAPE.shapes).concat($$.getTargetSelectorSuffix(closest.id)))
|
|
12497
|
+
.selectAll(".".concat($SHAPE.shape, "-").concat(closest.index))
|
|
12273
12498
|
.each(function () {
|
|
12274
12499
|
var _a;
|
|
12275
12500
|
if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
|
|
@@ -12664,11 +12889,11 @@ var grid = {
|
|
|
12664
12889
|
var $$ = this;
|
|
12665
12890
|
var config = $$.config, clip = $$.state.clip, $el = $$.$el;
|
|
12666
12891
|
if (config.grid_x_lines.length || config.grid_y_lines.length) {
|
|
12667
|
-
$el.gridLines.main = $el.main.insert("g", ".".concat(
|
|
12892
|
+
$el.gridLines.main = $el.main.insert("g", ".".concat($COMMON.chart).concat(config.grid_lines_front ? " + *" : ""))
|
|
12668
12893
|
.attr("clip-path", clip.pathGrid)
|
|
12669
|
-
.attr("class", "".concat(
|
|
12670
|
-
$el.gridLines.main.append("g").attr("class",
|
|
12671
|
-
$el.gridLines.main.append("g").attr("class",
|
|
12894
|
+
.attr("class", "".concat($GRID.grid, " ").concat($GRID.gridLines));
|
|
12895
|
+
$el.gridLines.main.append("g").attr("class", $GRID.xgridLines);
|
|
12896
|
+
$el.gridLines.main.append("g").attr("class", $GRID.ygridLines);
|
|
12672
12897
|
$el.gridLines.x = selectAll([]);
|
|
12673
12898
|
}
|
|
12674
12899
|
},
|
|
@@ -12690,13 +12915,13 @@ var grid = {
|
|
|
12690
12915
|
"y1": 0,
|
|
12691
12916
|
"y2": state.height
|
|
12692
12917
|
};
|
|
12693
|
-
grid.x = main.select(".".concat(
|
|
12694
|
-
.selectAll(".".concat(
|
|
12918
|
+
grid.x = main.select(".".concat($GRID.xgrids))
|
|
12919
|
+
.selectAll(".".concat($GRID.xgrid))
|
|
12695
12920
|
.data(xgridData);
|
|
12696
12921
|
grid.x.exit().remove();
|
|
12697
12922
|
grid.x = grid.x.enter()
|
|
12698
12923
|
.append("line")
|
|
12699
|
-
.attr("class",
|
|
12924
|
+
.attr("class", $GRID.xgrid)
|
|
12700
12925
|
.merge(grid.x);
|
|
12701
12926
|
if (!withoutUpdate) {
|
|
12702
12927
|
grid.x.each(function () {
|
|
@@ -12715,14 +12940,14 @@ var grid = {
|
|
|
12715
12940
|
var isRotated = config.axis_rotated;
|
|
12716
12941
|
var gridValues = $$.axis.y.tickValues() || $$.scale.y.ticks(config.grid_y_ticks);
|
|
12717
12942
|
var pos = function (d) { return Math.ceil($$.scale.y(d)); };
|
|
12718
|
-
grid.y = main.select(".".concat(
|
|
12719
|
-
.selectAll(".".concat(
|
|
12943
|
+
grid.y = main.select(".".concat($GRID.ygrids))
|
|
12944
|
+
.selectAll(".".concat($GRID.ygrid))
|
|
12720
12945
|
.data(gridValues);
|
|
12721
12946
|
grid.y.exit().remove();
|
|
12722
12947
|
grid.y = grid.y
|
|
12723
12948
|
.enter()
|
|
12724
12949
|
.append("line")
|
|
12725
|
-
.attr("class",
|
|
12950
|
+
.attr("class", $GRID.ygrid)
|
|
12726
12951
|
.merge(grid.y);
|
|
12727
12952
|
grid.y.attr("x1", isRotated ? pos : 0)
|
|
12728
12953
|
.attr("x2", isRotated ? pos : state.width)
|
|
@@ -12749,8 +12974,8 @@ var grid = {
|
|
|
12749
12974
|
var config = $$.config, _a = $$.$el, gridLines = _a.gridLines, main = _a.main, $T = $$.$T;
|
|
12750
12975
|
var isRotated = config.axis_rotated;
|
|
12751
12976
|
config.grid_x_show && $$.updateXGrid();
|
|
12752
|
-
var xLines = main.select(".".concat(
|
|
12753
|
-
.selectAll(".".concat(
|
|
12977
|
+
var xLines = main.select(".".concat($GRID.xgridLines))
|
|
12978
|
+
.selectAll(".".concat($GRID.xgridLine))
|
|
12754
12979
|
.data(config.grid_x_lines);
|
|
12755
12980
|
// exit
|
|
12756
12981
|
$T(xLines.exit())
|
|
@@ -12766,7 +12991,7 @@ var grid = {
|
|
|
12766
12991
|
.style("opacity", "0");
|
|
12767
12992
|
xLines = xgridLine.merge(xLines);
|
|
12768
12993
|
$T(xLines
|
|
12769
|
-
.attr("class", function (d) { return "".concat(
|
|
12994
|
+
.attr("class", function (d) { return "".concat($GRID.xgridLine, " ").concat(d["class"] || "").trim(); })
|
|
12770
12995
|
.select("text")
|
|
12771
12996
|
.attr("text-anchor", getGridTextAnchor)
|
|
12772
12997
|
.attr("dx", getGridTextDx))
|
|
@@ -12783,8 +13008,8 @@ var grid = {
|
|
|
12783
13008
|
var config = $$.config, _a = $$.state, width = _a.width, height = _a.height, $el = $$.$el, $T = $$.$T;
|
|
12784
13009
|
var isRotated = config.axis_rotated;
|
|
12785
13010
|
config.grid_y_show && $$.updateYGrid();
|
|
12786
|
-
var ygridLines = $el.main.select(".".concat(
|
|
12787
|
-
.selectAll(".".concat(
|
|
13011
|
+
var ygridLines = $el.main.select(".".concat($GRID.ygridLines))
|
|
13012
|
+
.selectAll(".".concat($GRID.ygridLine))
|
|
12788
13013
|
.data(config.grid_y_lines);
|
|
12789
13014
|
// exit
|
|
12790
13015
|
$T(ygridLines.exit())
|
|
@@ -12801,7 +13026,7 @@ var grid = {
|
|
|
12801
13026
|
// update
|
|
12802
13027
|
var yv = $$.yv.bind($$);
|
|
12803
13028
|
$T(ygridLines
|
|
12804
|
-
.attr("class", function (d) { return "".concat(
|
|
13029
|
+
.attr("class", function (d) { return "".concat($GRID.ygridLine, " ").concat(d["class"] || "").trim(); })
|
|
12805
13030
|
.select("line"))
|
|
12806
13031
|
.attr("x1", isRotated ? yv : 0)
|
|
12807
13032
|
.attr("x2", isRotated ? yv : width)
|
|
@@ -12842,26 +13067,26 @@ var grid = {
|
|
|
12842
13067
|
var $$ = this;
|
|
12843
13068
|
var config = $$.config, clip = $$.state.clip, $el = $$.$el;
|
|
12844
13069
|
var isFront = config.grid_front;
|
|
12845
|
-
var className = ".".concat(
|
|
13070
|
+
var className = ".".concat(isFront && $el.gridLines.main ? $GRID.gridLines : $COMMON.chart).concat(isFront ? " + *" : "");
|
|
12846
13071
|
var grid = $el.main.insert("g", className)
|
|
12847
13072
|
.attr("clip-path", clip.pathGrid)
|
|
12848
|
-
.attr("class",
|
|
13073
|
+
.attr("class", $GRID.grid);
|
|
12849
13074
|
$el.grid.main = grid;
|
|
12850
13075
|
config.grid_x_show &&
|
|
12851
|
-
grid.append("g").attr("class",
|
|
13076
|
+
grid.append("g").attr("class", $GRID.xgrids);
|
|
12852
13077
|
config.grid_y_show &&
|
|
12853
|
-
grid.append("g").attr("class",
|
|
13078
|
+
grid.append("g").attr("class", $GRID.ygrids);
|
|
12854
13079
|
if (config.interaction_enabled && config.grid_focus_show) {
|
|
12855
13080
|
grid.append("g")
|
|
12856
|
-
.attr("class",
|
|
13081
|
+
.attr("class", $FOCUS.xgridFocus)
|
|
12857
13082
|
.append("line")
|
|
12858
|
-
.attr("class",
|
|
13083
|
+
.attr("class", $FOCUS.xgridFocus);
|
|
12859
13084
|
// to show xy focus grid line, should be 'tooltip.grouped=false'
|
|
12860
13085
|
if (config.grid_focus_y && !config.tooltip_grouped) {
|
|
12861
13086
|
grid.append("g")
|
|
12862
|
-
.attr("class",
|
|
13087
|
+
.attr("class", $FOCUS.ygridFocus)
|
|
12863
13088
|
.append("line")
|
|
12864
|
-
.attr("class",
|
|
13089
|
+
.attr("class", $FOCUS.ygridFocus);
|
|
12865
13090
|
}
|
|
12866
13091
|
}
|
|
12867
13092
|
},
|
|
@@ -12875,7 +13100,7 @@ var grid = {
|
|
|
12875
13100
|
var $$ = this;
|
|
12876
13101
|
var config = $$.config, _b = $$.state, width = _b.width, height = _b.height;
|
|
12877
13102
|
var isRotated = config.axis_rotated;
|
|
12878
|
-
var focusEl = $$.$el.main.selectAll("line.".concat(
|
|
13103
|
+
var focusEl = $$.$el.main.selectAll("line.".concat($FOCUS.xgridFocus, ", line.").concat($FOCUS.ygridFocus));
|
|
12879
13104
|
var dataToShow = (data || [focusEl.datum()]).filter(function (d) { return d && isValue($$.getBaseValue(d)); });
|
|
12880
13105
|
// Hide when bubble/scatter/stanford plot exists
|
|
12881
13106
|
if (!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType()) {
|
|
@@ -12893,7 +13118,7 @@ var grid = {
|
|
|
12893
13118
|
y: $$.getYScaleById(d.id)(d.value)
|
|
12894
13119
|
};
|
|
12895
13120
|
var xy;
|
|
12896
|
-
if (el.classed(
|
|
13121
|
+
if (el.classed($FOCUS.xgridFocus)) {
|
|
12897
13122
|
// will contain 'x1, y1, x2, y2' order
|
|
12898
13123
|
xy = isRotated ?
|
|
12899
13124
|
[
|
|
@@ -12934,7 +13159,7 @@ var grid = {
|
|
|
12934
13159
|
var $$ = this;
|
|
12935
13160
|
var _b = $$.state, inputType = _b.inputType, resizing = _b.resizing, main = $$.$el.main;
|
|
12936
13161
|
if (inputType === "mouse" || !resizing) {
|
|
12937
|
-
main.selectAll("line.".concat(
|
|
13162
|
+
main.selectAll("line.".concat($FOCUS.xgridFocus, ", line.").concat($FOCUS.ygridFocus))
|
|
12938
13163
|
.style("visibility", "hidden");
|
|
12939
13164
|
(_a = $$.hideCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
12940
13165
|
}
|
|
@@ -12943,7 +13168,7 @@ var grid = {
|
|
|
12943
13168
|
var _a;
|
|
12944
13169
|
var $$ = this;
|
|
12945
13170
|
var _b = $$.state, inputType = _b.inputType, width = _b.width, height = _b.height, resizing = _b.resizing, grid = $$.$el.grid;
|
|
12946
|
-
var xgridFocus = grid.main.select("line.".concat(
|
|
13171
|
+
var xgridFocus = grid.main.select("line.".concat($FOCUS.xgridFocus));
|
|
12947
13172
|
if (inputType === "touch") {
|
|
12948
13173
|
if (xgridFocus.empty()) {
|
|
12949
13174
|
resizing && ((_a = $$.showCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$));
|
|
@@ -12966,7 +13191,7 @@ var grid = {
|
|
|
12966
13191
|
},
|
|
12967
13192
|
generateGridData: function (type, scale) {
|
|
12968
13193
|
var $$ = this;
|
|
12969
|
-
var tickNum = $$.$el.main.select(".".concat(
|
|
13194
|
+
var tickNum = $$.$el.main.select(".".concat($AXIS.axisX))
|
|
12970
13195
|
.selectAll(".tick")
|
|
12971
13196
|
.size();
|
|
12972
13197
|
var gridData = [];
|
|
@@ -13001,8 +13226,8 @@ var grid = {
|
|
|
13001
13226
|
var config = $$.config, $T = $$.$T;
|
|
13002
13227
|
var toRemove = $$.getGridFilterToRemove(params);
|
|
13003
13228
|
var toShow = function (line) { return !toRemove(line); };
|
|
13004
|
-
var classLines = forX ?
|
|
13005
|
-
var classLine = forX ?
|
|
13229
|
+
var classLines = forX ? $GRID.xgridLines : $GRID.ygridLines;
|
|
13230
|
+
var classLine = forX ? $GRID.xgridLine : $GRID.ygridLine;
|
|
13006
13231
|
$T($$.$el.main.select(".".concat(classLines))
|
|
13007
13232
|
.selectAll(".".concat(classLine))
|
|
13008
13233
|
.filter(toRemove))
|
|
@@ -13024,7 +13249,7 @@ var region = {
|
|
|
13024
13249
|
$el.region.main = $el.main
|
|
13025
13250
|
.insert("g", ":first-child")
|
|
13026
13251
|
.attr("clip-path", $$.state.clip.path)
|
|
13027
|
-
.attr("class",
|
|
13252
|
+
.attr("class", $REGION.regions);
|
|
13028
13253
|
},
|
|
13029
13254
|
updateRegion: function () {
|
|
13030
13255
|
var $$ = this;
|
|
@@ -13036,7 +13261,7 @@ var region = {
|
|
|
13036
13261
|
region.main.style("visibility", $$.hasArcType() ? "hidden" : null);
|
|
13037
13262
|
// select <g> element
|
|
13038
13263
|
var list = region.main
|
|
13039
|
-
.selectAll(".".concat(
|
|
13264
|
+
.selectAll(".".concat($REGION.region))
|
|
13040
13265
|
.data(config.regions);
|
|
13041
13266
|
$T(list.exit())
|
|
13042
13267
|
.style("opacity", "0")
|
|
@@ -13536,15 +13761,16 @@ var x = {
|
|
|
13536
13761
|
*/
|
|
13537
13762
|
axis_x_tick_format: undefined,
|
|
13538
13763
|
/**
|
|
13539
|
-
* Setting for culling ticks
|
|
13540
|
-
*
|
|
13541
|
-
*
|
|
13764
|
+
* Setting for culling ticks.
|
|
13765
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
13766
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
13767
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
13768
|
+
* The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
|
|
13542
13769
|
* @name axis․x․tick․culling
|
|
13543
13770
|
* @memberof Options
|
|
13544
13771
|
* @type {boolean}
|
|
13545
13772
|
* @default
|
|
13546
|
-
*
|
|
13547
|
-
* - false for category axis
|
|
13773
|
+
* `true` for indexed axis and timeseries axis, `false` for category axis
|
|
13548
13774
|
* @example
|
|
13549
13775
|
* axis: {
|
|
13550
13776
|
* x: {
|
|
@@ -13573,6 +13799,24 @@ var x = {
|
|
|
13573
13799
|
* }
|
|
13574
13800
|
*/
|
|
13575
13801
|
axis_x_tick_culling_max: 10,
|
|
13802
|
+
/**
|
|
13803
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
13804
|
+
* @name axis․x․tick․culling․lines
|
|
13805
|
+
* @memberof Options
|
|
13806
|
+
* @type {boolean}
|
|
13807
|
+
* @default true
|
|
13808
|
+
* @example
|
|
13809
|
+
* axis: {
|
|
13810
|
+
* x: {
|
|
13811
|
+
* tick: {
|
|
13812
|
+
* culling: {
|
|
13813
|
+
* lines: false,
|
|
13814
|
+
* }
|
|
13815
|
+
* }
|
|
13816
|
+
* }
|
|
13817
|
+
* }
|
|
13818
|
+
*/
|
|
13819
|
+
axis_x_tick_culling_lines: true,
|
|
13576
13820
|
/**
|
|
13577
13821
|
* The number of x axis ticks to show.<br><br>
|
|
13578
13822
|
* This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will have rough second value).
|
|
@@ -13649,8 +13893,8 @@ var x = {
|
|
|
13649
13893
|
axis_x_tick_text_position: { x: 0, y: 0 },
|
|
13650
13894
|
/**
|
|
13651
13895
|
* Fit x axis ticks.
|
|
13652
|
-
* - **true**: ticks will be
|
|
13653
|
-
* - **false**: ticks will be
|
|
13896
|
+
* - **true**: ticks will be shown according to x value of the data points.
|
|
13897
|
+
* - **false**: ticks will be shown as to have same intervals.
|
|
13654
13898
|
* @name axis․x․tick․fit
|
|
13655
13899
|
* @memberof Options
|
|
13656
13900
|
* @type {boolean}
|
|
@@ -14214,9 +14458,11 @@ var y = {
|
|
|
14214
14458
|
*/
|
|
14215
14459
|
axis_y_tick_format: undefined,
|
|
14216
14460
|
/**
|
|
14217
|
-
* Setting for culling ticks
|
|
14218
|
-
*
|
|
14219
|
-
*
|
|
14461
|
+
* Setting for culling ticks.
|
|
14462
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
14463
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
14464
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
14465
|
+
* The number of ticks to be shown can be chaned by `axis.y.tick.culling.max`.
|
|
14220
14466
|
* @name axis․y․tick․culling
|
|
14221
14467
|
* @memberof Options
|
|
14222
14468
|
* @type {boolean}
|
|
@@ -14249,6 +14495,24 @@ var y = {
|
|
|
14249
14495
|
* }
|
|
14250
14496
|
*/
|
|
14251
14497
|
axis_y_tick_culling_max: 5,
|
|
14498
|
+
/**
|
|
14499
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
14500
|
+
* @name axis․y․tick․culling․lines
|
|
14501
|
+
* @memberof Options
|
|
14502
|
+
* @type {boolean}
|
|
14503
|
+
* @default true
|
|
14504
|
+
* @example
|
|
14505
|
+
* axis: {
|
|
14506
|
+
* y: {
|
|
14507
|
+
* tick: {
|
|
14508
|
+
* culling: {
|
|
14509
|
+
* lines: false,
|
|
14510
|
+
* }
|
|
14511
|
+
* }
|
|
14512
|
+
* }
|
|
14513
|
+
* }
|
|
14514
|
+
*/
|
|
14515
|
+
axis_y_tick_culling_lines: true,
|
|
14252
14516
|
/**
|
|
14253
14517
|
* Show y axis outer tick.
|
|
14254
14518
|
* @name axis․y․tick․outer
|
|
@@ -14668,9 +14932,11 @@ var y2 = {
|
|
|
14668
14932
|
*/
|
|
14669
14933
|
axis_y2_tick_format: undefined,
|
|
14670
14934
|
/**
|
|
14671
|
-
* Setting for culling ticks
|
|
14672
|
-
*
|
|
14673
|
-
*
|
|
14935
|
+
* Setting for culling ticks.
|
|
14936
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
14937
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
14938
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
14939
|
+
* The number of ticks to be shown can be chaned by `axis.y2.tick.culling.max`.
|
|
14674
14940
|
* @name axis․y2․tick․culling
|
|
14675
14941
|
* @memberof Options
|
|
14676
14942
|
* @type {boolean}
|
|
@@ -14703,6 +14969,24 @@ var y2 = {
|
|
|
14703
14969
|
* }
|
|
14704
14970
|
*/
|
|
14705
14971
|
axis_y2_tick_culling_max: 5,
|
|
14972
|
+
/**
|
|
14973
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
14974
|
+
* @name axis․y2․tick․culling․lines
|
|
14975
|
+
* @memberof Options
|
|
14976
|
+
* @type {boolean}
|
|
14977
|
+
* @default true
|
|
14978
|
+
* @example
|
|
14979
|
+
* axis: {
|
|
14980
|
+
* y2: {
|
|
14981
|
+
* tick: {
|
|
14982
|
+
* culling: {
|
|
14983
|
+
* lines: false,
|
|
14984
|
+
* }
|
|
14985
|
+
* }
|
|
14986
|
+
* }
|
|
14987
|
+
* }
|
|
14988
|
+
*/
|
|
14989
|
+
axis_y2_tick_culling_lines: true,
|
|
14706
14990
|
/**
|
|
14707
14991
|
* Show or hide y2 axis outer tick.
|
|
14708
14992
|
* @name axis․y2․tick․outer
|
|
@@ -15327,14 +15611,14 @@ var shapeArc = {
|
|
|
15327
15611
|
var interval_1 = setInterval(function () {
|
|
15328
15612
|
if (!transiting) {
|
|
15329
15613
|
clearInterval(interval_1);
|
|
15330
|
-
$el.legend.selectAll(".".concat(
|
|
15614
|
+
$el.legend.selectAll(".".concat($FOCUS.legendItemFocused)).size() > 0 &&
|
|
15331
15615
|
$$.expandArc(targetIds);
|
|
15332
15616
|
}
|
|
15333
15617
|
}, 10);
|
|
15334
15618
|
return;
|
|
15335
15619
|
}
|
|
15336
15620
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
15337
|
-
$el.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(
|
|
15621
|
+
$el.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat($ARC.chartArc)))
|
|
15338
15622
|
.each(function (d) {
|
|
15339
15623
|
if (!$$.shouldExpand(d.data.id)) {
|
|
15340
15624
|
return;
|
|
@@ -15357,12 +15641,12 @@ var shapeArc = {
|
|
|
15357
15641
|
return;
|
|
15358
15642
|
}
|
|
15359
15643
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
15360
|
-
svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(
|
|
15644
|
+
svg.selectAll($$.selectorTargets(newTargetIds, ".".concat($ARC.chartArc)))
|
|
15361
15645
|
.selectAll("path")
|
|
15362
15646
|
.transition()
|
|
15363
15647
|
.duration(function (d) { return $$.getExpandConfig(d.data.id, "duration"); })
|
|
15364
15648
|
.attr("d", $$.svgArc);
|
|
15365
|
-
svg.selectAll("".concat(
|
|
15649
|
+
svg.selectAll("".concat($ARC.arc))
|
|
15366
15650
|
.style("opacity", null);
|
|
15367
15651
|
},
|
|
15368
15652
|
/**
|
|
@@ -15428,9 +15712,9 @@ var shapeArc = {
|
|
|
15428
15712
|
var classChartArc = $$.getChartClass("Arc");
|
|
15429
15713
|
var classArcs = $$.getClass("arcs", true);
|
|
15430
15714
|
var classFocus = $$.classFocus.bind($$);
|
|
15431
|
-
var chartArcs = $el.main.select(".".concat(
|
|
15715
|
+
var chartArcs = $el.main.select(".".concat($ARC.chartArcs));
|
|
15432
15716
|
var mainPieUpdate = chartArcs
|
|
15433
|
-
.selectAll(".".concat(
|
|
15717
|
+
.selectAll(".".concat($ARC.chartArc))
|
|
15434
15718
|
.data($$.pie(targets))
|
|
15435
15719
|
.attr("class", function (d) { return classChartArc(d) + classFocus(d.data); });
|
|
15436
15720
|
var mainPieEnter = mainPieUpdate.enter().append("g")
|
|
@@ -15443,16 +15727,16 @@ var shapeArc = {
|
|
|
15443
15727
|
.style("opacity", "0")
|
|
15444
15728
|
.style("text-anchor", "middle")
|
|
15445
15729
|
.style("pointer-events", "none");
|
|
15446
|
-
$el.text = chartArcs.selectAll(".".concat(
|
|
15730
|
+
$el.text = chartArcs.selectAll(".".concat($COMMON.target, " text"));
|
|
15447
15731
|
// MEMO: can not keep same color..., but not bad to update color in redraw
|
|
15448
15732
|
// mainPieUpdate.exit().remove();
|
|
15449
15733
|
},
|
|
15450
15734
|
initArc: function () {
|
|
15451
15735
|
var $$ = this;
|
|
15452
15736
|
var $el = $$.$el;
|
|
15453
|
-
$el.arcs = $el.main.select(".".concat(
|
|
15737
|
+
$el.arcs = $el.main.select(".".concat($COMMON.chart))
|
|
15454
15738
|
.append("g")
|
|
15455
|
-
.attr("class",
|
|
15739
|
+
.attr("class", $ARC.chartArcs)
|
|
15456
15740
|
.attr("transform", $$.getTranslate("arc"));
|
|
15457
15741
|
$$.setArcTitle();
|
|
15458
15742
|
},
|
|
@@ -15466,7 +15750,7 @@ var shapeArc = {
|
|
|
15466
15750
|
var hasGauge = $$.hasType("gauge");
|
|
15467
15751
|
if (title) {
|
|
15468
15752
|
var text = $$.$el.arcs.append("text")
|
|
15469
|
-
.attr("class",
|
|
15753
|
+
.attr("class", hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle)
|
|
15470
15754
|
.style("text-anchor", "middle");
|
|
15471
15755
|
hasGauge && text.attr("dy", "-0.3em");
|
|
15472
15756
|
setTextValue(text, title, hasGauge ? undefined : [-0.6, 1.35], true);
|
|
@@ -15477,8 +15761,8 @@ var shapeArc = {
|
|
|
15477
15761
|
var config = $$.config, state = $$.state, main = $$.$el.main;
|
|
15478
15762
|
var hasInteraction = config.interaction_enabled;
|
|
15479
15763
|
var isSelectable = hasInteraction && config.data_selection_isselectable;
|
|
15480
|
-
var mainArc = main.selectAll(".".concat(
|
|
15481
|
-
.selectAll(".".concat(
|
|
15764
|
+
var mainArc = main.selectAll(".".concat($ARC.arcs))
|
|
15765
|
+
.selectAll(".".concat($ARC.arc))
|
|
15482
15766
|
.data($$.arcData.bind($$));
|
|
15483
15767
|
mainArc.exit()
|
|
15484
15768
|
.transition()
|
|
@@ -15567,15 +15851,15 @@ var shapeArc = {
|
|
|
15567
15851
|
var isFullCircle = config.gauge_fullCircle;
|
|
15568
15852
|
var startAngle = $$.getStartAngle();
|
|
15569
15853
|
var endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
|
|
15570
|
-
var backgroundArc = $$.$el.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat(
|
|
15854
|
+
var backgroundArc = $$.$el.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat($ARC.chartArcsBackground));
|
|
15571
15855
|
if (hasMultiArcGauge) {
|
|
15572
15856
|
var index_1 = 0;
|
|
15573
15857
|
backgroundArc = backgroundArc
|
|
15574
|
-
.selectAll("path.".concat(
|
|
15858
|
+
.selectAll("path.".concat($ARC.chartArcsBackground))
|
|
15575
15859
|
.data($$.data.targets);
|
|
15576
15860
|
backgroundArc.enter()
|
|
15577
15861
|
.append("path")
|
|
15578
|
-
.attr("class", function (d, i) { return "".concat(
|
|
15862
|
+
.attr("class", function (d, i) { return "".concat($ARC.chartArcsBackground, " ").concat($ARC.chartArcsBackground, "-").concat(i); })
|
|
15579
15863
|
.merge(backgroundArc)
|
|
15580
15864
|
.style("fill", (config.gauge_background) || null)
|
|
15581
15865
|
.attr("d", function (_a) {
|
|
@@ -15679,6 +15963,7 @@ var shapeArc = {
|
|
|
15679
15963
|
if (state.transiting) { // skip while transiting
|
|
15680
15964
|
return;
|
|
15681
15965
|
}
|
|
15966
|
+
state.event = event;
|
|
15682
15967
|
var eventArc = getEventArc_1(event);
|
|
15683
15968
|
var datum = eventArc.datum();
|
|
15684
15969
|
var updated = ((datum === null || datum === void 0 ? void 0 : datum.data) && datum.data.id) ? $$.updateAngle(datum) : null;
|
|
@@ -15698,10 +15983,10 @@ var shapeArc = {
|
|
|
15698
15983
|
var text;
|
|
15699
15984
|
// for gauge type, update text when has no title & multi data
|
|
15700
15985
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
15701
|
-
text = main.selectAll(".".concat(
|
|
15986
|
+
text = main.selectAll(".".concat($ARC.chartArc))
|
|
15702
15987
|
.select("text")
|
|
15703
15988
|
.style("opacity", "0")
|
|
15704
|
-
.attr("class", function (d) { return ($$.isGaugeType(d.data) ?
|
|
15989
|
+
.attr("class", function (d) { return ($$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null); })
|
|
15705
15990
|
.call($$.textForArcLabel.bind($$))
|
|
15706
15991
|
.attr("transform", $$.transformForArcLabel.bind($$))
|
|
15707
15992
|
.style("font-size", function (d) { return ($$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ?
|
|
@@ -15711,21 +15996,21 @@ var shapeArc = {
|
|
|
15711
15996
|
.style("opacity", function (d) { return ($$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0"); });
|
|
15712
15997
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
15713
15998
|
}
|
|
15714
|
-
main.select(".".concat(
|
|
15999
|
+
main.select(".".concat($ARC.chartArcsTitle))
|
|
15715
16000
|
.style("opacity", $$.hasType("donut") || hasGauge ? null : "0");
|
|
15716
16001
|
if (hasGauge) {
|
|
15717
16002
|
var isFullCircle = config.gauge_fullCircle;
|
|
15718
16003
|
isFullCircle && (text === null || text === void 0 ? void 0 : text.attr("dy", "".concat(hasMultiArcGauge ? 0 : Math.round(state.radius / 14))));
|
|
15719
16004
|
if (config.gauge_label_show) {
|
|
15720
|
-
arcs.select(".".concat(
|
|
16005
|
+
arcs.select(".".concat($GAUGE.chartArcsGaugeUnit))
|
|
15721
16006
|
.attr("dy", "".concat(isFullCircle ? 1.5 : 0.75, "em"))
|
|
15722
16007
|
.text(config.gauge_units);
|
|
15723
|
-
arcs.select(".".concat(
|
|
16008
|
+
arcs.select(".".concat($GAUGE.chartArcsGaugeMin))
|
|
15724
16009
|
.attr("dx", "".concat(-1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2))), "px"))
|
|
15725
16010
|
.attr("dy", "1.2em")
|
|
15726
16011
|
.text($$.textForGaugeMinMax(config.gauge_min, false));
|
|
15727
16012
|
// show max text when isn't fullCircle
|
|
15728
|
-
!isFullCircle && arcs.select(".".concat(
|
|
16013
|
+
!isFullCircle && arcs.select(".".concat($GAUGE.chartArcsGaugeMax))
|
|
15729
16014
|
.attr("dx", "".concat(state.innerRadius + ((state.radius - state.innerRadius) / 2), "px"))
|
|
15730
16015
|
.attr("dy", "1.2em")
|
|
15731
16016
|
.text($$.textForGaugeMinMax(config.gauge_max, true));
|
|
@@ -15743,7 +16028,7 @@ var shapeArea = {
|
|
|
15743
16028
|
var $$ = this;
|
|
15744
16029
|
var config = $$.config;
|
|
15745
16030
|
mainLine
|
|
15746
|
-
.insert("g", ".".concat(
|
|
16031
|
+
.insert("g", ".".concat(config.area_front ? $CIRCLE.circles : $LINE.lines))
|
|
15747
16032
|
.attr("class", $$.getClass("areas", true));
|
|
15748
16033
|
},
|
|
15749
16034
|
updateAreaGradient: function () {
|
|
@@ -15788,8 +16073,8 @@ var shapeArea = {
|
|
|
15788
16073
|
var config = $$.config, state = $$.state, $el = $$.$el, $T = $$.$T;
|
|
15789
16074
|
var $root = isSub ? $el.subchart : $el;
|
|
15790
16075
|
config.area_linearGradient && $$.updateAreaGradient();
|
|
15791
|
-
var area = $root.main.selectAll(".".concat(
|
|
15792
|
-
.selectAll(".".concat(
|
|
16076
|
+
var area = $root.main.selectAll(".".concat($AREA.areas))
|
|
16077
|
+
.selectAll(".".concat($AREA.area))
|
|
15793
16078
|
.data($$.lineData.bind($$));
|
|
15794
16079
|
$T(area.exit(), withTransition)
|
|
15795
16080
|
.style("opacity", "0")
|
|
@@ -15907,17 +16192,13 @@ var shapeArea = {
|
|
|
15907
16192
|
}
|
|
15908
16193
|
};
|
|
15909
16194
|
|
|
15910
|
-
/**
|
|
15911
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
15912
|
-
* billboard.js project is licensed under the MIT license
|
|
15913
|
-
*/
|
|
15914
16195
|
var shapeBar = {
|
|
15915
16196
|
initBar: function () {
|
|
15916
16197
|
var _a = this, $el = _a.$el, config = _a.config, clip = _a.state.clip;
|
|
15917
|
-
$el.bar = $el.main.select(".".concat(
|
|
16198
|
+
$el.bar = $el.main.select(".".concat($COMMON.chart))
|
|
15918
16199
|
// should positioned at the beginning of the shape node to not overlap others
|
|
15919
16200
|
.insert("g", ":first-child")
|
|
15920
|
-
.attr("class",
|
|
16201
|
+
.attr("class", $BAR.chartBars);
|
|
15921
16202
|
// set clip-path attribute when condition meet
|
|
15922
16203
|
// https://github.com/naver/billboard.js/issues/2421
|
|
15923
16204
|
if (config.clipPath === false && (config.bar_radius || config.bar_radius_ratio)) {
|
|
@@ -15934,11 +16215,11 @@ var shapeBar = {
|
|
|
15934
16215
|
if (!$el.bar) {
|
|
15935
16216
|
$$.initBar();
|
|
15936
16217
|
}
|
|
15937
|
-
var mainBarUpdate = $$.$el.main.select(".".concat(
|
|
15938
|
-
.selectAll(".".concat(
|
|
16218
|
+
var mainBarUpdate = $$.$el.main.select(".".concat($BAR.chartBars))
|
|
16219
|
+
.selectAll(".".concat($BAR.chartBar))
|
|
15939
16220
|
.data(
|
|
15940
16221
|
// remove
|
|
15941
|
-
targets.filter(function (v) { return
|
|
16222
|
+
targets.filter(function (v) { return v.values.some(function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)); }); }))
|
|
15942
16223
|
.attr("class", function (d) { return classChartBar(d) + classFocus(d); });
|
|
15943
16224
|
var mainBarEnter = mainBarUpdate.enter().append("g")
|
|
15944
16225
|
.attr("class", classChartBar)
|
|
@@ -15962,8 +16243,8 @@ var shapeBar = {
|
|
|
15962
16243
|
var $root = isSub ? $el.subchart : $el;
|
|
15963
16244
|
var classBar = $$.getClass("bar", true);
|
|
15964
16245
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
15965
|
-
var bar = $root.main.selectAll(".".concat(
|
|
15966
|
-
.selectAll(".".concat(
|
|
16246
|
+
var bar = $root.main.selectAll(".".concat($BAR.bars))
|
|
16247
|
+
.selectAll(".".concat($BAR.bar))
|
|
15967
16248
|
.data($$.labelishData.bind($$));
|
|
15968
16249
|
$T(bar.exit(), withTransition)
|
|
15969
16250
|
.style("opacity", "0")
|
|
@@ -15976,7 +16257,7 @@ var shapeBar = {
|
|
|
15976
16257
|
},
|
|
15977
16258
|
/**
|
|
15978
16259
|
* Redraw function
|
|
15979
|
-
* @param {Function} drawFn Retuned
|
|
16260
|
+
* @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
15980
16261
|
* @param {boolean} withTransition With or without transition
|
|
15981
16262
|
* @param {boolean} isSub Subchart draw
|
|
15982
16263
|
* @returns {Array}
|
|
@@ -15987,17 +16268,36 @@ var shapeBar = {
|
|
|
15987
16268
|
var bar = (isSub ? $$.$el.subchart : $$.$el).bar;
|
|
15988
16269
|
return [
|
|
15989
16270
|
$$.$T(bar, withTransition, getRandom())
|
|
15990
|
-
.attr("d", function (d) { return isNumber(d.value) && drawFn(d); })
|
|
16271
|
+
.attr("d", function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d); })
|
|
15991
16272
|
.style("fill", this.color)
|
|
15992
16273
|
.style("opacity", null)
|
|
15993
16274
|
];
|
|
15994
16275
|
},
|
|
16276
|
+
/**
|
|
16277
|
+
* Generate draw function
|
|
16278
|
+
* @param {object} barIndices data order within x axis.
|
|
16279
|
+
* barIndices ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
|
|
16280
|
+
*
|
|
16281
|
+
* When gropus given as:
|
|
16282
|
+
* groups: [
|
|
16283
|
+
* ["data1", "data2"],
|
|
16284
|
+
* ["data3", "data4"]
|
|
16285
|
+
* ],
|
|
16286
|
+
*
|
|
16287
|
+
* Will be rendered as:
|
|
16288
|
+
* data1 data3 data1 data3
|
|
16289
|
+
* data2 data4 data2 data4
|
|
16290
|
+
* -------------------------
|
|
16291
|
+
* 0 1
|
|
16292
|
+
* @param {boolean} isSub If is for subchart
|
|
16293
|
+
* @returns {Function}
|
|
16294
|
+
* @private
|
|
16295
|
+
*/
|
|
15995
16296
|
generateDrawBar: function (barIndices, isSub) {
|
|
15996
16297
|
var $$ = this;
|
|
15997
16298
|
var config = $$.config;
|
|
15998
16299
|
var getPoints = $$.generateGetBarPoints(barIndices, isSub);
|
|
15999
16300
|
var isRotated = config.axis_rotated;
|
|
16000
|
-
var isGrouped = config.data_groups.length;
|
|
16001
16301
|
var barRadius = config.bar_radius;
|
|
16002
16302
|
var barRadiusRatio = config.bar_radius_ratio;
|
|
16003
16303
|
// get the bar radius
|
|
@@ -16012,7 +16312,10 @@ var shapeBar = {
|
|
|
16012
16312
|
var isNegative = d.value < 0;
|
|
16013
16313
|
var pathRadius = ["", ""];
|
|
16014
16314
|
var radius = 0;
|
|
16015
|
-
|
|
16315
|
+
var isGrouped = $$.isGrouped(d.id);
|
|
16316
|
+
var hasRadius = d.value !== 0 && getRadius;
|
|
16317
|
+
var isRadiusData = hasRadius && isGrouped ? $$.isStackingRadiusData(d) : false;
|
|
16318
|
+
if (hasRadius && (!isGrouped || isRadiusData)) {
|
|
16016
16319
|
var index = isRotated ? indexY : indexX;
|
|
16017
16320
|
var barW = points[2][index] - points[0][index];
|
|
16018
16321
|
radius = getRadius(barW);
|
|
@@ -16029,6 +16332,34 @@ var shapeBar = {
|
|
|
16029
16332
|
return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
|
|
16030
16333
|
};
|
|
16031
16334
|
},
|
|
16335
|
+
/**
|
|
16336
|
+
* Determine if given stacking bar data is radius type
|
|
16337
|
+
* @param {Object} d Data row
|
|
16338
|
+
* @returns {boolean}
|
|
16339
|
+
*/
|
|
16340
|
+
isStackingRadiusData: function (d) {
|
|
16341
|
+
var $$ = this;
|
|
16342
|
+
var config = $$.config, data = $$.data;
|
|
16343
|
+
var id = d.id, index = d.index, value = d.value;
|
|
16344
|
+
// Find same grouped ids
|
|
16345
|
+
var keys = config.data_groups.find(function (v) { return v.indexOf(id) > -1; });
|
|
16346
|
+
// Get sorted list
|
|
16347
|
+
var sortedList = $$.orderTargets($$.filterTargetsToShow(data.targets.filter($$.isBarType, $$))).filter(function (v) { return keys.indexOf(v.id) > -1; });
|
|
16348
|
+
// Get sorted Ids. Filter positive or negative values Ids from given value
|
|
16349
|
+
var sortedIds = sortedList
|
|
16350
|
+
.map(function (v) { return v.values.filter(function (v2) { return v2.index === index && (value > 0 ? v2.value > 0 : v2.value < 0); })[0]; })
|
|
16351
|
+
.filter(Boolean)
|
|
16352
|
+
.map(function (v) { return v.id; });
|
|
16353
|
+
// If the given id stays in the last position, then radius should be applied.
|
|
16354
|
+
return value !== 0 && (sortedIds.indexOf(id) === sortedIds.length - 1);
|
|
16355
|
+
},
|
|
16356
|
+
/**
|
|
16357
|
+
* Generate bar coordinate points data
|
|
16358
|
+
* @param {object} barIndices Data order within x axis.
|
|
16359
|
+
* @param {boolean} isSub If is for subchart
|
|
16360
|
+
* @returns {Array} Array of coordinate points
|
|
16361
|
+
* @private
|
|
16362
|
+
*/
|
|
16032
16363
|
generateGetBarPoints: function (barIndices, isSub) {
|
|
16033
16364
|
var $$ = this;
|
|
16034
16365
|
var config = $$.config;
|
|
@@ -16049,7 +16380,9 @@ var shapeBar = {
|
|
|
16049
16380
|
if (config.axis_rotated && ((d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY))) {
|
|
16050
16381
|
posY = y0;
|
|
16051
16382
|
}
|
|
16052
|
-
|
|
16383
|
+
if (!$$.isBarRangeType(d)) {
|
|
16384
|
+
posY -= (y0 - offset);
|
|
16385
|
+
}
|
|
16053
16386
|
var startPosX = posX + width;
|
|
16054
16387
|
// 4 points that make a bar
|
|
16055
16388
|
return [
|
|
@@ -16059,34 +16392,16 @@ var shapeBar = {
|
|
|
16059
16392
|
[startPosX, offset]
|
|
16060
16393
|
];
|
|
16061
16394
|
};
|
|
16062
|
-
},
|
|
16063
|
-
isWithinBar: function (that) {
|
|
16064
|
-
var mouse = getPointer(this.state.event, that);
|
|
16065
|
-
var list = getRectSegList(that);
|
|
16066
|
-
var seg0 = list[0], seg1 = list[1];
|
|
16067
|
-
var x = Math.min(seg0.x, seg1.x);
|
|
16068
|
-
var y = Math.min(seg0.y, seg1.y);
|
|
16069
|
-
var offset = this.config.bar_sensitivity;
|
|
16070
|
-
var _a = that.getBBox(), width = _a.width, height = _a.height;
|
|
16071
|
-
var sx = x - offset;
|
|
16072
|
-
var ex = x + width + offset;
|
|
16073
|
-
var sy = y + height + offset;
|
|
16074
|
-
var ey = y - offset;
|
|
16075
|
-
var isWithin = sx < mouse[0] &&
|
|
16076
|
-
mouse[0] < ex &&
|
|
16077
|
-
ey < mouse[1] &&
|
|
16078
|
-
mouse[1] < sy;
|
|
16079
|
-
return isWithin;
|
|
16080
16395
|
}
|
|
16081
16396
|
};
|
|
16082
16397
|
|
|
16083
16398
|
var shapeCandlestick = {
|
|
16084
16399
|
initCandlestick: function () {
|
|
16085
16400
|
var $el = this.$el;
|
|
16086
|
-
$el.candlestick = $el.main.select(".".concat(
|
|
16401
|
+
$el.candlestick = $el.main.select(".".concat($COMMON.chart))
|
|
16087
16402
|
// should positioned at the beginning of the shape node to not overlap others
|
|
16088
16403
|
.append("g")
|
|
16089
|
-
.attr("class",
|
|
16404
|
+
.attr("class", $CANDLESTICK.chartCandlesticks);
|
|
16090
16405
|
},
|
|
16091
16406
|
/**
|
|
16092
16407
|
* Update targets by its data
|
|
@@ -16102,8 +16417,8 @@ var shapeCandlestick = {
|
|
|
16102
16417
|
if (!$el.candlestick) {
|
|
16103
16418
|
$$.initCandlestick();
|
|
16104
16419
|
}
|
|
16105
|
-
var mainUpdate = $$.$el.main.select(".".concat(
|
|
16106
|
-
.selectAll(".".concat(
|
|
16420
|
+
var mainUpdate = $$.$el.main.select(".".concat($CANDLESTICK.chartCandlesticks))
|
|
16421
|
+
.selectAll(".".concat($CANDLESTICK.chartCandlestick))
|
|
16107
16422
|
.data(targets)
|
|
16108
16423
|
.attr("class", function (d) { return classChart(d) + classFocus(d); });
|
|
16109
16424
|
mainUpdate.enter().append("g")
|
|
@@ -16123,8 +16438,8 @@ var shapeCandlestick = {
|
|
|
16123
16438
|
var $root = isSub ? $el.subchart : $el;
|
|
16124
16439
|
var classSetter = $$.getClass("candlestick", true);
|
|
16125
16440
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
16126
|
-
var candlestick = $root.main.selectAll(".".concat(
|
|
16127
|
-
.selectAll(".".concat(
|
|
16441
|
+
var candlestick = $root.main.selectAll(".".concat($CANDLESTICK.chartCandlestick))
|
|
16442
|
+
.selectAll(".".concat($CANDLESTICK.candlestick))
|
|
16128
16443
|
.data($$.labelishData.bind($$));
|
|
16129
16444
|
$T(candlestick.exit(), withTransition)
|
|
16130
16445
|
.style("opacity", "0")
|
|
@@ -16162,7 +16477,7 @@ var shapeCandlestick = {
|
|
|
16162
16477
|
var indexX = +isRotated;
|
|
16163
16478
|
var indexY = +!indexX;
|
|
16164
16479
|
if (g.classed) {
|
|
16165
|
-
g.classed(
|
|
16480
|
+
g.classed($CANDLESTICK[isUp ? "valueUp" : "valueDown"], true);
|
|
16166
16481
|
}
|
|
16167
16482
|
var path = isRotated ?
|
|
16168
16483
|
"H".concat(points[1][1], " V").concat(points[1][0], " H").concat(points[0][1]) :
|
|
@@ -16312,12 +16627,12 @@ var shapeGauge = {
|
|
|
16312
16627
|
if ($$.hasType("gauge")) {
|
|
16313
16628
|
var hasMulti = $$.hasMultiArcGauge();
|
|
16314
16629
|
arcs.append(hasMulti ? "g" : "path")
|
|
16315
|
-
.attr("class",
|
|
16630
|
+
.attr("class", $ARC.chartArcsBackground)
|
|
16316
16631
|
.style("fill", (!hasMulti && config.gauge_background) || null);
|
|
16317
|
-
config.gauge_units && appendText(
|
|
16632
|
+
config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit);
|
|
16318
16633
|
if (config.gauge_label_show) {
|
|
16319
|
-
appendText(
|
|
16320
|
-
!config.gauge_fullCircle && appendText(
|
|
16634
|
+
appendText($GAUGE.chartArcsGaugeMin);
|
|
16635
|
+
!config.gauge_fullCircle && appendText($GAUGE.chartArcsGaugeMax);
|
|
16321
16636
|
}
|
|
16322
16637
|
}
|
|
16323
16638
|
},
|
|
@@ -16337,12 +16652,12 @@ var shapeGauge = {
|
|
|
16337
16652
|
var $$ = this;
|
|
16338
16653
|
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
16339
16654
|
var hiddenTargetIds = $$.state.hiddenTargetIds;
|
|
16340
|
-
var arcLabelLines = $el.main.selectAll(".".concat(
|
|
16341
|
-
.selectAll(".".concat(
|
|
16655
|
+
var arcLabelLines = $el.main.selectAll(".".concat($ARC.arcs))
|
|
16656
|
+
.selectAll(".".concat($ARC.arcLabelLine))
|
|
16342
16657
|
.data($$.arcData.bind($$));
|
|
16343
16658
|
var mainArcLabelLine = arcLabelLines.enter()
|
|
16344
16659
|
.append("rect")
|
|
16345
|
-
.attr("class", function (d) { return "".concat(
|
|
16660
|
+
.attr("class", function (d) { return "".concat($ARC.arcLabelLine, " ").concat($COMMON.target, " ").concat($COMMON.target, "-").concat(d.data.id); })
|
|
16346
16661
|
.merge(arcLabelLines);
|
|
16347
16662
|
mainArcLabelLine
|
|
16348
16663
|
.style("fill", function (d) { return ($$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data)); })
|
|
@@ -16463,8 +16778,8 @@ var shapeBubble = {
|
|
|
16463
16778
|
var shapeLine = {
|
|
16464
16779
|
initLine: function () {
|
|
16465
16780
|
var $el = this.$el;
|
|
16466
|
-
$el.line = $el.main.select(".".concat(
|
|
16467
|
-
.attr("class",
|
|
16781
|
+
$el.line = $el.main.select(".".concat($COMMON.chart)).append("g")
|
|
16782
|
+
.attr("class", $LINE.chartLines);
|
|
16468
16783
|
},
|
|
16469
16784
|
updateTargetsForLine: function (t) {
|
|
16470
16785
|
var $$ = this;
|
|
@@ -16476,8 +16791,8 @@ var shapeLine = {
|
|
|
16476
16791
|
$$.initLine();
|
|
16477
16792
|
}
|
|
16478
16793
|
var targets = t.filter(function (d) { return !($$.isScatterType(d) || $$.isBubbleType(d)); });
|
|
16479
|
-
var mainLineUpdate = main.select(".".concat(
|
|
16480
|
-
.selectAll(".".concat(
|
|
16794
|
+
var mainLineUpdate = main.select(".".concat($LINE.chartLines))
|
|
16795
|
+
.selectAll(".".concat($LINE.chartLine))
|
|
16481
16796
|
.data(targets)
|
|
16482
16797
|
.attr("class", function (d) { return classChartLine(d) + classFocus(d); });
|
|
16483
16798
|
var mainLineEnter = mainLineUpdate.enter().append("g")
|
|
@@ -16505,8 +16820,8 @@ var shapeLine = {
|
|
|
16505
16820
|
var extraLineClasses = $$.format.extraLineClasses, $el = $$.$el, $T = $$.$T;
|
|
16506
16821
|
var $root = isSub ? $el.subchart : $el;
|
|
16507
16822
|
var line = $root.main
|
|
16508
|
-
.selectAll(".".concat(
|
|
16509
|
-
.selectAll(".".concat(
|
|
16823
|
+
.selectAll(".".concat($LINE.lines))
|
|
16824
|
+
.selectAll(".".concat($LINE.line))
|
|
16510
16825
|
.data($$.lineData.bind($$));
|
|
16511
16826
|
$T(line.exit(), withTransition)
|
|
16512
16827
|
.style("opacity", "0")
|
|
@@ -16751,10 +17066,10 @@ var shapePoint = {
|
|
|
16751
17066
|
var $$ = this;
|
|
16752
17067
|
var main = $$.$el.main;
|
|
16753
17068
|
$$.point = $$.generatePoint();
|
|
16754
|
-
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(".".concat(
|
|
16755
|
-
main.select(".".concat(
|
|
17069
|
+
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(".".concat($CIRCLE.chartCircles)).empty()) {
|
|
17070
|
+
main.select(".".concat($COMMON.chart))
|
|
16756
17071
|
.append("g")
|
|
16757
|
-
.attr("class",
|
|
17072
|
+
.attr("class", $CIRCLE.chartCircles);
|
|
16758
17073
|
}
|
|
16759
17074
|
},
|
|
16760
17075
|
updateTargetForCircle: function (targetsValue, enterNodeValue) {
|
|
@@ -16774,9 +17089,9 @@ var shapePoint = {
|
|
|
16774
17089
|
if (!targets) {
|
|
16775
17090
|
targets = (data.targets)
|
|
16776
17091
|
.filter(function (d) { return _this.isScatterType(d) || _this.isBubbleType(d); });
|
|
16777
|
-
var mainCircle = $el.main.select(".".concat(
|
|
17092
|
+
var mainCircle = $el.main.select(".".concat($CIRCLE.chartCircles))
|
|
16778
17093
|
.style("pointer-events", "none")
|
|
16779
|
-
.selectAll(".".concat(
|
|
17094
|
+
.selectAll(".".concat($CIRCLE.circles))
|
|
16780
17095
|
.data(targets)
|
|
16781
17096
|
.attr("class", classCircles);
|
|
16782
17097
|
mainCircle.exit().remove();
|
|
@@ -16784,14 +17099,14 @@ var shapePoint = {
|
|
|
16784
17099
|
}
|
|
16785
17100
|
// Circles for each data point on lines
|
|
16786
17101
|
selectionEnabled && enterNode.append("g")
|
|
16787
|
-
.attr("class", function (d) { return $$.generateClass(
|
|
17102
|
+
.attr("class", function (d) { return $$.generateClass($SELECT.selectedCircles, d.id); });
|
|
16788
17103
|
enterNode.append("g")
|
|
16789
17104
|
.attr("class", classCircles)
|
|
16790
17105
|
.style("cursor", function (d) { return (isFunction(isSelectable) && isSelectable(d) ? "pointer" : null); });
|
|
16791
17106
|
// Update date for selected circles
|
|
16792
17107
|
selectionEnabled && targets.forEach(function (t) {
|
|
16793
|
-
$el.main.selectAll(".".concat(
|
|
16794
|
-
.selectAll("".concat(
|
|
17108
|
+
$el.main.selectAll(".".concat($SELECT.selectedCircles).concat($$.getTargetSelectorSuffix(t.id)))
|
|
17109
|
+
.selectAll("".concat($SELECT.selectedCircle))
|
|
16795
17110
|
.each(function (d) {
|
|
16796
17111
|
d.value = t.values[d.index].value;
|
|
16797
17112
|
});
|
|
@@ -16804,8 +17119,8 @@ var shapePoint = {
|
|
|
16804
17119
|
var focusOnly = config.point_focus_only;
|
|
16805
17120
|
var $root = isSub ? $el.subchart : $el;
|
|
16806
17121
|
if (config.point_show && !state.toggling) {
|
|
16807
|
-
var circles = $root.main.selectAll(".".concat(
|
|
16808
|
-
.selectAll(".".concat(
|
|
17122
|
+
var circles = $root.main.selectAll(".".concat($CIRCLE.circles))
|
|
17123
|
+
.selectAll(".".concat($CIRCLE.circle))
|
|
16809
17124
|
.data(function (d) { return (($$.isLineType(d) && $$.shouldDrawPointsForLine(d)) ||
|
|
16810
17125
|
$$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ?
|
|
16811
17126
|
(focusOnly ? [d.values[0]] : d.values) : []); });
|
|
@@ -16813,7 +17128,7 @@ var shapePoint = {
|
|
|
16813
17128
|
circles.enter()
|
|
16814
17129
|
.filter(Boolean)
|
|
16815
17130
|
.append($$.point("create", this, $$.pointR.bind($$), $$.color));
|
|
16816
|
-
$root.circle = $root.main.selectAll(".".concat(
|
|
17131
|
+
$root.circle = $root.main.selectAll(".".concat($CIRCLE.circles, " .").concat($CIRCLE.circle))
|
|
16817
17132
|
.style("stroke", $$.color)
|
|
16818
17133
|
.style("opacity", $$.initialOpacityForCircle.bind($$));
|
|
16819
17134
|
}
|
|
@@ -16823,7 +17138,7 @@ var shapePoint = {
|
|
|
16823
17138
|
var $$ = this;
|
|
16824
17139
|
var rendered = $$.state.rendered, $el = $$.$el, $T = $$.$T;
|
|
16825
17140
|
var $root = isSub ? $el.subchart : $el;
|
|
16826
|
-
var selectedCircles = $root.main.selectAll(".".concat(
|
|
17141
|
+
var selectedCircles = $root.main.selectAll(".".concat($SELECT.selectedCircle));
|
|
16827
17142
|
if (!$$.config.point_show) {
|
|
16828
17143
|
return [];
|
|
16829
17144
|
}
|
|
@@ -16912,7 +17227,7 @@ var shapePoint = {
|
|
|
16912
17227
|
var $$ = this;
|
|
16913
17228
|
var r = $$.pointExpandedR.bind($$);
|
|
16914
17229
|
reset && $$.unexpandCircles();
|
|
16915
|
-
var circles = $$.getShapeByIndex("circle", i, id).classed(
|
|
17230
|
+
var circles = $$.getShapeByIndex("circle", i, id).classed($COMMON.EXPANDED, true);
|
|
16916
17231
|
var scale = r(circles) / $$.config.point_r;
|
|
16917
17232
|
var ratio = 1 - scale;
|
|
16918
17233
|
if ($$.isCirclePoint()) {
|
|
@@ -16939,9 +17254,9 @@ var shapePoint = {
|
|
|
16939
17254
|
var r = $$.pointR.bind($$);
|
|
16940
17255
|
var circles = $$.getShapeByIndex("circle", i)
|
|
16941
17256
|
.filter(function () {
|
|
16942
|
-
return select(this).classed(
|
|
17257
|
+
return select(this).classed($COMMON.EXPANDED);
|
|
16943
17258
|
})
|
|
16944
|
-
.classed(
|
|
17259
|
+
.classed($COMMON.EXPANDED, false);
|
|
16945
17260
|
circles.attr("r", r);
|
|
16946
17261
|
!$$.isCirclePoint() &&
|
|
16947
17262
|
circles.attr("transform", "scale(".concat(r(circles) / $$.config.point_r, ")"));
|
|
@@ -17027,8 +17342,8 @@ var shapePoint = {
|
|
|
17027
17342
|
pointClass = d === true ?
|
|
17028
17343
|
circle.each(function (d) {
|
|
17029
17344
|
var className = $$.getClass("circle", true)(d);
|
|
17030
|
-
if (this.getAttribute("class").indexOf(
|
|
17031
|
-
className += " ".concat(
|
|
17345
|
+
if (this.getAttribute("class").indexOf($COMMON.EXPANDED) > -1) {
|
|
17346
|
+
className += " ".concat($COMMON.EXPANDED);
|
|
17032
17347
|
}
|
|
17033
17348
|
this.setAttribute("class", className);
|
|
17034
17349
|
}) : $$.getClass("circle", true)(d);
|
|
@@ -17209,17 +17524,17 @@ var shapeRadar = {
|
|
|
17209
17524
|
var $$ = this;
|
|
17210
17525
|
var config = $$.config, current = $$.state.current, $el = $$.$el;
|
|
17211
17526
|
if ($$.hasType("radar")) {
|
|
17212
|
-
$el.radar = $el.main.select(".".concat(
|
|
17213
|
-
.attr("class",
|
|
17527
|
+
$el.radar = $el.main.select(".".concat($COMMON.chart)).append("g")
|
|
17528
|
+
.attr("class", $RADAR.chartRadars);
|
|
17214
17529
|
// level
|
|
17215
17530
|
$el.radar.levels = $el.radar.append("g")
|
|
17216
|
-
.attr("class",
|
|
17531
|
+
.attr("class", $RADAR.levels);
|
|
17217
17532
|
// axis
|
|
17218
17533
|
$el.radar.axes = $el.radar.append("g")
|
|
17219
|
-
.attr("class",
|
|
17534
|
+
.attr("class", $AXIS.axis);
|
|
17220
17535
|
// shapes
|
|
17221
17536
|
$el.radar.shapes = $el.radar.append("g")
|
|
17222
|
-
.attr("class",
|
|
17537
|
+
.attr("class", $SHAPE.shapes);
|
|
17223
17538
|
current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
|
|
17224
17539
|
}
|
|
17225
17540
|
},
|
|
@@ -17273,7 +17588,7 @@ var shapeRadar = {
|
|
|
17273
17588
|
// Adjust radar, circles and texts' position
|
|
17274
17589
|
if (translate) {
|
|
17275
17590
|
radar.attr("transform", translate);
|
|
17276
|
-
main.select(".".concat(
|
|
17591
|
+
main.select(".".concat($TEXT.chartTexts)).attr("transform", translate);
|
|
17277
17592
|
$$.generateRadarPoints();
|
|
17278
17593
|
$$.updateRadarLevel();
|
|
17279
17594
|
$$.updateRadarAxes();
|
|
@@ -17311,11 +17626,11 @@ var shapeRadar = {
|
|
|
17311
17626
|
return pos.join(" ");
|
|
17312
17627
|
});
|
|
17313
17628
|
var level = radarLevels
|
|
17314
|
-
.selectAll(".".concat(
|
|
17629
|
+
.selectAll(".".concat($RADAR.level))
|
|
17315
17630
|
.data(levelData);
|
|
17316
17631
|
level.exit().remove();
|
|
17317
17632
|
var levelEnter = level.enter().append("g")
|
|
17318
|
-
.attr("class", function (d, i) { return "".concat(
|
|
17633
|
+
.attr("class", function (d, i) { return "".concat($RADAR.level, " ").concat($RADAR.level, "-").concat(i); });
|
|
17319
17634
|
levelEnter.append("polygon")
|
|
17320
17635
|
.style("visibility", config.radar_level_show ? null : "hidden");
|
|
17321
17636
|
if (showText) {
|
|
@@ -17353,7 +17668,7 @@ var shapeRadar = {
|
|
|
17353
17668
|
.data(categories);
|
|
17354
17669
|
axis.exit().remove();
|
|
17355
17670
|
var axisEnter = axis.enter().append("g")
|
|
17356
|
-
.attr("class", function (d, i) { return "".concat(
|
|
17671
|
+
.attr("class", function (d, i) { return "".concat($AXIS.axis, "-").concat(i); });
|
|
17357
17672
|
config.radar_axis_line_show && axisEnter.append("line");
|
|
17358
17673
|
config.radar_axis_text_show && axisEnter.append("text");
|
|
17359
17674
|
axis = axisEnter.merge(axis);
|
|
@@ -17422,6 +17737,7 @@ var shapeRadar = {
|
|
|
17422
17737
|
return d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
17423
17738
|
};
|
|
17424
17739
|
var hide = function (event) {
|
|
17740
|
+
state.event = event;
|
|
17425
17741
|
var index = getIndex_1(event);
|
|
17426
17742
|
var noIndex = isUndefined(index);
|
|
17427
17743
|
if (isMouse_1 || noIndex) {
|
|
@@ -17672,10 +17988,10 @@ var optBar = {
|
|
|
17672
17988
|
* @memberof Options
|
|
17673
17989
|
* @type {object}
|
|
17674
17990
|
* @property {object} bar Bar object
|
|
17991
|
+
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
17675
17992
|
* @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
17676
17993
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
17677
17994
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
17678
|
-
* - **NOTE:** Works only for non-stacked bar
|
|
17679
17995
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
17680
17996
|
* @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
|
|
17681
17997
|
* @property {number} [bar.width] Change the width of bar chart.
|
|
@@ -17688,15 +18004,21 @@ var optBar = {
|
|
|
17688
18004
|
* @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
|
|
17689
18005
|
* @property {number} [bar.width.dataname.max] The maximum width value for ratio.
|
|
17690
18006
|
* @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
|
|
18007
|
+
* @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
|
|
17691
18008
|
* @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
|
|
17692
18009
|
* @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius)
|
|
17693
18010
|
* @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth)
|
|
17694
18011
|
* @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant)
|
|
17695
18012
|
* @example
|
|
17696
18013
|
* bar: {
|
|
18014
|
+
* // remove nullish data on bar indices postions
|
|
18015
|
+
* indices: {
|
|
18016
|
+
* removeNull: true
|
|
18017
|
+
* },
|
|
18018
|
+
*
|
|
17697
18019
|
* padding: 1,
|
|
17698
18020
|
*
|
|
17699
|
-
* //
|
|
18021
|
+
* // bar radius
|
|
17700
18022
|
* radius: 10,
|
|
17701
18023
|
* // or
|
|
17702
18024
|
* radius: {
|
|
@@ -17733,6 +18055,7 @@ var optBar = {
|
|
|
17733
18055
|
* }
|
|
17734
18056
|
*/
|
|
17735
18057
|
bar_label_threshold: 0,
|
|
18058
|
+
bar_indices_removeNull: false,
|
|
17736
18059
|
bar_padding: 0,
|
|
17737
18060
|
bar_radius: undefined,
|
|
17738
18061
|
bar_radius_ratio: undefined,
|
|
@@ -18440,10 +18763,10 @@ var apiSelection = {
|
|
|
18440
18763
|
selected: function (targetId) {
|
|
18441
18764
|
var $$ = this.internal;
|
|
18442
18765
|
var dataPoint = [];
|
|
18443
|
-
$$.$el.main.selectAll(".".concat(
|
|
18444
|
-
.selectAll(".".concat(
|
|
18766
|
+
$$.$el.main.selectAll(".".concat($SHAPE.shapes + $$.getTargetSelectorSuffix(targetId)))
|
|
18767
|
+
.selectAll(".".concat($SHAPE.shape))
|
|
18445
18768
|
.filter(function () {
|
|
18446
|
-
return select(this).classed(
|
|
18769
|
+
return select(this).classed($SELECT.SELECTED);
|
|
18447
18770
|
})
|
|
18448
18771
|
.each(function (d) { return dataPoint.push(d); });
|
|
18449
18772
|
return dataPoint;
|
|
@@ -18478,26 +18801,26 @@ var apiSelection = {
|
|
|
18478
18801
|
if (!config.data_selection_enabled) {
|
|
18479
18802
|
return;
|
|
18480
18803
|
}
|
|
18481
|
-
$el.main.selectAll(".".concat(
|
|
18482
|
-
.selectAll(".".concat(
|
|
18804
|
+
$el.main.selectAll(".".concat($SHAPE.shapes))
|
|
18805
|
+
.selectAll(".".concat($SHAPE.shape))
|
|
18483
18806
|
.each(function (d, i) {
|
|
18484
18807
|
var shape = select(this);
|
|
18485
18808
|
var id = d.data ? d.data.id : d.id;
|
|
18486
18809
|
var toggle = $$.getToggle(this, d).bind($$);
|
|
18487
18810
|
var isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0;
|
|
18488
18811
|
var isTargetIndex = !indices || indices.indexOf(i) >= 0;
|
|
18489
|
-
var isSelected = shape.classed(
|
|
18812
|
+
var isSelected = shape.classed($SELECT.SELECTED);
|
|
18490
18813
|
// line/area selection not supported yet
|
|
18491
|
-
if (shape.classed(
|
|
18814
|
+
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
18492
18815
|
return;
|
|
18493
18816
|
}
|
|
18494
18817
|
if (isTargetId && isTargetIndex) {
|
|
18495
18818
|
if (config.data_selection_isselectable.bind($$.api)(d) && !isSelected) {
|
|
18496
|
-
toggle(true, shape.classed(
|
|
18819
|
+
toggle(true, shape.classed($SELECT.SELECTED, true), d, i);
|
|
18497
18820
|
}
|
|
18498
18821
|
}
|
|
18499
18822
|
else if (isDefined(resetOther) && resetOther && isSelected) {
|
|
18500
|
-
toggle(false, shape.classed(
|
|
18823
|
+
toggle(false, shape.classed($SELECT.SELECTED, false), d, i);
|
|
18501
18824
|
}
|
|
18502
18825
|
});
|
|
18503
18826
|
},
|
|
@@ -18524,24 +18847,24 @@ var apiSelection = {
|
|
|
18524
18847
|
if (!config.data_selection_enabled) {
|
|
18525
18848
|
return;
|
|
18526
18849
|
}
|
|
18527
|
-
$el.main.selectAll(".".concat(
|
|
18528
|
-
.selectAll(".".concat(
|
|
18850
|
+
$el.main.selectAll(".".concat($SHAPE.shapes))
|
|
18851
|
+
.selectAll(".".concat($SHAPE.shape))
|
|
18529
18852
|
.each(function (d, i) {
|
|
18530
18853
|
var shape = select(this);
|
|
18531
18854
|
var id = d.data ? d.data.id : d.id;
|
|
18532
18855
|
var toggle = $$.getToggle(this, d).bind($$);
|
|
18533
18856
|
var isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0;
|
|
18534
18857
|
var isTargetIndex = !indices || indices.indexOf(i) >= 0;
|
|
18535
|
-
var isSelected = shape.classed(
|
|
18858
|
+
var isSelected = shape.classed($SELECT.SELECTED);
|
|
18536
18859
|
// line/area selection not supported yet
|
|
18537
|
-
if (shape.classed(
|
|
18860
|
+
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
18538
18861
|
return;
|
|
18539
18862
|
}
|
|
18540
18863
|
if (isTargetId &&
|
|
18541
18864
|
isTargetIndex &&
|
|
18542
18865
|
config.data_selection_isselectable.bind($$.api)(d) &&
|
|
18543
18866
|
isSelected) {
|
|
18544
|
-
toggle(false, shape.classed(
|
|
18867
|
+
toggle(false, shape.classed($SELECT.SELECTED, false), d, i);
|
|
18545
18868
|
}
|
|
18546
18869
|
});
|
|
18547
18870
|
}
|
|
@@ -18585,12 +18908,12 @@ var apiSubchart = {
|
|
|
18585
18908
|
$$.unbindZoomEvent();
|
|
18586
18909
|
config.subchart_show = !show;
|
|
18587
18910
|
!subchart.main && $$.initSubchart();
|
|
18588
|
-
var $target = subchart.main.selectAll(".".concat(
|
|
18911
|
+
var $target = subchart.main.selectAll(".".concat($COMMON.target));
|
|
18589
18912
|
// need to cover when new data has been loaded
|
|
18590
18913
|
if ($$.data.targets.length !== $target.size()) {
|
|
18591
18914
|
$$.updateSizes();
|
|
18592
18915
|
$$.updateTargetsForSubchart($$.data.targets);
|
|
18593
|
-
$target = subchart.main.selectAll(".".concat(
|
|
18916
|
+
$target = subchart.main.selectAll(".".concat($COMMON.target));
|
|
18594
18917
|
}
|
|
18595
18918
|
$target.style("opacity", null);
|
|
18596
18919
|
subchart.main.style("display", null);
|
|
@@ -18876,28 +19199,28 @@ var drag = {
|
|
|
18876
19199
|
var maxX = Math.max(sx, mx);
|
|
18877
19200
|
var minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my);
|
|
18878
19201
|
var maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
|
|
18879
|
-
main.select(".".concat(
|
|
19202
|
+
main.select(".".concat($DRAG.dragarea))
|
|
18880
19203
|
.attr("x", minX)
|
|
18881
19204
|
.attr("y", minY)
|
|
18882
19205
|
.attr("width", maxX - minX)
|
|
18883
19206
|
.attr("height", maxY - minY);
|
|
18884
19207
|
// TODO: binary search when multiple xs
|
|
18885
|
-
main.selectAll(".".concat(
|
|
18886
|
-
.selectAll(".".concat(
|
|
19208
|
+
main.selectAll(".".concat($SHAPE.shapes))
|
|
19209
|
+
.selectAll(".".concat($SHAPE.shape))
|
|
18887
19210
|
.filter(function (d) { return isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d); })
|
|
18888
19211
|
.each(function (d, i) {
|
|
18889
19212
|
var shape = select(this);
|
|
18890
|
-
var isSelected = shape.classed(
|
|
18891
|
-
var isIncluded = shape.classed(
|
|
19213
|
+
var isSelected = shape.classed($SELECT.SELECTED);
|
|
19214
|
+
var isIncluded = shape.classed($DRAG.INCLUDED);
|
|
18892
19215
|
var isWithin = false;
|
|
18893
19216
|
var toggle;
|
|
18894
|
-
if (shape.classed(
|
|
19217
|
+
if (shape.classed($CIRCLE.circle)) {
|
|
18895
19218
|
var x = +shape.attr("cx") * 1;
|
|
18896
19219
|
var y = +shape.attr("cy") * 1;
|
|
18897
19220
|
toggle = $$.togglePoint;
|
|
18898
19221
|
isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
|
18899
19222
|
}
|
|
18900
|
-
else if (shape.classed(
|
|
19223
|
+
else if (shape.classed($BAR.bar)) {
|
|
18901
19224
|
var _a = getPathBox(this), x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
18902
19225
|
toggle = $$.togglePath;
|
|
18903
19226
|
isWithin = !(maxX < x || x + width < minX) && !(maxY < y || y + height < minY);
|
|
@@ -18908,9 +19231,9 @@ var drag = {
|
|
|
18908
19231
|
}
|
|
18909
19232
|
// @ts-ignore
|
|
18910
19233
|
if (isWithin ^ isIncluded) {
|
|
18911
|
-
shape.classed(
|
|
19234
|
+
shape.classed($DRAG.INCLUDED, !isIncluded);
|
|
18912
19235
|
// TODO: included/unincluded callback here
|
|
18913
|
-
shape.classed(
|
|
19236
|
+
shape.classed($SELECT.SELECTED, !isSelected);
|
|
18914
19237
|
toggle.call($$, !isSelected, shape, d, i);
|
|
18915
19238
|
}
|
|
18916
19239
|
});
|
|
@@ -18928,9 +19251,9 @@ var drag = {
|
|
|
18928
19251
|
return;
|
|
18929
19252
|
}
|
|
18930
19253
|
state.dragStart = mouse;
|
|
18931
|
-
main.select(".".concat(
|
|
19254
|
+
main.select(".".concat($COMMON.chart))
|
|
18932
19255
|
.append("rect")
|
|
18933
|
-
.attr("class",
|
|
19256
|
+
.attr("class", $DRAG.dragarea)
|
|
18934
19257
|
.style("opacity", "0.1");
|
|
18935
19258
|
$$.setDragStatus(true);
|
|
18936
19259
|
},
|
|
@@ -18945,11 +19268,11 @@ var drag = {
|
|
|
18945
19268
|
if ($$.hasArcType() || !config.data_selection_enabled) { // do nothing if not selectable
|
|
18946
19269
|
return;
|
|
18947
19270
|
}
|
|
18948
|
-
$T(main.select(".".concat(
|
|
19271
|
+
$T(main.select(".".concat($DRAG.dragarea)))
|
|
18949
19272
|
.style("opacity", "0")
|
|
18950
19273
|
.remove();
|
|
18951
|
-
main.selectAll(".".concat(
|
|
18952
|
-
.classed(
|
|
19274
|
+
main.selectAll(".".concat($SHAPE.shape))
|
|
19275
|
+
.classed($DRAG.INCLUDED, false);
|
|
18953
19276
|
$$.setDragStatus(false);
|
|
18954
19277
|
}
|
|
18955
19278
|
};
|
|
@@ -18971,12 +19294,12 @@ var selection = _assign(_assign({}, drag), {
|
|
|
18971
19294
|
var r = $$.pointSelectR.bind($$);
|
|
18972
19295
|
callFn(config.data_onselected, $$.api, d, target.node());
|
|
18973
19296
|
// add selected-circle on low layer g
|
|
18974
|
-
$T(main.select(".".concat(
|
|
18975
|
-
.selectAll(".".concat(
|
|
19297
|
+
$T(main.select(".".concat($SELECT.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
19298
|
+
.selectAll(".".concat($SELECT.selectedCircle, "-").concat(i))
|
|
18976
19299
|
.data([d])
|
|
18977
19300
|
.enter()
|
|
18978
19301
|
.append("circle")
|
|
18979
|
-
.attr("class", function () { return $$.generateClass(
|
|
19302
|
+
.attr("class", function () { return $$.generateClass($SELECT.selectedCircle, i); })
|
|
18980
19303
|
.attr("cx", cx)
|
|
18981
19304
|
.attr("cy", cy)
|
|
18982
19305
|
.attr("stroke", $$.color)
|
|
@@ -18994,8 +19317,8 @@ var selection = _assign(_assign({}, drag), {
|
|
|
18994
19317
|
var config = $$.config, main = $$.$el.main, $T = $$.$T;
|
|
18995
19318
|
callFn(config.data_onunselected, $$.api, d, target.node());
|
|
18996
19319
|
// remove selected-circle from low layer g
|
|
18997
|
-
$T(main.select(".".concat(
|
|
18998
|
-
.selectAll(".".concat(
|
|
19320
|
+
$T(main.select(".".concat($SELECT.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
19321
|
+
.selectAll(".".concat($SELECT.selectedCircle, "-").concat(i)))
|
|
18999
19322
|
.attr("r", 0)
|
|
19000
19323
|
.remove();
|
|
19001
19324
|
},
|
|
@@ -19074,29 +19397,29 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19074
19397
|
toggleShape: function (that, d, i) {
|
|
19075
19398
|
var $$ = this;
|
|
19076
19399
|
var config = $$.config, main = $$.$el.main;
|
|
19077
|
-
var shape = select(that);
|
|
19078
|
-
var isSelected = shape.classed(CLASS.SELECTED);
|
|
19079
|
-
var toggle = $$.getToggle(that, d).bind($$);
|
|
19080
|
-
var toggledShape;
|
|
19081
19400
|
if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
|
19401
|
+
var shape = select(that);
|
|
19402
|
+
var isSelected = shape.classed($SELECT.SELECTED);
|
|
19403
|
+
var toggle_1 = $$.getToggle(that, d).bind($$);
|
|
19404
|
+
var toggledShape_1;
|
|
19082
19405
|
if (!config.data_selection_multiple) {
|
|
19083
|
-
var selector = ".".concat(
|
|
19406
|
+
var selector = ".".concat($SHAPE.shapes);
|
|
19084
19407
|
if (config.data_selection_grouped) {
|
|
19085
19408
|
selector += $$.getTargetSelectorSuffix(d.id);
|
|
19086
19409
|
}
|
|
19087
19410
|
main.selectAll(selector)
|
|
19088
|
-
.selectAll(".".concat(
|
|
19411
|
+
.selectAll(".".concat($SHAPE.shape))
|
|
19089
19412
|
.each(function (d, i) {
|
|
19090
19413
|
var shape = select(this);
|
|
19091
|
-
if (shape.classed(
|
|
19092
|
-
|
|
19093
|
-
|
|
19414
|
+
if (shape.classed($SELECT.SELECTED)) {
|
|
19415
|
+
toggledShape_1 = shape;
|
|
19416
|
+
toggle_1(false, shape.classed($SELECT.SELECTED, false), d, i);
|
|
19094
19417
|
}
|
|
19095
19418
|
});
|
|
19096
19419
|
}
|
|
19097
|
-
if (!
|
|
19098
|
-
shape.classed(
|
|
19099
|
-
|
|
19420
|
+
if (!toggledShape_1 || toggledShape_1.node() !== shape.node()) {
|
|
19421
|
+
shape.classed($SELECT.SELECTED, !isSelected);
|
|
19422
|
+
toggle_1(!isSelected, shape, d, i);
|
|
19100
19423
|
}
|
|
19101
19424
|
}
|
|
19102
19425
|
} });
|
|
@@ -19661,7 +19984,7 @@ var zoom = {
|
|
|
19661
19984
|
if (!zoomRect) {
|
|
19662
19985
|
zoomRect = $$.$el.main.append("rect")
|
|
19663
19986
|
.attr("clip-path", state.clip.path)
|
|
19664
|
-
.attr("class",
|
|
19987
|
+
.attr("class", $ZOOM.zoomBrush)
|
|
19665
19988
|
.attr("width", isRotated ? state.width : 0)
|
|
19666
19989
|
.attr("height", isRotated ? 0 : state.height);
|
|
19667
19990
|
}
|
|
@@ -19705,13 +20028,13 @@ var zoom = {
|
|
|
19705
20028
|
if (resetButton && config.zoom_type === "drag") {
|
|
19706
20029
|
if (!$el.zoomResetBtn) {
|
|
19707
20030
|
$el.zoomResetBtn = $$.$el.chart.append("div")
|
|
19708
|
-
.classed(
|
|
20031
|
+
.classed($COMMON.button, true)
|
|
19709
20032
|
.append("span")
|
|
19710
20033
|
.on("click", function () {
|
|
19711
20034
|
isFunction(resetButton.onclick) && resetButton.onclick.bind($$.api)(this);
|
|
19712
20035
|
$$.api.unzoom();
|
|
19713
20036
|
})
|
|
19714
|
-
.classed(
|
|
20037
|
+
.classed($ZOOM.buttonZoomReset, true)
|
|
19715
20038
|
.text(resetButton.text || "Reset Zoom");
|
|
19716
20039
|
}
|
|
19717
20040
|
else {
|
|
@@ -20042,7 +20365,7 @@ var zoomModule = function () {
|
|
|
20042
20365
|
var defaults = {};
|
|
20043
20366
|
/**
|
|
20044
20367
|
* @namespace bb
|
|
20045
|
-
* @version 3.
|
|
20368
|
+
* @version 3.3.1
|
|
20046
20369
|
*/
|
|
20047
20370
|
var bb = {
|
|
20048
20371
|
/**
|
|
@@ -20052,7 +20375,7 @@ var bb = {
|
|
|
20052
20375
|
* bb.version; // "1.0.0"
|
|
20053
20376
|
* @memberof bb
|
|
20054
20377
|
*/
|
|
20055
|
-
version: "3.
|
|
20378
|
+
version: "3.3.1",
|
|
20056
20379
|
/**
|
|
20057
20380
|
* Generate chart
|
|
20058
20381
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|