billboard.js 3.17.4 → 3.18.0-next.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/CONTRIBUTING.md +12 -12
- package/README.md +12 -12
- package/dist/billboard.css +15 -1
- package/dist/billboard.js +1146 -463
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +1147 -464
- package/dist/billboard.pkgd.min.js +21 -21
- 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 +117 -26
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +119 -28
- package/dist/plugin/billboardjs-plugin-stanford.min.js +10 -10
- package/dist/plugin/billboardjs-plugin-tableview.js +117 -27
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +116 -26
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +117 -26
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +120 -29
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +117 -27
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -12
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +116 -26
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
- package/dist/theme/dark.css +15 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +15 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +15 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +15 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +15 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/billboard.js +1467 -536
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +5 -4
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +94 -16
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +38 -37
- package/src/Chart/Chart.ts +1 -1
- package/src/Chart/api/chart.ts +5 -5
- package/src/Chart/api/data.ts +2 -1
- package/src/Chart/api/export.ts +1 -1
- package/src/Chart/api/flow.ts +1 -1
- package/src/Chart/api/load.ts +3 -3
- package/src/Chart/api/subchart.ts +3 -3
- package/src/Chart/api/tooltip.ts +1 -1
- package/src/Chart/api/zoom.ts +1 -1
- package/src/ChartInternal/Axis/Axis.ts +1 -1
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +3 -2
- package/src/ChartInternal/data/IData.ts +3 -0
- package/src/ChartInternal/data/convert.helper.ts +1 -1
- package/src/ChartInternal/data/convert.ts +9 -8
- package/src/ChartInternal/data/data.ts +135 -17
- package/src/ChartInternal/data/load.ts +8 -8
- package/src/ChartInternal/interactions/drag.ts +53 -42
- package/src/ChartInternal/interactions/eventrect.ts +15 -5
- package/src/ChartInternal/interactions/flow.ts +1 -1
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/interactions/zoom.ts +24 -20
- package/src/ChartInternal/internals/color.ts +27 -10
- package/src/ChartInternal/internals/domain.ts +22 -5
- package/src/ChartInternal/internals/format.ts +4 -4
- package/src/ChartInternal/internals/grid.ts +11 -11
- package/src/ChartInternal/internals/legend.ts +80 -19
- package/src/ChartInternal/internals/scale.ts +6 -6
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/style.ts +3 -3
- package/src/ChartInternal/internals/text.arc.ts +304 -0
- package/src/ChartInternal/internals/text.ts +44 -14
- package/src/ChartInternal/internals/text.util.ts +19 -0
- package/src/ChartInternal/internals/title.ts +3 -3
- package/src/ChartInternal/internals/tooltip.ts +23 -15
- package/src/ChartInternal/shape/arc.ts +174 -71
- package/src/ChartInternal/shape/area.ts +2 -2
- package/src/ChartInternal/shape/bar.ts +7 -6
- package/src/ChartInternal/shape/candlestick.ts +3 -3
- package/src/ChartInternal/shape/funnel.ts +18 -18
- package/src/ChartInternal/shape/line.ts +9 -10
- package/src/ChartInternal/shape/point.common.ts +24 -6
- package/src/ChartInternal/shape/radar.ts +4 -4
- package/src/ChartInternal/shape/shape.ts +24 -6
- package/src/ChartInternal/shape/treemap.ts +19 -5
- package/src/Plugin/stanford/Options.ts +2 -2
- package/src/Plugin/tableview/Options.ts +1 -1
- package/src/config/Options/axis/axis.ts +7 -7
- package/src/config/Options/axis/x.ts +6 -6
- package/src/config/Options/axis/y.ts +4 -4
- package/src/config/Options/axis/y2.ts +16 -3
- package/src/config/Options/common/color.ts +2 -2
- package/src/config/Options/common/legend.ts +6 -5
- package/src/config/Options/common/main.ts +23 -23
- package/src/config/Options/common/point.ts +4 -3
- package/src/config/Options/common/tooltip.ts +14 -13
- package/src/config/Options/data/axis.ts +31 -6
- package/src/config/Options/data/data.ts +44 -44
- package/src/config/Options/data/selection.ts +4 -4
- package/src/config/Options/interaction/interaction.ts +2 -1
- package/src/config/Options/interaction/subchart.ts +2 -2
- package/src/config/Options/interaction/zoom.ts +4 -4
- package/src/config/Options/shape/arc.ts +4 -4
- package/src/config/Options/shape/area.ts +1 -1
- package/src/config/Options/shape/bar.ts +4 -4
- package/src/config/Options/shape/bubble.ts +2 -2
- package/src/config/Options/shape/candlestick.ts +1 -1
- package/src/config/Options/shape/donut.ts +34 -3
- package/src/config/Options/shape/gauge.ts +36 -4
- package/src/config/Options/shape/line.ts +1 -1
- package/src/config/Options/shape/pie.ts +34 -3
- package/src/config/Options/shape/polar.ts +35 -4
- package/src/config/Options/shape/radar.ts +1 -1
- package/src/config/Options/shape/scatter.ts +1 -1
- package/src/config/Options/shape/treemap.ts +31 -5
- package/src/config/Store/State.ts +11 -1
- package/src/config/classes.ts +1 -0
- package/src/core.ts +1 -1
- package/src/module/Cache.ts +29 -4
- package/src/module/generator.ts +1 -1
- package/src/module/util.ts +308 -117
- package/src/module/worker.ts +3 -3
- package/src/scss/billboard.scss +15 -0
- package/src/scss/theme/dark.scss +15 -0
- package/src/scss/theme/datalab.scss +15 -0
- package/src/scss/theme/graph.scss +15 -0
- package/src/scss/theme/insight.scss +15 -0
- package/src/scss/theme/modern.scss +15 -0
- package/types/axis.d.ts +3 -3
- package/types/chart.d.ts +4 -4
- package/types/options.d.ts +22 -9
- package/types/options.shape.d.ts +59 -2
|
@@ -12,7 +12,7 @@ import {isFunction, isObjectType, notEmpty, sanitize, toArray} from "../../modul
|
|
|
12
12
|
* @returns {boolean}
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
function
|
|
15
|
+
function _hasValidPointDrawMethods(point: string): boolean {
|
|
16
16
|
return isObjectType(point) &&
|
|
17
17
|
isFunction(point.create) && isFunction(point.update);
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ function hasValidPointDrawMethods(point: string): boolean {
|
|
|
23
23
|
* @param {string} id Point id
|
|
24
24
|
* @private
|
|
25
25
|
*/
|
|
26
|
-
function
|
|
26
|
+
function _insertPointInfoDefs(point: string, id: string): void {
|
|
27
27
|
const $$ = this;
|
|
28
28
|
const copyAttr = (from, target) => {
|
|
29
29
|
const attribs = from.attributes;
|
|
@@ -67,6 +67,8 @@ export default {
|
|
|
67
67
|
* @private
|
|
68
68
|
*/
|
|
69
69
|
hasValidPointType(type?: string): boolean {
|
|
70
|
+
// For point.pattern, allow additional SVG shape tags (polygon, ellipse, use)
|
|
71
|
+
// These will be sanitized before use
|
|
70
72
|
return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type);
|
|
71
73
|
},
|
|
72
74
|
|
|
@@ -87,16 +89,32 @@ export default {
|
|
|
87
89
|
return `${datetimeId}-point${id}`;
|
|
88
90
|
},
|
|
89
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Get validated point pattern array
|
|
94
|
+
* @returns {Array} Array of point types
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
getValidPointPattern(): string[] {
|
|
98
|
+
const {config} = this;
|
|
99
|
+
|
|
100
|
+
// Ensure point_type is restricted to 'circle' or 'rectangle' only
|
|
101
|
+
const validPointType = /^(circle|rect(angle)?)$/i.test(config.point_type) ?
|
|
102
|
+
config.point_type :
|
|
103
|
+
"circle";
|
|
104
|
+
|
|
105
|
+
return notEmpty(config.point_pattern) ? config.point_pattern : [validPointType];
|
|
106
|
+
},
|
|
107
|
+
|
|
90
108
|
/**
|
|
91
109
|
* Get generate point function
|
|
92
|
-
* @returns {
|
|
110
|
+
* @returns {function}
|
|
93
111
|
* @private
|
|
94
112
|
*/
|
|
95
113
|
generatePoint(): Function {
|
|
96
114
|
const $$ = this;
|
|
97
115
|
const {$el, config} = $$;
|
|
98
116
|
const ids: string[] = [];
|
|
99
|
-
const pattern =
|
|
117
|
+
const pattern = $$.getValidPointPattern();
|
|
100
118
|
|
|
101
119
|
return function(method, context, ...args) {
|
|
102
120
|
return function(d) {
|
|
@@ -109,12 +127,12 @@ export default {
|
|
|
109
127
|
|
|
110
128
|
if ($$.hasValidPointType(point)) {
|
|
111
129
|
point = $$[point];
|
|
112
|
-
} else if (!
|
|
130
|
+
} else if (!_hasValidPointDrawMethods(point || config.point_type)) {
|
|
113
131
|
const pointId = $$.getDefsPointId(id);
|
|
114
132
|
const defsPoint = $el.defs.select(`#${pointId}`);
|
|
115
133
|
|
|
116
134
|
if (defsPoint.size() < 1) {
|
|
117
|
-
|
|
135
|
+
_insertPointInfoDefs.call($$, point, pointId);
|
|
118
136
|
}
|
|
119
137
|
|
|
120
138
|
if (method === "create") {
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
* @returns {number}
|
|
30
30
|
* @private
|
|
31
31
|
*/
|
|
32
|
-
function
|
|
32
|
+
function _getPosition(isClockwise: boolean, type: "x" | "y", edge: number, pos: number,
|
|
33
33
|
range: number, ratio: number): number {
|
|
34
34
|
const index = isClockwise && pos > 0 ? edge - pos : pos;
|
|
35
35
|
const r = 2 * Math.PI;
|
|
@@ -105,7 +105,7 @@ export default {
|
|
|
105
105
|
const isClockwise = config.radar_direction_clockwise;
|
|
106
106
|
|
|
107
107
|
const pos = toArray(type).map(v =>
|
|
108
|
-
|
|
108
|
+
_getPosition(
|
|
109
109
|
isClockwise,
|
|
110
110
|
v,
|
|
111
111
|
edge,
|
|
@@ -373,11 +373,11 @@ export default {
|
|
|
373
373
|
|
|
374
374
|
$$.selectRectForSingle(svg.node(), index);
|
|
375
375
|
isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
|
|
376
|
-
})
|
|
376
|
+
}, isMouse ? undefined : {passive: true})
|
|
377
377
|
.on("mouseout", isMouse ? hide : null);
|
|
378
378
|
|
|
379
379
|
if (!isMouse) {
|
|
380
|
-
svg.on("touchstart", hide);
|
|
380
|
+
svg.on("touchstart", hide, {passive: true});
|
|
381
381
|
}
|
|
382
382
|
},
|
|
383
383
|
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
} from "d3-shape";
|
|
26
26
|
import type {d3Selection} from "../../../types/types";
|
|
27
27
|
import CLASS from "../../config/classes";
|
|
28
|
+
import {KEY} from "../../module/Cache";
|
|
28
29
|
import {
|
|
29
30
|
capitalize,
|
|
30
31
|
getBBox,
|
|
@@ -45,10 +46,10 @@ import type {IDataIndice, IDataRow, TIndices} from "../data/IData";
|
|
|
45
46
|
* Get grouped data point function for y coordinate
|
|
46
47
|
* - Note: Grouped(stacking) works only for line and bar types
|
|
47
48
|
* @param {object} d data vlaue
|
|
48
|
-
* @returns {
|
|
49
|
+
* @returns {function|undefined}
|
|
49
50
|
* @private
|
|
50
51
|
*/
|
|
51
|
-
function
|
|
52
|
+
function _getGroupedDataPointsFn(d) {
|
|
52
53
|
const $$ = this;
|
|
53
54
|
let fn;
|
|
54
55
|
|
|
@@ -128,7 +129,7 @@ export default {
|
|
|
128
129
|
* data2 data4 data2 data4
|
|
129
130
|
* -------------------------
|
|
130
131
|
* 0 1
|
|
131
|
-
* @param {
|
|
132
|
+
* @param {function} typeFilter Chart type filter function
|
|
132
133
|
* @returns {object} Indices object with its position
|
|
133
134
|
*/
|
|
134
135
|
getShapeIndices(typeFilter): TIndices {
|
|
@@ -318,7 +319,7 @@ export default {
|
|
|
318
319
|
|
|
319
320
|
/**
|
|
320
321
|
* Get Shape's offset data
|
|
321
|
-
* @param {
|
|
322
|
+
* @param {function} typeFilter Type filter function
|
|
322
323
|
* @returns {object}
|
|
323
324
|
* @private
|
|
324
325
|
*/
|
|
@@ -327,6 +328,18 @@ export default {
|
|
|
327
328
|
const targets = $$.orderTargets(
|
|
328
329
|
$$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
|
|
329
330
|
);
|
|
331
|
+
|
|
332
|
+
// Create cache key based on target IDs
|
|
333
|
+
const targetIds = targets.map(t => t.id).join("_");
|
|
334
|
+
const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
|
|
335
|
+
|
|
336
|
+
// Check if result is already cached
|
|
337
|
+
const cachedData = $$.cache.get(cacheKey);
|
|
338
|
+
|
|
339
|
+
if (cachedData) {
|
|
340
|
+
return cachedData;
|
|
341
|
+
}
|
|
342
|
+
|
|
330
343
|
const isStackNormalized = $$.isStackNormalized();
|
|
331
344
|
|
|
332
345
|
const shapeOffsetTargets = targets.map(target => {
|
|
@@ -358,7 +371,12 @@ export default {
|
|
|
358
371
|
return out;
|
|
359
372
|
}, {});
|
|
360
373
|
|
|
361
|
-
|
|
374
|
+
const result = {indexMapByTargetId, shapeOffsetTargets};
|
|
375
|
+
|
|
376
|
+
// Cache the result
|
|
377
|
+
$$.cache.add(cacheKey, result);
|
|
378
|
+
|
|
379
|
+
return result;
|
|
362
380
|
},
|
|
363
381
|
|
|
364
382
|
getShapeOffset(typeFilter, indices, isSub?: boolean): Function {
|
|
@@ -435,7 +453,7 @@ export default {
|
|
|
435
453
|
let points;
|
|
436
454
|
|
|
437
455
|
if ($$.isGrouped(id)) {
|
|
438
|
-
points =
|
|
456
|
+
points = _getGroupedDataPointsFn.bind($$)(d);
|
|
439
457
|
}
|
|
440
458
|
|
|
441
459
|
return points ? points(d, i)[0][1] : $$.getYScaleById(id)($$.getBaseValue(d));
|
|
@@ -144,7 +144,7 @@ export default {
|
|
|
144
144
|
$$.showTooltip([data], event.currentTarget);
|
|
145
145
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
146
146
|
}
|
|
147
|
-
})
|
|
147
|
+
}, isTouch ? {passive: true} : undefined)
|
|
148
148
|
.on(isTouch ? "touchend" : "mouseout", event => {
|
|
149
149
|
const data = getTarget(event);
|
|
150
150
|
|
|
@@ -158,7 +158,7 @@ export default {
|
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* Get tiling function
|
|
161
|
-
* @returns {
|
|
161
|
+
* @returns {function}
|
|
162
162
|
* @private
|
|
163
163
|
*/
|
|
164
164
|
getTreemapTile() {
|
|
@@ -291,12 +291,12 @@ export default {
|
|
|
291
291
|
/**
|
|
292
292
|
* Get treemap data label format function
|
|
293
293
|
* @param {object} d Data object
|
|
294
|
-
* @returns {
|
|
294
|
+
* @returns {function} Label formatter function
|
|
295
295
|
* @private
|
|
296
296
|
*/
|
|
297
297
|
treemapDataLabelFormat(d: IDataRow): Function {
|
|
298
298
|
const $$ = this;
|
|
299
|
-
const {config} = $$;
|
|
299
|
+
const {$el: {treemap}, config, scale: {x, y}} = $$;
|
|
300
300
|
const {id, value} = d;
|
|
301
301
|
const format = config.treemap_label_format;
|
|
302
302
|
const ratio = $$.getRatio("treemap", d);
|
|
@@ -306,11 +306,25 @@ export default {
|
|
|
306
306
|
null :
|
|
307
307
|
"0";
|
|
308
308
|
|
|
309
|
+
// Get treemap dimensions for the specific data
|
|
310
|
+
const treemapNode = treemap.selectAll("g")
|
|
311
|
+
.filter(node => node.data.id === id)
|
|
312
|
+
.datum();
|
|
313
|
+
|
|
314
|
+
let width = 0;
|
|
315
|
+
let height = 0;
|
|
316
|
+
|
|
317
|
+
if (treemapNode) {
|
|
318
|
+
const {x0, x1, y0, y1} = treemapNode;
|
|
319
|
+
width = x(x1) - x(x0);
|
|
320
|
+
height = y(y1) - y(y0);
|
|
321
|
+
}
|
|
322
|
+
|
|
309
323
|
return function(node) {
|
|
310
324
|
node.style("opacity", meetLabelThreshold);
|
|
311
325
|
|
|
312
326
|
return isFunction(format) ?
|
|
313
|
-
format.bind($$.api)(value, ratio, id) :
|
|
327
|
+
format.bind($$.api)(value, ratio, id, {width, height}) :
|
|
314
328
|
`${id}\n${percentValue}%`;
|
|
315
329
|
};
|
|
316
330
|
}
|
|
@@ -17,7 +17,7 @@ export default class Options {
|
|
|
17
17
|
* Set the color of the color scale. This function receives a value between 0 and 1, and should return a color.
|
|
18
18
|
* @name colors
|
|
19
19
|
* @memberof plugin-stanford
|
|
20
|
-
* @type {
|
|
20
|
+
* @type {function}
|
|
21
21
|
* @default undefined
|
|
22
22
|
* @example
|
|
23
23
|
* colors: d3.interpolateHslLong(
|
|
@@ -68,7 +68,7 @@ export default class Options {
|
|
|
68
68
|
* @property {number} [scale.min=undefined] Minimum value of the color scale. Default: lowest value in epochs
|
|
69
69
|
* @property {number} [scale.max=undefined] Maximum value of the color scale. Default: highest value in epochs
|
|
70
70
|
* @property {number} [scale.width=20] Width of the color scale
|
|
71
|
-
* @property {string|
|
|
71
|
+
* @property {string|function} [scale.format=undefined] Format of the axis of the color scale. Use 'pow10' to format as powers of 10 or a custom function. Example: d3.format("d")
|
|
72
72
|
* @example
|
|
73
73
|
* scale: {
|
|
74
74
|
* max: 10000,
|
|
@@ -40,7 +40,7 @@ export default class Options {
|
|
|
40
40
|
* Set category text format function.
|
|
41
41
|
* @name categoryFormat
|
|
42
42
|
* @memberof plugin-tableview
|
|
43
|
-
* @type {
|
|
43
|
+
* @type {function}
|
|
44
44
|
* @returns {string}
|
|
45
45
|
* @default function(v) { // will return formatted value according x Axis type }}
|
|
46
46
|
* @example
|
|
@@ -13,16 +13,16 @@ export default {
|
|
|
13
13
|
/**
|
|
14
14
|
* Setup the way to evaluate tick text size.
|
|
15
15
|
* - **NOTE:**
|
|
16
|
-
* -
|
|
16
|
+
* - When setting `false` or a custom evaluator, it is highly recommended to memoize evaluated text dimension value to not degrade performance.
|
|
17
17
|
* @name axis․evalTextSize
|
|
18
18
|
* @memberof Options
|
|
19
|
-
* @type {boolean|
|
|
19
|
+
* @type {boolean|function}
|
|
20
20
|
* @default true
|
|
21
21
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
|
|
22
22
|
* @example
|
|
23
23
|
* axis: {
|
|
24
24
|
* // will evaluate getting text size every time.
|
|
25
|
-
* evalTextSize: false
|
|
25
|
+
* evalTextSize: false,
|
|
26
26
|
*
|
|
27
27
|
* // set a custom evaluator
|
|
28
28
|
* evalTextSize: function(textElement, axisId) {
|
|
@@ -71,8 +71,8 @@ export default {
|
|
|
71
71
|
* Set axis tooltip.
|
|
72
72
|
* - **NOTE:**
|
|
73
73
|
* - When enabled, will disable default focus grid line.
|
|
74
|
-
* - For `timeseries` x Axis,
|
|
75
|
-
* - For `category` x Axis,
|
|
74
|
+
* - For `timeseries` x Axis, tooltip will be formatted using x Axis' tick format.
|
|
75
|
+
* - For `category` x Axis, tooltip will be displaying scales' value text.
|
|
76
76
|
* @name axis․tooltip
|
|
77
77
|
* @memberof Options
|
|
78
78
|
* @type {boolean}
|
|
@@ -85,11 +85,11 @@ export default {
|
|
|
85
85
|
* axis: {
|
|
86
86
|
* tooltip: true, // default background color is
|
|
87
87
|
*
|
|
88
|
-
* // set
|
|
88
|
+
* // set background color for axis tooltip texts
|
|
89
89
|
* tooltip: {
|
|
90
90
|
* backgroundColor: "red",
|
|
91
91
|
*
|
|
92
|
-
* // set
|
|
92
|
+
* // set different background colors per axes
|
|
93
93
|
* // NOTE: In this case, only specified axes tooltip will appear.
|
|
94
94
|
* backgroundColor: {
|
|
95
95
|
* x: "green",
|
|
@@ -139,7 +139,7 @@ export default {
|
|
|
139
139
|
* A function to format tick value. Format string is also available for timeseries data.
|
|
140
140
|
* @name axis․x․tick․format
|
|
141
141
|
* @memberof Options
|
|
142
|
-
* @type {
|
|
142
|
+
* @type {function|string}
|
|
143
143
|
* @default undefined
|
|
144
144
|
* @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
|
|
145
145
|
* @example
|
|
@@ -169,7 +169,7 @@ export default {
|
|
|
169
169
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
170
170
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
171
171
|
* - `false`: all of ticks will be shown.<br><br>
|
|
172
|
-
* The number of ticks to be shown can be
|
|
172
|
+
* The number of ticks to be shown can be changed by `axis.x.tick.culling.max`.
|
|
173
173
|
* @name axis․x․tick․culling
|
|
174
174
|
* @memberof Options
|
|
175
175
|
* @type {boolean}
|
|
@@ -391,10 +391,10 @@ export default {
|
|
|
391
391
|
/**
|
|
392
392
|
* Set the x values of ticks manually.<br><br>
|
|
393
393
|
* If this option is provided, the position of the ticks will be determined based on those values.<br>
|
|
394
|
-
* This option works with `timeseries` data and the x values will be parsed
|
|
394
|
+
* This option works with `timeseries` data and the x values will be parsed according to the type of the value and data.xFormat option.
|
|
395
395
|
* @name axis․x․tick․values
|
|
396
396
|
* @memberof Options
|
|
397
|
-
* @type {Array|
|
|
397
|
+
* @type {Array|function}
|
|
398
398
|
* @default null
|
|
399
399
|
* @example
|
|
400
400
|
* axis: {
|
|
@@ -625,7 +625,7 @@ export default {
|
|
|
625
625
|
* - **timeseries:** Numeric time value
|
|
626
626
|
* ex. the given value `1000*60*60*24`, which is numeric time equivalent of a day, is same as the width of 1 tick width
|
|
627
627
|
* - If want values to be treated as pixels, specify `unit:"px"`.
|
|
628
|
-
* - The pixel value will be
|
|
628
|
+
* - The pixel value will be converted based on the scale values. Hence can not reflect accurate padding result.
|
|
629
629
|
* @name axis․x․padding
|
|
630
630
|
* @memberof Options
|
|
631
631
|
* @type {object|number}
|
|
@@ -678,7 +678,7 @@ export default {
|
|
|
678
678
|
* - **NOTE:** Specifying value, will limit the zoom scope selection within.
|
|
679
679
|
* @name axis․x․extent
|
|
680
680
|
* @memberof Options
|
|
681
|
-
* @type {Array|
|
|
681
|
+
* @type {Array|function}
|
|
682
682
|
* @default undefined
|
|
683
683
|
* @example
|
|
684
684
|
* axis: {
|
|
@@ -172,7 +172,7 @@ export default {
|
|
|
172
172
|
* This option accepts d3.format object as well as a function you define.
|
|
173
173
|
* @name axis․y․tick․format
|
|
174
174
|
* @memberof Options
|
|
175
|
-
* @type {
|
|
175
|
+
* @type {function}
|
|
176
176
|
* @default undefined
|
|
177
177
|
* @example
|
|
178
178
|
* axis: {
|
|
@@ -192,7 +192,7 @@ export default {
|
|
|
192
192
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
193
193
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
194
194
|
* - `false`: all of ticks will be shown.<br><br>
|
|
195
|
-
* The number of ticks to be shown can be
|
|
195
|
+
* The number of ticks to be shown can be changed by `axis.y.tick.culling.max`.
|
|
196
196
|
* @name axis․y․tick․culling
|
|
197
197
|
* @memberof Options
|
|
198
198
|
* @type {boolean}
|
|
@@ -304,7 +304,7 @@ export default {
|
|
|
304
304
|
* Set y axis tick values manually.
|
|
305
305
|
* @name axis․y․tick․values
|
|
306
306
|
* @memberof Options
|
|
307
|
-
* @type {Array|
|
|
307
|
+
* @type {Array|function}
|
|
308
308
|
* @default null
|
|
309
309
|
* @example
|
|
310
310
|
* axis: {
|
|
@@ -447,7 +447,7 @@ export default {
|
|
|
447
447
|
* @private
|
|
448
448
|
* @type {object}
|
|
449
449
|
* @property {object} time time object
|
|
450
|
-
* @property {
|
|
450
|
+
* @property {function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
|
|
451
451
|
* @example
|
|
452
452
|
* axis: {
|
|
453
453
|
* y: {
|
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
* y2 Axis config options
|
|
7
7
|
*/
|
|
8
8
|
export default {
|
|
9
|
+
/**
|
|
10
|
+
* Set clip-path attribute for y2 axis element
|
|
11
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
12
|
+
* @name axis․y2․clipPath
|
|
13
|
+
* @memberof Options
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
* @default true
|
|
16
|
+
* @example
|
|
17
|
+
* // don't set 'clip-path' attribute
|
|
18
|
+
* clipPath: false
|
|
19
|
+
*/
|
|
20
|
+
axis_y2_clipPath: true,
|
|
21
|
+
|
|
9
22
|
/**
|
|
10
23
|
* Show or hide y2 axis.
|
|
11
24
|
* - **NOTE**:
|
|
@@ -159,7 +172,7 @@ export default {
|
|
|
159
172
|
* This option works in the same way as axis.y.format.
|
|
160
173
|
* @name axis․y2․tick․format
|
|
161
174
|
* @memberof Options
|
|
162
|
-
* @type {
|
|
175
|
+
* @type {function}
|
|
163
176
|
* @default undefined
|
|
164
177
|
* @example
|
|
165
178
|
* axis: {
|
|
@@ -178,7 +191,7 @@ export default {
|
|
|
178
191
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
179
192
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
180
193
|
* - `false`: all of ticks will be shown.<br><br>
|
|
181
|
-
* The number of ticks to be shown can be
|
|
194
|
+
* The number of ticks to be shown can be changed by `axis.y2.tick.culling.max`.
|
|
182
195
|
* @name axis․y2․tick․culling
|
|
183
196
|
* @memberof Options
|
|
184
197
|
* @type {boolean}
|
|
@@ -291,7 +304,7 @@ export default {
|
|
|
291
304
|
* Set y2 axis tick values manually.
|
|
292
305
|
* @name axis․y2․tick․values
|
|
293
306
|
* @memberof Options
|
|
294
|
-
* @type {Array|
|
|
307
|
+
* @type {Array|function}
|
|
295
308
|
* @default null
|
|
296
309
|
* @example
|
|
297
310
|
* axis: {
|
|
@@ -12,9 +12,9 @@ export default {
|
|
|
12
12
|
* @memberof Options
|
|
13
13
|
* @type {object}
|
|
14
14
|
* @property {object} color color object
|
|
15
|
-
* @property {string|object|
|
|
15
|
+
* @property {string|object|((this: Chart, d: DataItem) => string)} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
|
|
16
16
|
* @property {Array|null} [color.pattern=[]] Set custom color pattern. Passing `null` will not set a color for these elements, which requires the usage of custom CSS-based theming to work.
|
|
17
|
-
* @property {
|
|
17
|
+
* @property {(this: Chart) => SVGPathElement[]} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement).
|
|
18
18
|
* - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.<br>
|
|
19
19
|
* ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:<br>
|
|
20
20
|
* - `bb-colorize-pattern-red`
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
* If true given, all legend will be hidden. If string or array given, only the legend that has the id will be hidden.
|
|
18
18
|
* @property {string|HTMLElement} [legend.contents.bindto=undefined] Set CSS selector or element reference to bind legend items.
|
|
19
19
|
* - **NOTE:** Should be used along with `legend.contents.template`.
|
|
20
|
-
* @property {string|
|
|
20
|
+
* @property {string|function} [legend.contents.template="<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>"] Set item's template.<br>
|
|
21
21
|
* - If set `string` value, within template the 'color' and 'title' can be replaced using template-like syntax string:
|
|
22
22
|
* - {=COLOR}: data color value
|
|
23
23
|
* - {=TITLE}: data title value
|
|
@@ -25,6 +25,7 @@ export default {
|
|
|
25
25
|
* - title {string}: data's id value
|
|
26
26
|
* - color {string}: color string
|
|
27
27
|
* - data {Array}: data array
|
|
28
|
+
* - **NOTE:** While basic XSS sanitization is applied, if you're allowing user-provided chart options in a service exposed to other users, you should implement additional security measures to prevent sophisticated XSS attacks.
|
|
28
29
|
* @property {string} [legend.position=bottom] Change the position of legend.<br>
|
|
29
30
|
* Available values are: `bottom`, `right` and `inset` are supported.
|
|
30
31
|
* @property {object} [legend.inset={anchor: 'top-left',x: 10,y: 0,step: undefined}] Change inset legend attributes.<br>
|
|
@@ -51,13 +52,13 @@ export default {
|
|
|
51
52
|
* - To return initial state(which all dataseries are showing), double click current focused legend item again.
|
|
52
53
|
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
53
54
|
* - In this case, default `click` interaction will be disabled.
|
|
54
|
-
* @property {
|
|
55
|
+
* @property {function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
55
56
|
* - **NOTE:**
|
|
56
57
|
* - When set, default `click` interaction will be disabled.
|
|
57
58
|
* - When `interaction.dblclick=true` is set, will be called on double click.
|
|
58
|
-
* @property {
|
|
59
|
+
* @property {function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
59
60
|
* - **NOTE:** When set, default `mouseover` interaction will be disabled.
|
|
60
|
-
* @property {
|
|
61
|
+
* @property {function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
61
62
|
* - **NOTE:** When set, default `mouseout` interaction will be disabled.
|
|
62
63
|
* @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
|
|
63
64
|
* @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
|
|
@@ -134,7 +135,7 @@ export default {
|
|
|
134
135
|
* width: 15,
|
|
135
136
|
* height: 15
|
|
136
137
|
*
|
|
137
|
-
* //
|
|
138
|
+
* // radius is only applicable for 'circle' legend type
|
|
138
139
|
* r: 10
|
|
139
140
|
* }
|
|
140
141
|
* },
|