billboard.js 3.2.0-next.5 → 3.2.2
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 +8 -8
- package/dist/billboard.js +109 -68
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +3794 -2736
- package/dist/billboard.pkgd.min.js +3 -3
- 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 +9 -5
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +9 -5
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +9 -5
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +3433 -2617
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +3451 -2631
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3485 -2655
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +3453 -2633
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3450 -2630
- package/dist/theme/datalab.css +6 -4
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +6 -4
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +6 -4
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +446 -420
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +6 -6
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +15 -15
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +6 -6
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -4
- package/package.json +52 -53
- package/src/Chart/api/load.ts +7 -0
- package/src/Chart/api/zoom.ts +9 -6
- package/src/ChartInternal/Axis/Axis.ts +2 -2
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/data.ts +1 -1
- package/src/ChartInternal/interactions/eventrect.ts +21 -3
- package/src/ChartInternal/interactions/zoom.ts +1 -1
- package/src/ChartInternal/internals/domain.ts +27 -29
- package/src/ChartInternal/internals/legend.ts +2 -1
- package/src/ChartInternal/internals/redraw.ts +2 -2
- package/src/ChartInternal/internals/text.ts +2 -2
- package/src/ChartInternal/shape/arc.ts +2 -6
- package/src/ChartInternal/shape/bar.ts +10 -2
- package/src/config/Options/data/data.ts +3 -3
- package/src/config/Options/shape/line.ts +6 -1
- package/src/module/util.ts +3 -5
- package/src/scss/billboard.scss +3 -13
- package/src/scss/theme/datalab.scss +3 -7
- package/src/scss/theme/graph.scss +3 -2
- package/src/scss/theme/insight.scss +3 -2
- package/types/chart.d.ts +2 -2
- package/types/options.d.ts +3 -3
- package/types/types.d.ts +5 -2
|
@@ -16,8 +16,7 @@ export default {
|
|
|
16
16
|
state.redrawing = true;
|
|
17
17
|
|
|
18
18
|
const targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
19
|
-
const initializing = options
|
|
20
|
-
const flow = options.flow;
|
|
19
|
+
const {flow, initializing} = options;
|
|
21
20
|
const wth = $$.getWithOption(options);
|
|
22
21
|
const duration = wth.Transition ? config.transition_duration : 0;
|
|
23
22
|
const durationForExit = wth.TransitionForExit ? duration : 0;
|
|
@@ -247,6 +246,7 @@ export default {
|
|
|
247
246
|
redrawWithoutRescale() {
|
|
248
247
|
this.redraw({
|
|
249
248
|
withY: false,
|
|
249
|
+
withLegend: true,
|
|
250
250
|
withSubchart: false,
|
|
251
251
|
withEventRect: false,
|
|
252
252
|
withTransitionForAxis: false
|
|
@@ -91,7 +91,7 @@ export default {
|
|
|
91
91
|
})
|
|
92
92
|
.style("fill", $$.updateTextColor.bind($$))
|
|
93
93
|
.style("fill-opacity", "0")
|
|
94
|
-
.each(function(d, i,
|
|
94
|
+
.each(function(d, i, texts) {
|
|
95
95
|
const node = d3Select(this);
|
|
96
96
|
let {value} = d;
|
|
97
97
|
|
|
@@ -105,7 +105,7 @@ export default {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
value = $$.dataLabelFormat(d.id)(value, d.id, i,
|
|
108
|
+
value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
|
109
109
|
|
|
110
110
|
if (isNumber(value)) {
|
|
111
111
|
this.textContent = value;
|
|
@@ -536,11 +536,7 @@ export default {
|
|
|
536
536
|
.attr("class", CLASS[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"])
|
|
537
537
|
.style("text-anchor", "middle");
|
|
538
538
|
|
|
539
|
-
|
|
540
|
-
text
|
|
541
|
-
.attr("dy", "-0.3em")
|
|
542
|
-
.style("font-size", "27px");
|
|
543
|
-
}
|
|
539
|
+
hasGauge && text.attr("dy", "-0.3em");
|
|
544
540
|
|
|
545
541
|
setTextValue(text, title, hasGauge ? undefined : [-0.6, 1.35], true);
|
|
546
542
|
}
|
|
@@ -565,7 +561,7 @@ export default {
|
|
|
565
561
|
mainArc = mainArc.enter().append("path")
|
|
566
562
|
.attr("class", $$.getClass("arc", true))
|
|
567
563
|
.style("fill", d => $$.color(d.data))
|
|
568
|
-
.style("cursor", d => (isSelectable?.bind($$.api)(d) ? "pointer" : null))
|
|
564
|
+
.style("cursor", d => (isSelectable?.bind?.($$.api)(d) ? "pointer" : null))
|
|
569
565
|
.style("opacity", "0")
|
|
570
566
|
.each(function(d) {
|
|
571
567
|
if ($$.isGaugeType(d.data)) {
|
|
@@ -7,12 +7,20 @@ import {getPointer, getRandom, getRectSegList, isNumber} from "../../module/util
|
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
initBar(): void {
|
|
10
|
-
const {$el} = this;
|
|
10
|
+
const {$el, config, state: {clip}} = this;
|
|
11
11
|
|
|
12
12
|
$el.bar = $el.main.select(`.${CLASS.chart}`)
|
|
13
13
|
// should positioned at the beginning of the shape node to not overlap others
|
|
14
14
|
.insert("g", ":first-child")
|
|
15
15
|
.attr("class", CLASS.chartBars);
|
|
16
|
+
|
|
17
|
+
// set clip-path attribute when condition meet
|
|
18
|
+
// https://github.com/naver/billboard.js/issues/2421
|
|
19
|
+
if (config.clipPath === false && (
|
|
20
|
+
config.bar_radius || config.bar_radius_ratio
|
|
21
|
+
)) {
|
|
22
|
+
$el.bar.attr("clip-path", clip.pathXAxis.replace(/#[^)]*/, `#${clip.id}`));
|
|
23
|
+
}
|
|
16
24
|
},
|
|
17
25
|
|
|
18
26
|
updateTargetsForBar(targets): void {
|
|
@@ -122,7 +130,7 @@ export default {
|
|
|
122
130
|
const pathRadius = ["", ""];
|
|
123
131
|
let radius = 0;
|
|
124
132
|
|
|
125
|
-
if (getRadius && !isGrouped) {
|
|
133
|
+
if (d.value !== 0 && getRadius && !isGrouped) {
|
|
126
134
|
const index = isRotated ? indexY : indexX;
|
|
127
135
|
const barW = points[2][index] - points[0][index];
|
|
128
136
|
|
|
@@ -300,8 +300,8 @@ export default {
|
|
|
300
300
|
* The arguments are:<br>
|
|
301
301
|
* - `v` is the value of the data point where the label is shown.
|
|
302
302
|
* - `id` is the id of the data where the label is shown.
|
|
303
|
-
* - `i` is the index of the data point where the label is shown.
|
|
304
|
-
* - `
|
|
303
|
+
* - `i` is the index of the data series point where the label is shown.
|
|
304
|
+
* - `texts` is the array of whole corresponding data series' text labels.<br><br>
|
|
305
305
|
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
|
|
306
306
|
* @property {string|object} [data.labels.backgroundColors] Set label text background colors.
|
|
307
307
|
* @property {string|object|Function} [data.labels.colors] Set label text colors.
|
|
@@ -331,7 +331,7 @@ export default {
|
|
|
331
331
|
*
|
|
332
332
|
* // it's possible to set for each data
|
|
333
333
|
* format: {
|
|
334
|
-
* data1: function(v, id, i,
|
|
334
|
+
* data1: function(v, id, i, texts) { ... },
|
|
335
335
|
* ...
|
|
336
336
|
* },
|
|
337
337
|
*
|
|
@@ -20,6 +20,7 @@ export default {
|
|
|
20
20
|
* - step
|
|
21
21
|
* - step-before
|
|
22
22
|
* - step-after
|
|
23
|
+
* @property {boolean} [line.step.tooltipMatch=false] Set to `true` for `step-before` and `step-after` types to have cursor/tooltip match to hovered step's point instead of nearest point.
|
|
23
24
|
* @property {boolean|Array} [line.point=true] Set to false to not draw points on linecharts. Or pass an array of line ids to draw points for.
|
|
24
25
|
* @property {boolean} [line.zerobased=false] Set if min or max value will be 0 on line chart.
|
|
25
26
|
* @example
|
|
@@ -30,7 +31,10 @@ export default {
|
|
|
30
31
|
* "line-class2"
|
|
31
32
|
* ],
|
|
32
33
|
* step: {
|
|
33
|
-
* type: "step-after"
|
|
34
|
+
* type: "step-after",
|
|
35
|
+
*
|
|
36
|
+
* // to have cursor/tooltip match to hovered step's point instead of nearest point.
|
|
37
|
+
* tooltipMatch: true
|
|
34
38
|
* },
|
|
35
39
|
*
|
|
36
40
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
@@ -46,6 +50,7 @@ export default {
|
|
|
46
50
|
*/
|
|
47
51
|
line_connectNull: false,
|
|
48
52
|
line_step_type: <"step"|"step-before"|"step-after"> "step",
|
|
53
|
+
line_step_tooltipMatch: false,
|
|
49
54
|
line_zerobased: false,
|
|
50
55
|
line_classes: <string[]|undefined> undefined,
|
|
51
56
|
line_point: <string[]|boolean> true
|
package/src/module/util.ts
CHANGED
|
@@ -262,12 +262,10 @@ function getPathBox(
|
|
|
262
262
|
* @private
|
|
263
263
|
*/
|
|
264
264
|
function getPointer(event, element?: Element): number[] {
|
|
265
|
-
const touches = event && (event.touches || (event.sourceEvent && event.sourceEvent.touches));
|
|
266
|
-
const pointer = event
|
|
267
|
-
d3Pointer(touches ? touches[0] : event, element) :
|
|
268
|
-
[0, 0];
|
|
265
|
+
const touches = event && (event.touches || (event.sourceEvent && event.sourceEvent.touches))?.[0];
|
|
266
|
+
const pointer = d3Pointer(touches || event, element);
|
|
269
267
|
|
|
270
|
-
return pointer;
|
|
268
|
+
return pointer.map(v => (isNaN(v) ? 0 : v));
|
|
271
269
|
}
|
|
272
270
|
|
|
273
271
|
/**
|
package/src/scss/billboard.scss
CHANGED
|
@@ -51,17 +51,10 @@
|
|
|
51
51
|
shape-rendering: crispEdges;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.bb-axis-x .tick {}
|
|
55
|
-
.bb-axis-x-label {}
|
|
56
|
-
|
|
57
|
-
.bb-axis-y .tick {}
|
|
58
|
-
.bb-axis-y-label {}
|
|
59
|
-
|
|
60
|
-
.bb-axis-y2 .tick {}
|
|
61
|
-
.bb-axis-y2-label {}
|
|
62
|
-
|
|
63
54
|
/*-- Grid --*/
|
|
64
55
|
.bb-grid {
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
|
|
65
58
|
line {
|
|
66
59
|
stroke: #aaa;
|
|
67
60
|
}
|
|
@@ -153,9 +146,6 @@
|
|
|
153
146
|
fill-opacity: .1;
|
|
154
147
|
}
|
|
155
148
|
|
|
156
|
-
/*-- Select - Drag --*/
|
|
157
|
-
.bb-dragarea {}
|
|
158
|
-
|
|
159
149
|
/*-- Legend --*/
|
|
160
150
|
.bb-legend-item {
|
|
161
151
|
font-size: 12px;
|
|
@@ -237,7 +227,7 @@
|
|
|
237
227
|
font-size: 1.3em;
|
|
238
228
|
}
|
|
239
229
|
|
|
240
|
-
.bb-chart-arcs-gauge-title {
|
|
230
|
+
text.bb-chart-arcs-gauge-title {
|
|
241
231
|
dominant-baseline: middle;
|
|
242
232
|
font-size: 2.7em;
|
|
243
233
|
}
|
|
@@ -42,7 +42,6 @@ $text-font-size: 11px;
|
|
|
42
42
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
43
43
|
fill: #737373;
|
|
44
44
|
}
|
|
45
|
-
.bb-axis-y2 .tick {}
|
|
46
45
|
|
|
47
46
|
.bb-event-rects {
|
|
48
47
|
fill-opacity: 1 !important;
|
|
@@ -62,6 +61,8 @@ $text-font-size: 11px;
|
|
|
62
61
|
|
|
63
62
|
/*-- Grid --*/
|
|
64
63
|
.bb-grid {
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
|
|
65
66
|
line {
|
|
66
67
|
stroke: #f1f1f1;
|
|
67
68
|
}
|
|
@@ -210,10 +211,6 @@ $text-font-size: 11px;
|
|
|
210
211
|
font-size: 13px;
|
|
211
212
|
padding: 2px 8px;
|
|
212
213
|
text-align:left;
|
|
213
|
-
// border-bottom: solid 2px red;
|
|
214
|
-
// background-color: #000;
|
|
215
|
-
// color: #fff;
|
|
216
|
-
|
|
217
214
|
border-bottom: solid 2px #ff2d2d;
|
|
218
215
|
background-color: #0b00b1;
|
|
219
216
|
color: #fffdfd;
|
|
@@ -221,7 +218,6 @@ $text-font-size: 11px;
|
|
|
221
218
|
|
|
222
219
|
td {
|
|
223
220
|
padding: 4px 6px;
|
|
224
|
-
// background-color:#fff;
|
|
225
221
|
|
|
226
222
|
&:first-child {
|
|
227
223
|
padding-left: 8px;
|
|
@@ -288,7 +284,7 @@ $text-font-size: 11px;
|
|
|
288
284
|
font-size: 1.3em;
|
|
289
285
|
}
|
|
290
286
|
|
|
291
|
-
.bb-chart-arcs-gauge-title {
|
|
287
|
+
text.bb-chart-arcs-gauge-title {
|
|
292
288
|
dominant-baseline: middle;
|
|
293
289
|
font-size: 2.7em;
|
|
294
290
|
}
|
|
@@ -52,7 +52,6 @@ $axis-color: #8c8c8c;
|
|
|
52
52
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
53
53
|
fill: $axis-color;
|
|
54
54
|
}
|
|
55
|
-
.bb-axis-y2 .tick {}
|
|
56
55
|
|
|
57
56
|
.bb-event-rects {
|
|
58
57
|
fill-opacity: 1 !important;
|
|
@@ -72,6 +71,8 @@ $axis-color: #8c8c8c;
|
|
|
72
71
|
|
|
73
72
|
/*-- Grid --*/
|
|
74
73
|
.bb-grid {
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
|
|
75
76
|
line {
|
|
76
77
|
stroke: #f1f1f1;
|
|
77
78
|
}
|
|
@@ -301,7 +302,7 @@ rect.bb-circle, use.bb-circle {
|
|
|
301
302
|
font-size: 1.3em;
|
|
302
303
|
}
|
|
303
304
|
|
|
304
|
-
.bb-chart-arcs-gauge-title {
|
|
305
|
+
text.bb-chart-arcs-gauge-title {
|
|
305
306
|
dominant-baseline: middle;
|
|
306
307
|
font-size: 2.7em;
|
|
307
308
|
}
|
|
@@ -47,7 +47,6 @@ $font-family: sans-serif, Arial, "nanumgothic", "Dotum";
|
|
|
47
47
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
48
48
|
fill: #737373;
|
|
49
49
|
}
|
|
50
|
-
.bb-axis-y2 .tick {}
|
|
51
50
|
|
|
52
51
|
.bb-event-rects {
|
|
53
52
|
fill-opacity: 1 !important;
|
|
@@ -67,6 +66,8 @@ $font-family: sans-serif, Arial, "nanumgothic", "Dotum";
|
|
|
67
66
|
|
|
68
67
|
/*-- Grid --*/
|
|
69
68
|
.bb-grid {
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
|
|
70
71
|
line {
|
|
71
72
|
stroke: #f1f1f1;
|
|
72
73
|
}
|
|
@@ -281,7 +282,7 @@ rect.bb-circle, use.bb-circle {
|
|
|
281
282
|
font-size: 1.3em;
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
.bb-chart-arcs-gauge-title {
|
|
285
|
+
text.bb-chart-arcs-gauge-title {
|
|
285
286
|
dominant-baseline: middle;
|
|
286
287
|
font-size: 2.7em;
|
|
287
288
|
}
|
package/types/chart.d.ts
CHANGED
|
@@ -223,7 +223,7 @@ export interface Chart {
|
|
|
223
223
|
* Zoom by giving x domain.
|
|
224
224
|
* @param domain If domain is given, the chart will be zoomed to the given domain. If no argument is given, the current zoomed domain will be returned.
|
|
225
225
|
*/
|
|
226
|
-
(domain?: Array<Date|number>): Array<Date|number>;
|
|
226
|
+
(domain?: Array<Date|number|string>): Array<Date|number>;
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
229
|
* Enable and disable zooming.
|
|
@@ -347,7 +347,7 @@ export interface Chart {
|
|
|
347
347
|
load(this: Chart, args: {
|
|
348
348
|
append?: boolean;
|
|
349
349
|
url?: string;
|
|
350
|
-
json?: [{ [key: string]: string }];
|
|
350
|
+
json?: [{ [key: string]: string | number }] | {[key: string]: string[] | number[]};
|
|
351
351
|
rows?: PrimitiveArray[];
|
|
352
352
|
columns?: PrimitiveArray[];
|
|
353
353
|
data?: Array<{ [key: string]: number }>;
|
package/types/options.d.ts
CHANGED
|
@@ -1498,8 +1498,8 @@ export interface Data {
|
|
|
1498
1498
|
* The arguments are:<br>
|
|
1499
1499
|
* - `v` is the value of the data point where the label is shown.
|
|
1500
1500
|
* - `id` is the id of the data where the label is shown.
|
|
1501
|
-
* - `i` is the index of the data point where the label is shown.
|
|
1502
|
-
* - `
|
|
1501
|
+
* - `i` is the index of the data series point where the label is shown.
|
|
1502
|
+
* - `texts` is the array of whole corresponding data series' text labels.<br><br>
|
|
1503
1503
|
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
|
|
1504
1504
|
*/
|
|
1505
1505
|
format?: FormatFunction | { [key: string]: FormatFunction };
|
|
@@ -1695,5 +1695,5 @@ export type FormatFunction = (
|
|
|
1695
1695
|
v: any,
|
|
1696
1696
|
id: string,
|
|
1697
1697
|
i: number,
|
|
1698
|
-
|
|
1698
|
+
texts: SVGTextElement[]
|
|
1699
1699
|
) => void;
|
package/types/types.d.ts
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import {Selection} from "d3-selection";
|
|
5
|
+
import {Selection} from "d3-selection";
|
|
6
6
|
|
|
7
|
-
export type PrimitiveArray = Array<
|
|
7
|
+
export type PrimitiveArray = Array<
|
|
8
|
+
string | boolean | number | Date | null |
|
|
9
|
+
{[key: string]: number} | number[]
|
|
10
|
+
>;
|
|
8
11
|
export type ArrayOrString = string[] | string;
|
|
9
12
|
export type d3Selection = Selection<any, any, any, any>;
|
|
10
13
|
export type ChartTypes = "area"
|