billboard.js 3.9.0-next.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +121 -30
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +121 -30
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist-esm/billboard.js +149 -57
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -3
- package/package.json +6 -6
- package/src/ChartInternal/ChartInternal.ts +9 -3
- package/src/ChartInternal/data/IData.ts +5 -0
- package/src/ChartInternal/data/data.ts +21 -8
- package/src/ChartInternal/internals/legend.ts +50 -34
- package/src/ChartInternal/shape/bar.ts +7 -3
- package/src/ChartInternal/shape/bubble.ts +0 -1
- package/src/ChartInternal/shape/point.ts +2 -0
- package/src/config/Options/common/legend.ts +37 -6
- package/src/config/Options/common/point.ts +30 -2
- package/src/config/Options/shape/bar.ts +7 -1
- package/types/options.d.ts +32 -2
- package/types/options.shape.d.ts +9 -4
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import {$BAR, $CANDLESTICK, $COMMON} from "../../config/classes";
|
|
6
6
|
import {KEY} from "../../module/Cache";
|
|
7
|
-
import type {IData, IDataRow} from "./IData";
|
|
7
|
+
import type {IData, IDataPoint, IDataRow} from "./IData";
|
|
8
8
|
import {
|
|
9
9
|
findIndex,
|
|
10
10
|
getUnique,
|
|
@@ -730,7 +730,7 @@ export default {
|
|
|
730
730
|
return sames;
|
|
731
731
|
},
|
|
732
732
|
|
|
733
|
-
findClosestFromTargets(targets, pos): IDataRow | undefined {
|
|
733
|
+
findClosestFromTargets(targets, pos: [number, number]): IDataRow | undefined {
|
|
734
734
|
const $$ = this;
|
|
735
735
|
const candidates = targets.map(target => $$.findClosest(target.values, pos)); // map to array of closest points of each target
|
|
736
736
|
|
|
@@ -738,11 +738,22 @@ export default {
|
|
|
738
738
|
return $$.findClosest(candidates, pos);
|
|
739
739
|
},
|
|
740
740
|
|
|
741
|
-
findClosest(values, pos): IDataRow | undefined {
|
|
741
|
+
findClosest(values, pos: [number, number]): IDataRow | undefined {
|
|
742
742
|
const $$ = this;
|
|
743
743
|
const {config, $el: {main}} = $$;
|
|
744
744
|
const data = values.filter(v => v && isValue(v.value));
|
|
745
|
-
|
|
745
|
+
const getSensitivity = (d: IDataPoint) => {
|
|
746
|
+
let sensitivity = config.point_sensitivity;
|
|
747
|
+
|
|
748
|
+
if (isFunction(sensitivity)) {
|
|
749
|
+
sensitivity = sensitivity.call($$.api, d);
|
|
750
|
+
} else if (sensitivity === "radius") {
|
|
751
|
+
sensitivity = d.r;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
return sensitivity;
|
|
755
|
+
};
|
|
756
|
+
let minDist;
|
|
746
757
|
let closest;
|
|
747
758
|
|
|
748
759
|
// find mouseovering bar/candlestick
|
|
@@ -762,9 +773,11 @@ export default {
|
|
|
762
773
|
// find closest point from non-bar/candlestick
|
|
763
774
|
data
|
|
764
775
|
.filter(v => !$$.isBarType(v.id) && !$$.isCandlestickType(v.id))
|
|
765
|
-
.forEach(v => {
|
|
776
|
+
.forEach((v: IDataPoint) => {
|
|
766
777
|
const d = $$.dist(v, pos);
|
|
767
778
|
|
|
779
|
+
minDist = getSensitivity(v);
|
|
780
|
+
|
|
768
781
|
if (d < minDist) {
|
|
769
782
|
minDist = d;
|
|
770
783
|
closest = v;
|
|
@@ -774,11 +787,11 @@ export default {
|
|
|
774
787
|
return closest;
|
|
775
788
|
},
|
|
776
789
|
|
|
777
|
-
dist(data, pos) {
|
|
790
|
+
dist(data: IDataPoint, pos: [number, number]) {
|
|
778
791
|
const $$ = this;
|
|
779
792
|
const {config: {axis_rotated: isRotated}, scale} = $$;
|
|
780
|
-
const xIndex = isRotated
|
|
781
|
-
const yIndex = isRotated
|
|
793
|
+
const xIndex = +isRotated; // true: 1, false: 0
|
|
794
|
+
const yIndex = +!isRotated; // true: 0, false: 1
|
|
782
795
|
const y = $$.circleY(data, data.index);
|
|
783
796
|
const x = (scale.zoom || scale.x)(data.x);
|
|
784
797
|
|
|
@@ -394,6 +394,7 @@ export default {
|
|
|
394
394
|
const isTouch = state.inputType === "touch";
|
|
395
395
|
const hasGauge = $$.hasType("gauge");
|
|
396
396
|
const useCssRule = config.boost_useCssRule;
|
|
397
|
+
const interaction = config.legend_item_interaction;
|
|
397
398
|
|
|
398
399
|
item
|
|
399
400
|
.attr("class", function(id) {
|
|
@@ -420,48 +421,63 @@ export default {
|
|
|
420
421
|
}
|
|
421
422
|
|
|
422
423
|
item
|
|
423
|
-
.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
424
|
+
.on(interaction.dblclick ? "dblclick" : "click", interaction || isFunction(config.legend_item_onclick) ?
|
|
425
|
+
function(event, id) {
|
|
426
|
+
if (!callFn(config.legend_item_onclick, api, id)) {
|
|
427
|
+
const {altKey, target, type} = event;
|
|
428
|
+
|
|
429
|
+
if (type === "dblclick" || altKey) {
|
|
430
|
+
// when focused legend is clicked(with altKey or double clicked), reset all hiding.
|
|
431
|
+
if (state.hiddenTargetIds.length &&
|
|
432
|
+
target.parentNode.getAttribute("class").indexOf($LEGEND.legendItemHidden) === -1
|
|
433
|
+
) {
|
|
434
|
+
api.show();
|
|
435
|
+
} else {
|
|
436
|
+
api.hide();
|
|
437
|
+
api.show(id);
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
api.toggle(id);
|
|
441
|
+
|
|
442
|
+
d3Select(this)
|
|
443
|
+
.classed($FOCUS.legendItemFocused, false);
|
|
444
|
+
}
|
|
434
445
|
}
|
|
435
|
-
}
|
|
436
446
|
|
|
437
|
-
|
|
438
|
-
|
|
447
|
+
isTouch && $$.hideTooltip();
|
|
448
|
+
} : null);
|
|
439
449
|
|
|
440
450
|
!isTouch && item
|
|
441
|
-
.on("mouseout",
|
|
442
|
-
|
|
443
|
-
|
|
451
|
+
.on("mouseout", interaction || isFunction(config.legend_item_onout) ?
|
|
452
|
+
function(event, id) {
|
|
453
|
+
if (!callFn(config.legend_item_onout, api, id)) {
|
|
454
|
+
d3Select(this).classed($FOCUS.legendItemFocused, false);
|
|
444
455
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
$$.api.revert();
|
|
450
|
-
}
|
|
451
|
-
})
|
|
452
|
-
.on("mouseover", function(event, id) {
|
|
453
|
-
if (!callFn(config.legend_item_onover, api, id)) {
|
|
454
|
-
d3Select(this).classed($FOCUS.legendItemFocused, true);
|
|
456
|
+
if (hasGauge) {
|
|
457
|
+
$$.undoMarkOverlapped($$, `.${$GAUGE.gaugeValue}`);
|
|
458
|
+
}
|
|
455
459
|
|
|
456
|
-
|
|
457
|
-
$$.markOverlapped(id, $$, `.${$GAUGE.gaugeValue}`);
|
|
460
|
+
$$.api.revert();
|
|
458
461
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
} : null)
|
|
463
|
+
.on("mouseover", interaction || isFunction(config.legend_item_onover) ?
|
|
464
|
+
function(event, id) {
|
|
465
|
+
if (!callFn(config.legend_item_onover, api, id)) {
|
|
466
|
+
d3Select(this).classed($FOCUS.legendItemFocused, true);
|
|
467
|
+
|
|
468
|
+
if (hasGauge) {
|
|
469
|
+
$$.markOverlapped(id, $$, `.${$GAUGE.gaugeValue}`);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (!state.transiting && $$.isTargetToShow(id)) {
|
|
473
|
+
api.focus(id);
|
|
474
|
+
}
|
|
462
475
|
}
|
|
463
|
-
}
|
|
464
|
-
|
|
476
|
+
} : null);
|
|
477
|
+
|
|
478
|
+
// set cursor when has some interaction
|
|
479
|
+
!item.empty() && item.on("click mouseout mouseover") &&
|
|
480
|
+
item.style("cursor", $$.getStylePropValue("pointer"));
|
|
465
481
|
}
|
|
466
482
|
},
|
|
467
483
|
|
|
@@ -14,9 +14,13 @@ export default {
|
|
|
14
14
|
initBar(): void {
|
|
15
15
|
const {$el, config, state: {clip}} = this;
|
|
16
16
|
|
|
17
|
-
$el.bar = $el.main.select(`.${$COMMON.chart}`)
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
$el.bar = $el.main.select(`.${$COMMON.chart}`);
|
|
18
|
+
|
|
19
|
+
$el.bar = config.bar_front ?
|
|
20
|
+
$el.bar.append("g") :
|
|
21
|
+
$el.bar.insert("g", ":first-child");
|
|
22
|
+
|
|
23
|
+
$el.bar
|
|
20
24
|
.attr("class", $BAR.chartBars)
|
|
21
25
|
.call(this.setCssRule(false, `.${$BAR.chartBars}`, ["pointer-events:none"]));
|
|
22
26
|
|
|
@@ -40,17 +40,34 @@ export default {
|
|
|
40
40
|
* - defines the max step the legend has (e.g. If 2 set and legend has 3 legend item, the legend 2 columns).
|
|
41
41
|
* @property {boolean} [legend.equally=false] Set to all items have same width size.
|
|
42
42
|
* @property {number} [legend.padding=0] Set padding value
|
|
43
|
+
* @property {boolean} [legend.item.interaction=true] Set legend item interaction.
|
|
44
|
+
* - **NOTE:**
|
|
45
|
+
* - This setting will not have effect on `.toggle()` method.
|
|
46
|
+
* - `legend.item.onXXX` listener options will work if set, regardless of this option value.
|
|
47
|
+
* @property {boolean} [legend.item.interaction.dblclick=false] Set legend item to interact on double click.
|
|
48
|
+
* - **NOTE:**
|
|
49
|
+
* - Double clicking will make focused clicked dataseries only, hiding all others.
|
|
50
|
+
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
51
|
+
* - To return initial state(which all dataseries are showing), double click current focused legend item again.
|
|
52
|
+
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
53
|
+
* - In this case, default `click` interaction will be disabled.
|
|
43
54
|
* @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
55
|
+
* - **NOTE:**
|
|
56
|
+
* - When set, default `click` interaction will be disabled.
|
|
57
|
+
* - When `interaction.dblclick=true` is set, will be called on double click.
|
|
44
58
|
* @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
59
|
+
* - **NOTE:** When set, default `mouseover` interaction will be disabled.
|
|
45
60
|
* @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
61
|
+
* - **NOTE:** When set, default `mouseout` interaction will be disabled.
|
|
46
62
|
* @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
|
|
47
|
-
* @property {number} [legend.item.tile.height=10]
|
|
63
|
+
* @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
|
|
48
64
|
* @property {number} [legend.item.tile.r=5] Set the radius for 'circle' legend item tile type.
|
|
49
65
|
* @property {string} [legend.item.tile.type="rectangle"] Set legend item shape type.<br>
|
|
50
66
|
* - **Available Values:**
|
|
51
67
|
* - circle
|
|
52
68
|
* - rectangle
|
|
53
69
|
* @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
|
|
70
|
+
* @see [Demo: item.interaction](https://naver.github.io/billboard.js/demo/#Legend.LegendItemInteraction)
|
|
54
71
|
* @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
|
|
55
72
|
* @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
|
|
56
73
|
* @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1)
|
|
@@ -85,6 +102,16 @@ export default {
|
|
|
85
102
|
* equally: false,
|
|
86
103
|
* padding: 10,
|
|
87
104
|
* item: {
|
|
105
|
+
* // will disable default interaction
|
|
106
|
+
* interaction: false,
|
|
107
|
+
*
|
|
108
|
+
* // set legend interact on double click
|
|
109
|
+
* // by double clicking, will make focused clicked dataseries only, hiding all others.
|
|
110
|
+
* interaction: {
|
|
111
|
+
* dblclick: true
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
114
|
+
* // when set below callback, will disable corresponding default interactions
|
|
88
115
|
* onclick: function(id) { ... },
|
|
89
116
|
* onover: function(id) { ... },
|
|
90
117
|
* onout: function(id) { ... },
|
|
@@ -105,23 +132,27 @@ export default {
|
|
|
105
132
|
* usePoint: true
|
|
106
133
|
* }
|
|
107
134
|
*/
|
|
108
|
-
legend_show: true,
|
|
109
|
-
legend_hide: false,
|
|
110
135
|
legend_contents_bindto: <string|HTMLElement|undefined> undefined,
|
|
111
136
|
legend_contents_template: <string|(() => string)|undefined> "<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",
|
|
112
|
-
|
|
137
|
+
legend_equally: false,
|
|
138
|
+
legend_hide: false,
|
|
113
139
|
legend_inset_anchor: <"top-left"|"top-right"|"bottom-left"|"bottom-right"> "top-left",
|
|
114
140
|
legend_inset_x: 10,
|
|
115
141
|
legend_inset_y: 0,
|
|
116
142
|
legend_inset_step: <number|undefined> undefined,
|
|
143
|
+
legend_item_interaction: <boolean|{
|
|
144
|
+
dblclick?: boolean;
|
|
145
|
+
}> true,
|
|
146
|
+
legend_item_dblclick: false,
|
|
117
147
|
legend_item_onclick: <Function|undefined> undefined,
|
|
118
148
|
legend_item_onover: <Function|undefined> undefined,
|
|
119
149
|
legend_item_onout: <Function|undefined> undefined,
|
|
120
|
-
legend_equally: false,
|
|
121
|
-
legend_padding: 0,
|
|
122
150
|
legend_item_tile_width: 10,
|
|
123
151
|
legend_item_tile_height: 10,
|
|
124
152
|
legend_item_tile_r: 5,
|
|
125
153
|
legend_item_tile_type: <"rectangle"|"circle"> "rectangle",
|
|
154
|
+
legend_padding: 0,
|
|
155
|
+
legend_position: <"bottom"|"right"|"inset"> "bottom",
|
|
156
|
+
legend_show: true,
|
|
126
157
|
legend_usePoint: false
|
|
127
158
|
};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
+
import {IDataPoint} from "../../../ChartInternal/data/IData";
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* point config options
|
|
7
9
|
*/
|
|
@@ -23,7 +25,20 @@ export default {
|
|
|
23
25
|
* - **NOTE:**
|
|
24
26
|
* - `null` will make to not set inline 'opacity' css prop.
|
|
25
27
|
* - when no value(or undefined) is set, it defaults to set opacity value according its chart types.
|
|
26
|
-
* @property {number} [point.sensitivity=10] The senstivity value for interaction boundary.
|
|
28
|
+
* @property {number|string|Function} [point.sensitivity=10] The senstivity value for interaction boundary.
|
|
29
|
+
* - **Available Values:**
|
|
30
|
+
* - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
|
|
31
|
+
* - "radius": sensitivity based on point's radius
|
|
32
|
+
* - Function: callback for each point to determine the sensitivity<br>
|
|
33
|
+
* ```js
|
|
34
|
+
* sensitivity: function(d) {
|
|
35
|
+
* // ex. of argument d:
|
|
36
|
+
* // ==> {x: 2, value: 55, id: 'data3', index: 2, r: 19.820624179302296}
|
|
37
|
+
*
|
|
38
|
+
* // returning d.r, will make sensitivity same as point's radius value.
|
|
39
|
+
* return d.r;
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
27
42
|
* @property {number} [point.select.r=point.r*4] The radius size of each point on selected.
|
|
28
43
|
* @property {string} [point.type="circle"] The type of point to be drawn
|
|
29
44
|
* - **NOTE:**
|
|
@@ -44,6 +59,7 @@ export default {
|
|
|
44
59
|
* (ex. `<polygon points='2.5 0 0 5 5 5'></polygon>`)
|
|
45
60
|
* @see [Demo: point type](https://naver.github.io/billboard.js/demo/#Point.RectanglePoints)
|
|
46
61
|
* @see [Demo: point focus only](https://naver.github.io/billboard.js/demo/#Point.FocusOnly)
|
|
62
|
+
* @see [Demo: point sensitivity](https://naver.github.io/billboard.js/demo/#Point.PointSensitivity)
|
|
47
63
|
* @example
|
|
48
64
|
* point: {
|
|
49
65
|
* show: false,
|
|
@@ -76,6 +92,18 @@ export default {
|
|
|
76
92
|
* // having lower value, means how closer to be for interaction
|
|
77
93
|
* sensitivity: 3,
|
|
78
94
|
*
|
|
95
|
+
* // sensitivity based on point's radius
|
|
96
|
+
* sensitivity: "radius",
|
|
97
|
+
*
|
|
98
|
+
* // callback for each point to determine the sensitivity
|
|
99
|
+
* sensitivity: function(d) {
|
|
100
|
+
* // ex. of argument d:
|
|
101
|
+
* // ==> {x: 2, value: 55, id: 'data3', index: 2, r: 19.820624179302296}
|
|
102
|
+
*
|
|
103
|
+
* // returning d.r, will make sensitivity same as point's radius value.
|
|
104
|
+
* return d.r;
|
|
105
|
+
* }
|
|
106
|
+
*
|
|
79
107
|
* // valid values are "circle" or "rectangle"
|
|
80
108
|
* type: "rectangle",
|
|
81
109
|
*
|
|
@@ -89,7 +117,7 @@ export default {
|
|
|
89
117
|
*/
|
|
90
118
|
point_show: true,
|
|
91
119
|
point_r: 2.5,
|
|
92
|
-
point_sensitivity: 10,
|
|
120
|
+
point_sensitivity: <number|"radius"|((d: IDataPoint) => number)> 10,
|
|
93
121
|
point_focus_expand_enabled: true,
|
|
94
122
|
point_focus_expand_r: <number|undefined> undefined,
|
|
95
123
|
point_focus_only: false,
|
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
* @memberof Options
|
|
13
13
|
* @type {object}
|
|
14
14
|
* @property {object} bar Bar object
|
|
15
|
+
* @property {boolean} [bar.front=false] Set 'bar' to be positioned over(on the top) other shapes elements.
|
|
15
16
|
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
16
17
|
* @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
17
18
|
* @property {boolean|object} [bar.linearGradient=false] Set the linear gradient on bar.<br><br>
|
|
@@ -34,6 +35,7 @@ export default {
|
|
|
34
35
|
* @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
|
|
35
36
|
* @property {number} [bar.width.dataname.max] The maximum width value for ratio.
|
|
36
37
|
* @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
|
|
38
|
+
* @see [Demo: bar front](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarFront)
|
|
37
39
|
* @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
|
|
38
40
|
* @see [Demo: bar overlap](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarOverlap)
|
|
39
41
|
* @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
|
|
@@ -42,6 +44,9 @@ export default {
|
|
|
42
44
|
* @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant)
|
|
43
45
|
* @example
|
|
44
46
|
* bar: {
|
|
47
|
+
* // make bar shape to be positioned over the other shape elements
|
|
48
|
+
* front: true,
|
|
49
|
+
*
|
|
45
50
|
* // remove nullish data on bar indices postions
|
|
46
51
|
* indices: {
|
|
47
52
|
* removeNull: true
|
|
@@ -112,11 +117,12 @@ export default {
|
|
|
112
117
|
* zerobased: false
|
|
113
118
|
* }
|
|
114
119
|
*/
|
|
120
|
+
bar_front: false,
|
|
121
|
+
bar_indices_removeNull: false,
|
|
115
122
|
bar_label_threshold: 0,
|
|
116
123
|
bar_linearGradient: <
|
|
117
124
|
boolean|{x?: number[]; y?: number[]; stops?: [number, string|Function|null, number]}
|
|
118
125
|
> false,
|
|
119
|
-
bar_indices_removeNull: false,
|
|
120
126
|
bar_overlap: false,
|
|
121
127
|
bar_padding: 0,
|
|
122
128
|
bar_radius: <number|{ratio: number}|undefined> undefined,
|
package/types/options.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {Axis} from "./axis";
|
|
6
6
|
import {ChartTypes, d3Selection, DataItem, PrimitiveArray} from "./types";
|
|
7
7
|
import {Chart} from "./chart";
|
|
8
|
-
import {IArcData, IData, IDataRow} from "../src/ChartInternal/data/IData";
|
|
8
|
+
import {IArcData, IData, IDataPoint, IDataRow} from "../src/ChartInternal/data/IData";
|
|
9
9
|
import {
|
|
10
10
|
ArcOptions,
|
|
11
11
|
AreaOptions,
|
|
@@ -470,18 +470,43 @@ export interface LegendOptions {
|
|
|
470
470
|
*/
|
|
471
471
|
r?: number;
|
|
472
472
|
};
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Set legend item interaction.
|
|
476
|
+
* - **NOTE:**
|
|
477
|
+
* - This setting will not have effect on `.toggle()` method.
|
|
478
|
+
* - `legend.item.onXXX` listener options will work if set, regardless of this option value.
|
|
479
|
+
*/
|
|
480
|
+
interaction?: boolean | {
|
|
481
|
+
/**
|
|
482
|
+
* Set legend item to interact on double click.
|
|
483
|
+
* - **NOTE:**
|
|
484
|
+
* - Double clicking will make focused clicked dataseries only, hiding all others.
|
|
485
|
+
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
486
|
+
* - To return initial state(which all dataseries are showing), double click current focused legend item again.
|
|
487
|
+
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
488
|
+
* - In this case, default `click` interaction will be disabled.
|
|
489
|
+
*/
|
|
490
|
+
dblclick?: boolean;
|
|
491
|
+
};
|
|
492
|
+
|
|
473
493
|
/**
|
|
474
494
|
* Set click event handler to the legend item.
|
|
495
|
+
* - **NOTE:**
|
|
496
|
+
* - When set, default `click` interaction will be disabled.
|
|
497
|
+
* - When `interaction.dblclick=true` is set, will be called on double click.
|
|
475
498
|
*/
|
|
476
499
|
onclick?(this: Chart, id: string): void;
|
|
477
500
|
|
|
478
501
|
/**
|
|
479
502
|
* Set mouseover event handler to the legend item.
|
|
503
|
+
* - **NOTE:** When set, default `mouseover` interaction will be disabled.
|
|
480
504
|
*/
|
|
481
505
|
onover?(this: Chart, id: string): void;
|
|
482
506
|
|
|
483
507
|
/**
|
|
484
508
|
* Set mouseout event handler to the legend item.
|
|
509
|
+
* - **NOTE:** When set, default `mouseout` interaction will be disabled.
|
|
485
510
|
*/
|
|
486
511
|
onout?(this: Chart, id: string): void;
|
|
487
512
|
};
|
|
@@ -835,8 +860,13 @@ export interface PointOptions {
|
|
|
835
860
|
|
|
836
861
|
/**
|
|
837
862
|
* The senstivity value for interaction boundary.
|
|
863
|
+
*
|
|
864
|
+
* - **Available Values:**
|
|
865
|
+
* - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
|
|
866
|
+
* - "radius": sensitivity based on point's radius
|
|
867
|
+
* - Function: callback for each point to determine the sensitivity
|
|
838
868
|
*/
|
|
839
|
-
sensitivity?: number;
|
|
869
|
+
sensitivity?: number | "radius" | ((d: IDataPoint) => number);
|
|
840
870
|
|
|
841
871
|
/**
|
|
842
872
|
* The type of point to be drawn
|
package/types/options.shape.d.ts
CHANGED
|
@@ -122,11 +122,9 @@ export interface AreaOptions {
|
|
|
122
122
|
|
|
123
123
|
export interface BarOptions {
|
|
124
124
|
/**
|
|
125
|
-
* Set
|
|
125
|
+
* Set 'bar' to be positioned over(on the top) other shapes elements.
|
|
126
126
|
*/
|
|
127
|
-
|
|
128
|
-
threshold?: number;
|
|
129
|
-
};
|
|
127
|
+
front?: boolean;
|
|
130
128
|
|
|
131
129
|
/**
|
|
132
130
|
* Remove nullish data on bar indices positions.
|
|
@@ -135,6 +133,13 @@ export interface BarOptions {
|
|
|
135
133
|
removeNull?: boolean;
|
|
136
134
|
};
|
|
137
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Set threshold ratio to show/hide labels.
|
|
138
|
+
*/
|
|
139
|
+
label?: {
|
|
140
|
+
threshold?: number;
|
|
141
|
+
};
|
|
142
|
+
|
|
138
143
|
/**
|
|
139
144
|
* Set the linear gradient on bar.<br><br>
|
|
140
145
|
* Or customize by giving below object value:
|