billboard.js 3.3.0-next.1 → 3.3.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 +1 -1
- package/dist/billboard.js +644 -427
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2809 -2331
- package/dist/billboard.pkgd.min.js +3 -3
- 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 +156 -103
- 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 +154 -101
- 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 +20 -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 +20 -128
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2166 -1905
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2325 -2011
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2320 -2006
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2186 -2033
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2187 -2034
- 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 +642 -440
- 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 +39 -38
- package/src/Chart/api/chart.ts +8 -2
- 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 +10 -10
- package/src/ChartInternal/Axis/Axis.ts +26 -19
- package/src/ChartInternal/ChartInternal.ts +8 -7
- package/src/ChartInternal/data/IData.ts +9 -0
- package/src/ChartInternal/data/data.ts +4 -4
- 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 +1 -1
- package/src/ChartInternal/internals/format.ts +9 -4
- package/src/ChartInternal/internals/grid.ts +32 -32
- package/src/ChartInternal/internals/legend.ts +27 -27
- package/src/ChartInternal/internals/redraw.ts +6 -5
- package/src/ChartInternal/internals/region.ts +3 -3
- package/src/ChartInternal/internals/selection.ts +16 -15
- package/src/ChartInternal/internals/size.ts +3 -3
- package/src/ChartInternal/internals/text.ts +8 -8
- package/src/ChartInternal/internals/title.ts +4 -4
- package/src/ChartInternal/internals/tooltip.ts +5 -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 +11 -9
- 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 +43 -11
- 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/config/Options/axis/x.ts +25 -5
- package/src/config/Options/axis/y.ts +24 -3
- package/src/config/Options/axis/y2.ts +24 -3
- package/src/config/Options/common/tooltip.ts +10 -1
- package/src/config/Options/shape/bar.ts +8 -0
- package/src/config/classes.ts +154 -66
- package/src/module/util.ts +17 -11
- package/types/axis.d.ts +22 -8
- package/types/chart.d.ts +1 -1
- package/types/options.d.ts +32 -32
- package/types/plugin/tableview/index.d.ts +3 -3
- package/types/plugin/tableview/options.d.ts +1 -1
package/src/module/util.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {pointer as d3Pointer} from "d3-selection";
|
|
|
7
7
|
import {brushSelection as d3BrushSelection} from "d3-brush";
|
|
8
8
|
import {d3Selection} from "../../types/types";
|
|
9
9
|
import {document, window} from "./browser";
|
|
10
|
-
import CLASS from "../config/classes";
|
|
11
10
|
|
|
12
11
|
export {
|
|
13
12
|
asHalfPixel,
|
|
@@ -284,7 +283,7 @@ function getBrushSelection(ctx) {
|
|
|
284
283
|
if (event && event.type === "brush") {
|
|
285
284
|
selection = event.selection;
|
|
286
285
|
// check from brush area selection
|
|
287
|
-
} else if (main && (selection = main.select(
|
|
286
|
+
} else if (main && (selection = main.select(".bb-brush").node())) {
|
|
288
287
|
selection = d3BrushSelection(selection);
|
|
289
288
|
}
|
|
290
289
|
|
|
@@ -731,21 +730,28 @@ function isTabVisible(): boolean {
|
|
|
731
730
|
* @private
|
|
732
731
|
*/
|
|
733
732
|
function convertInputType(mouse: boolean, touch: boolean): "mouse" | "touch" | null {
|
|
734
|
-
let
|
|
733
|
+
let hasTouch = false;
|
|
735
734
|
|
|
736
|
-
|
|
737
|
-
if (/Mobi/.test(window.navigator.userAgent) && touch) {
|
|
735
|
+
if (touch) {
|
|
738
736
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
739
|
-
|
|
737
|
+
if (window.navigator && "maxTouchPoints" in window.navigator) {
|
|
738
|
+
hasTouch = window.navigator.maxTouchPoints > 0;
|
|
740
739
|
|
|
741
740
|
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
742
741
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
742
|
+
} else if ("ontouchmove" in window || (window.DocumentTouch && document instanceof window.DocumentTouch)) {
|
|
743
|
+
hasTouch = true;
|
|
744
|
+
} else {
|
|
745
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
746
|
+
const mQ = window.matchMedia && matchMedia("(pointer:coarse)");
|
|
747
|
+
|
|
748
|
+
if (mQ && mQ.media === "(pointer:coarse)") {
|
|
749
|
+
hasTouch = !!mQ.matches;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
746
752
|
}
|
|
747
753
|
|
|
748
|
-
const hasMouse = mouse && !
|
|
754
|
+
const hasMouse = mouse && !hasTouch ? ("onmouseover" in window) : false;
|
|
749
755
|
|
|
750
|
-
return (hasMouse && "mouse") || (
|
|
756
|
+
return (hasMouse && "mouse") || (hasTouch && "touch") || null;
|
|
751
757
|
}
|
package/types/axis.d.ts
CHANGED
|
@@ -94,10 +94,10 @@ export interface xAxisConfiguration extends AxisConfigurationBase {
|
|
|
94
94
|
* Set default extent for subchart and zoom.
|
|
95
95
|
* This can be an array or function that returns an array.
|
|
96
96
|
*/
|
|
97
|
-
extent?: number
|
|
97
|
+
extent?: Array<number|string> | (
|
|
98
98
|
(
|
|
99
99
|
this: Chart,
|
|
100
|
-
domain: Date|string|number
|
|
100
|
+
domain: Array<Date|string|number>,
|
|
101
101
|
scale: (value: any) => number
|
|
102
102
|
) => number[]
|
|
103
103
|
);
|
|
@@ -197,14 +197,21 @@ export interface XTickConfiguration {
|
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* Setting for culling ticks.
|
|
200
|
-
*
|
|
201
|
-
*
|
|
200
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.
|
|
201
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
202
|
+
* - `false`: all of ticks will be shown.
|
|
203
|
+
* The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
|
|
202
204
|
*/
|
|
203
205
|
culling?: boolean | {
|
|
204
206
|
/**
|
|
205
207
|
* The number of tick texts will be adjusted to less than this value.
|
|
206
208
|
*/
|
|
207
209
|
max?: number;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
213
|
+
*/
|
|
214
|
+
lines?: boolean;
|
|
208
215
|
};
|
|
209
216
|
|
|
210
217
|
/**
|
|
@@ -226,7 +233,7 @@ export interface XTickConfiguration {
|
|
|
226
233
|
* If this option is provided, the position of the ticks will be determined based on those values.
|
|
227
234
|
* This option works with timeseries data and the x values will be parsed accoding to the type of the value and data.xFormat option.
|
|
228
235
|
*/
|
|
229
|
-
values?: number
|
|
236
|
+
values?: Array<number|string> | ((this: Chart) => number[]);
|
|
230
237
|
|
|
231
238
|
/**
|
|
232
239
|
* Rotate x axis tick text.
|
|
@@ -334,14 +341,21 @@ export interface YTickConfiguration {
|
|
|
334
341
|
|
|
335
342
|
/**
|
|
336
343
|
* Setting for culling ticks.
|
|
337
|
-
*
|
|
338
|
-
*
|
|
344
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.
|
|
345
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.[y|y2].tick.culling.lines=false`.
|
|
346
|
+
* - `false`: all of ticks will be shown.
|
|
347
|
+
* The number of ticks to be shown can be chaned by `axis.[y|y2].tick.culling.max`.
|
|
339
348
|
*/
|
|
340
349
|
culling?: boolean | {
|
|
341
350
|
/**
|
|
342
351
|
* The number of tick texts will be adjusted to less than this value.
|
|
343
352
|
*/
|
|
344
353
|
max?: number;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
357
|
+
*/
|
|
358
|
+
lines?: boolean;
|
|
345
359
|
};
|
|
346
360
|
|
|
347
361
|
/**
|
|
@@ -400,6 +414,6 @@ export interface AxesConfiguration {
|
|
|
400
414
|
/**
|
|
401
415
|
* Set tick values manually
|
|
402
416
|
*/
|
|
403
|
-
values?: number|string|Date
|
|
417
|
+
values?: Array<number|string|Date>;
|
|
404
418
|
};
|
|
405
419
|
}
|
package/types/chart.d.ts
CHANGED
|
@@ -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 | number }] | {[key: string]: string
|
|
350
|
+
json?: [{ [key: string]: string | number }] | {[key: string]: Array<string|number>};
|
|
351
351
|
rows?: PrimitiveArray[];
|
|
352
352
|
columns?: PrimitiveArray[];
|
|
353
353
|
data?: Array<{ [key: string]: number }>;
|
package/types/options.d.ts
CHANGED
|
@@ -275,31 +275,6 @@ export interface ChartOptions {
|
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
bar?: {
|
|
278
|
-
/**
|
|
279
|
-
* Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
|
|
280
|
-
*/
|
|
281
|
-
width?: number | {
|
|
282
|
-
/**
|
|
283
|
-
* Set the width of each bar by ratio
|
|
284
|
-
*/
|
|
285
|
-
ratio: number;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Set max width of each bar
|
|
289
|
-
*/
|
|
290
|
-
max?: number;
|
|
291
|
-
} | {
|
|
292
|
-
/**
|
|
293
|
-
* Set the width option for specific dataset
|
|
294
|
-
*/
|
|
295
|
-
[key: string]: number | {
|
|
296
|
-
ratio: number;
|
|
297
|
-
max: number;
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
headers?: Array<{ [key: string]: string; }>;
|
|
302
|
-
|
|
303
278
|
/**
|
|
304
279
|
* Set threshold ratio to show/hide labels.
|
|
305
280
|
*/
|
|
@@ -308,14 +283,11 @@ export interface ChartOptions {
|
|
|
308
283
|
}
|
|
309
284
|
|
|
310
285
|
/**
|
|
311
|
-
*
|
|
312
|
-
*/
|
|
313
|
-
zerobased?: boolean;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Set space between bars in bar charts
|
|
286
|
+
* Remove nullish data on bar indices positions.
|
|
317
287
|
*/
|
|
318
|
-
|
|
288
|
+
indices?: {
|
|
289
|
+
removeNull?: boolean;
|
|
290
|
+
}
|
|
319
291
|
|
|
320
292
|
/**
|
|
321
293
|
* The padding pixel value between each bar.
|
|
@@ -337,6 +309,34 @@ export interface ChartOptions {
|
|
|
337
309
|
* The senstivity offset value for interaction boundary.
|
|
338
310
|
*/
|
|
339
311
|
sensitivity?: number;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
|
|
315
|
+
*/
|
|
316
|
+
width?: number | {
|
|
317
|
+
/**
|
|
318
|
+
* Set the width of each bar by ratio
|
|
319
|
+
*/
|
|
320
|
+
ratio: number;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Set max width of each bar
|
|
324
|
+
*/
|
|
325
|
+
max?: number;
|
|
326
|
+
} | {
|
|
327
|
+
/**
|
|
328
|
+
* Set the width option for specific dataset
|
|
329
|
+
*/
|
|
330
|
+
[key: string]: number | {
|
|
331
|
+
ratio: number;
|
|
332
|
+
max: number;
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Set if min or max value will be 0 on bar chart.
|
|
338
|
+
*/
|
|
339
|
+
zerobased?: boolean;
|
|
340
340
|
};
|
|
341
341
|
|
|
342
342
|
bubble?: {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import {Plugin} from "../plugin";
|
|
6
|
-
import {
|
|
6
|
+
import {TableViewOptions} from "./options";
|
|
7
7
|
|
|
8
|
-
export default class
|
|
8
|
+
export default class TableView extends Plugin {
|
|
9
9
|
/**
|
|
10
10
|
* Generate stanford diagram
|
|
11
11
|
*/
|
|
12
|
-
constructor(options?:
|
|
12
|
+
constructor(options?: TableViewOptions);
|
|
13
13
|
}
|