billboard.js 3.16.0 → 3.17.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 +4 -4
- package/dist/billboard.js +645 -82
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +12 -12
- package/dist/billboard.pkgd.js +1987 -786
- package/dist/billboard.pkgd.min.js +18 -17
- 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 +18 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +18 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +16 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +16 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1344 -706
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +6 -5
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1454 -800
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +8 -7
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1455 -801
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +13 -12
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1454 -802
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -9
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1455 -803
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -6
- package/dist/theme/dark.css +4 -4
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +4 -4
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +4 -4
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +4 -4
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +4 -4
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +697 -79
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +21 -21
- package/src/ChartInternal/Axis/AxisRenderer.ts +20 -13
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +9 -4
- package/src/ChartInternal/data/convert.ts +3 -3
- package/src/ChartInternal/data/data.ts +2 -2
- package/src/ChartInternal/internals/color.ts +20 -14
- package/src/ChartInternal/internals/text.ts +40 -125
- package/src/ChartInternal/internals/text.util.ts +320 -0
- package/src/ChartInternal/shape/arc.ts +41 -19
- package/src/ChartInternal/shape/treemap.ts +5 -6
- package/src/config/Options/axis/x.ts +18 -0
- package/src/config/Options/axis/y.ts +17 -0
- package/src/config/Options/axis/y2.ts +18 -0
- package/src/config/Options/common/boost.ts +1 -0
- package/src/config/Options/data/data.ts +125 -4
- package/src/config/Options/shape/donut.ts +77 -1
- package/src/config/Options/shape/gauge.ts +69 -2
- package/src/config/Options/shape/pie.ts +68 -1
- package/src/config/Options/shape/polar.ts +68 -1
- package/src/config/classes.ts +2 -0
- package/src/module/util.ts +26 -0
- package/types/axis.d.ts +10 -0
- package/types/options.d.ts +138 -1
- package/types/options.shape.d.ts +302 -2
package/src/config/classes.ts
CHANGED
package/src/module/util.ts
CHANGED
|
@@ -57,6 +57,7 @@ export {
|
|
|
57
57
|
mergeObj,
|
|
58
58
|
notEmpty,
|
|
59
59
|
parseDate,
|
|
60
|
+
parseShorthand,
|
|
60
61
|
runUntil,
|
|
61
62
|
sanitize,
|
|
62
63
|
setTextValue,
|
|
@@ -944,3 +945,28 @@ function runUntil(fn: Function, conditionFn: Function): void {
|
|
|
944
945
|
fn();
|
|
945
946
|
}
|
|
946
947
|
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Parse CSS shorthand values (padding, margin, border-radius, etc.)
|
|
951
|
+
* @param {number|string|object} value Shorthand value(s)
|
|
952
|
+
* @returns {object} Parsed object with top, right, bottom, left properties
|
|
953
|
+
* @private
|
|
954
|
+
*/
|
|
955
|
+
function parseShorthand(
|
|
956
|
+
value: number | string | object
|
|
957
|
+
): {top: number, right: number, bottom: number, left: number} {
|
|
958
|
+
if (isObject(value) && !isString(value)) {
|
|
959
|
+
const obj = value as {top?: number, right?: number, bottom?: number, left?: number};
|
|
960
|
+
return {
|
|
961
|
+
top: obj.top || 0,
|
|
962
|
+
right: obj.right || 0,
|
|
963
|
+
bottom: obj.bottom || 0,
|
|
964
|
+
left: obj.left || 0
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
const values = (isString(value) ? value.trim().split(/\s+/) : [value]).map(v => +v || 0);
|
|
969
|
+
const [a, b = a, c = a, d = b] = values;
|
|
970
|
+
|
|
971
|
+
return {top: a, right: b, bottom: c, left: d};
|
|
972
|
+
}
|
package/types/axis.d.ts
CHANGED
|
@@ -326,6 +326,11 @@ export interface XTickConfiguration {
|
|
|
326
326
|
*/
|
|
327
327
|
show?: boolean;
|
|
328
328
|
|
|
329
|
+
/**
|
|
330
|
+
* Set the axis tick line to be positioned inside of the chart.
|
|
331
|
+
*/
|
|
332
|
+
inner?: boolean;
|
|
333
|
+
|
|
329
334
|
text?: {
|
|
330
335
|
/**
|
|
331
336
|
* Set the x Axis tick text's position relatively its original position
|
|
@@ -429,6 +434,11 @@ export interface YTickConfiguration {
|
|
|
429
434
|
*/
|
|
430
435
|
show?: boolean;
|
|
431
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Set the axis tick line to be positioned inside of the chart.
|
|
439
|
+
*/
|
|
440
|
+
inner?: boolean;
|
|
441
|
+
|
|
432
442
|
text?: {
|
|
433
443
|
/**
|
|
434
444
|
* Set the x Axis tick text's position relatively its original position
|
package/types/options.d.ts
CHANGED
|
@@ -1159,8 +1159,13 @@ export interface Data {
|
|
|
1159
1159
|
|
|
1160
1160
|
/**
|
|
1161
1161
|
* Set label text background colors.
|
|
1162
|
+
* - **NOTE**: When function is set, background colors can be sepcified one color per dataset.
|
|
1163
|
+
* - Within the function, the last returned color for dataset will be used.
|
|
1164
|
+
* - Only can control set or unset background color for each values.
|
|
1162
1165
|
*/
|
|
1163
|
-
backgroundColors?: string |
|
|
1166
|
+
backgroundColors?: string |
|
|
1167
|
+
{ [key: string]: string } |
|
|
1168
|
+
((this: Chart, color: string, d: DataItem) => string);
|
|
1164
1169
|
|
|
1165
1170
|
/**
|
|
1166
1171
|
* Set label text colors.
|
|
@@ -1180,6 +1185,102 @@ export interface Data {
|
|
|
1180
1185
|
*/
|
|
1181
1186
|
format?: FormatFunction | { [key: string]: FormatFunction };
|
|
1182
1187
|
|
|
1188
|
+
/**
|
|
1189
|
+
* Set image URL to be displayed next to the label text.
|
|
1190
|
+
* When function is specified, will receives 3 arguments such as `v, id, i` and it must return a string URL or null.<br><br>
|
|
1191
|
+
* The arguments are:<br>
|
|
1192
|
+
* - `v` is the value of the data point where the label is shown.
|
|
1193
|
+
* - `id` is the id of the data where the label is shown.
|
|
1194
|
+
* - `i` is the index of the data series point where the label is shown.
|
|
1195
|
+
*/
|
|
1196
|
+
imgUrl?: string | ((this: Chart, v: number, id: string, i: number) => string | null);
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Set image to be displayed next to the label text.
|
|
1200
|
+
* When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
|
|
1201
|
+
* The arguments are:<br>
|
|
1202
|
+
* - `v` is the value of the data point where the label is shown.
|
|
1203
|
+
* - `id` is the id of the data where the label is shown.
|
|
1204
|
+
* - `i` is the index of the data series point where the label is shown.
|
|
1205
|
+
* @example
|
|
1206
|
+
* image: {
|
|
1207
|
+
* url: "./sample.svg",
|
|
1208
|
+
* // use placeholder to dynamically set image URL based on data ID
|
|
1209
|
+
* url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
|
|
1210
|
+
* width: 35,
|
|
1211
|
+
* height: 35,
|
|
1212
|
+
* pos: {
|
|
1213
|
+
* x: 0,
|
|
1214
|
+
* y: 0
|
|
1215
|
+
* }
|
|
1216
|
+
* }
|
|
1217
|
+
*
|
|
1218
|
+
* // or use function to return image configuration dynamically
|
|
1219
|
+
* image: function(v, id, i) {
|
|
1220
|
+
* // Return different images based on value
|
|
1221
|
+
* if (v > 500) {
|
|
1222
|
+
* return {
|
|
1223
|
+
* url: "./high-value.svg",
|
|
1224
|
+
* width: 40,
|
|
1225
|
+
* height: 40,
|
|
1226
|
+
* pos: { x: 0, y: 0 }
|
|
1227
|
+
* };
|
|
1228
|
+
* } else if (v > 100) {
|
|
1229
|
+
* return {
|
|
1230
|
+
* url: "./medium-value.svg",
|
|
1231
|
+
* width: 30,
|
|
1232
|
+
* height: 30,
|
|
1233
|
+
* pos: { x: 0, y: 0 }
|
|
1234
|
+
* };
|
|
1235
|
+
* } else if(v < 5) {
|
|
1236
|
+
* // Return null in case don't want to show image
|
|
1237
|
+
* return null;
|
|
1238
|
+
* } else {
|
|
1239
|
+
* return {
|
|
1240
|
+
* url: "./low-value.svg",
|
|
1241
|
+
* width: 20,
|
|
1242
|
+
* height: 20,
|
|
1243
|
+
* pos: { x: 0, y: 0 }
|
|
1244
|
+
* };
|
|
1245
|
+
* }
|
|
1246
|
+
* }
|
|
1247
|
+
*/
|
|
1248
|
+
image?: {
|
|
1249
|
+
/**
|
|
1250
|
+
* Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
|
|
1251
|
+
*/
|
|
1252
|
+
url: string;
|
|
1253
|
+
/**
|
|
1254
|
+
* Image width in pixels.
|
|
1255
|
+
*/
|
|
1256
|
+
width: number;
|
|
1257
|
+
/**
|
|
1258
|
+
* Image height in pixels.
|
|
1259
|
+
*/
|
|
1260
|
+
height: number;
|
|
1261
|
+
/**
|
|
1262
|
+
* Image position relative to the label text.
|
|
1263
|
+
*/
|
|
1264
|
+
pos?: {
|
|
1265
|
+
/**
|
|
1266
|
+
* x coordinate position, relative the original.
|
|
1267
|
+
*/
|
|
1268
|
+
x?: number;
|
|
1269
|
+
/**
|
|
1270
|
+
* y coordinate position, relative the original.
|
|
1271
|
+
*/
|
|
1272
|
+
y?: number;
|
|
1273
|
+
};
|
|
1274
|
+
} | ((this: Chart, v: number, id: string, i: number) => {
|
|
1275
|
+
url: string;
|
|
1276
|
+
width: number;
|
|
1277
|
+
height: number;
|
|
1278
|
+
pos?: {
|
|
1279
|
+
x?: number;
|
|
1280
|
+
y?: number;
|
|
1281
|
+
};
|
|
1282
|
+
} | null);
|
|
1283
|
+
|
|
1183
1284
|
/**
|
|
1184
1285
|
* Set each dataset position, relative the original.
|
|
1185
1286
|
*
|
|
@@ -1219,6 +1320,42 @@ export interface Data {
|
|
|
1219
1320
|
* Rotate label text. Specify degree value in a range of `0 ~ 360`.
|
|
1220
1321
|
*/
|
|
1221
1322
|
rotate?: number;
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* Add border to data label text.
|
|
1326
|
+
* NOTE: When set as `true`, styling aren't applied. Hence, need to set using `.bb-text-border` class.
|
|
1327
|
+
*/
|
|
1328
|
+
border?: boolean | {
|
|
1329
|
+
/**
|
|
1330
|
+
* Border padding. Can be a single number, string or object with top, bottom, left, right properties.
|
|
1331
|
+
*/
|
|
1332
|
+
padding?: number | string | {
|
|
1333
|
+
top?: number;
|
|
1334
|
+
bottom?: number;
|
|
1335
|
+
left?: number;
|
|
1336
|
+
right?: number;
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Border radius value.
|
|
1341
|
+
*/
|
|
1342
|
+
radius?: number;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Border stroke width.
|
|
1346
|
+
*/
|
|
1347
|
+
strokeWidth?: number;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Border stroke color.
|
|
1351
|
+
*/
|
|
1352
|
+
stroke?: string;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Border fill color.
|
|
1356
|
+
*/
|
|
1357
|
+
fill?: string;
|
|
1358
|
+
};
|
|
1222
1359
|
};
|
|
1223
1360
|
|
|
1224
1361
|
/**
|
package/types/options.shape.d.ts
CHANGED
|
@@ -328,6 +328,81 @@ export interface DonutOptions {
|
|
|
328
328
|
* Set threshold ratio to show/hide labels.
|
|
329
329
|
*/
|
|
330
330
|
threshold?: number;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Set image to be displayed next to the label text.
|
|
334
|
+
* @example
|
|
335
|
+
* image: {
|
|
336
|
+
* url: "./sample.svg",
|
|
337
|
+
* // use placeholder to dynamically set image URL based on data ID
|
|
338
|
+
* url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
|
|
339
|
+
* width: 35,
|
|
340
|
+
* height: 35,
|
|
341
|
+
* pos: {
|
|
342
|
+
* x: 0,
|
|
343
|
+
* y: 0
|
|
344
|
+
* }
|
|
345
|
+
* }
|
|
346
|
+
*
|
|
347
|
+
* // or use function to return image configuration dynamically
|
|
348
|
+
* image: function(v, id, i) {
|
|
349
|
+
* // Return different images based on value
|
|
350
|
+
* if (v > 500) {
|
|
351
|
+
* return {
|
|
352
|
+
* url: "./high-value.svg",
|
|
353
|
+
* width: 40,
|
|
354
|
+
* height: 40,
|
|
355
|
+
* pos: { x: 0, y: 0 }
|
|
356
|
+
* };
|
|
357
|
+
* } else if (v > 100) {
|
|
358
|
+
* return {
|
|
359
|
+
* url: "./medium-value.svg",
|
|
360
|
+
* width: 30,
|
|
361
|
+
* height: 30,
|
|
362
|
+
* pos: { x: 0, y: 0 }
|
|
363
|
+
* };
|
|
364
|
+
* } else if(v < 5) {
|
|
365
|
+
* // Return null in case don't want to show image
|
|
366
|
+
* return null;
|
|
367
|
+
* } else {
|
|
368
|
+
* return {
|
|
369
|
+
* url: "./low-value.svg",
|
|
370
|
+
* width: 20,
|
|
371
|
+
* height: 20,
|
|
372
|
+
* pos: { x: 0, y: 0 }
|
|
373
|
+
* };
|
|
374
|
+
* }
|
|
375
|
+
* }
|
|
376
|
+
*/
|
|
377
|
+
image?: {
|
|
378
|
+
/**
|
|
379
|
+
* Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
|
|
380
|
+
*/
|
|
381
|
+
url: string;
|
|
382
|
+
/**
|
|
383
|
+
* Image width in pixels.
|
|
384
|
+
*/
|
|
385
|
+
width: number;
|
|
386
|
+
/**
|
|
387
|
+
* Image height in pixels.
|
|
388
|
+
*/
|
|
389
|
+
height: number;
|
|
390
|
+
/**
|
|
391
|
+
* Image position relative to the label text.
|
|
392
|
+
*/
|
|
393
|
+
pos?: {
|
|
394
|
+
x?: number;
|
|
395
|
+
y?: number;
|
|
396
|
+
};
|
|
397
|
+
} | ((this: Chart, v: number, id: string, i: number) => {
|
|
398
|
+
url: string;
|
|
399
|
+
width: number;
|
|
400
|
+
height: number;
|
|
401
|
+
pos?: {
|
|
402
|
+
x?: number;
|
|
403
|
+
y?: number;
|
|
404
|
+
};
|
|
405
|
+
} | null);
|
|
331
406
|
};
|
|
332
407
|
|
|
333
408
|
/**
|
|
@@ -422,6 +497,81 @@ export interface GaugeOptions {
|
|
|
422
497
|
* Set threshold ratio to show/hide labels.
|
|
423
498
|
*/
|
|
424
499
|
threshold?: number;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Set image to be displayed next to the label text.
|
|
503
|
+
* @example
|
|
504
|
+
* image: {
|
|
505
|
+
* url: "./sample.svg",
|
|
506
|
+
* // use placeholder to dynamically set image URL based on data ID
|
|
507
|
+
* url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
|
|
508
|
+
* width: 35,
|
|
509
|
+
* height: 35,
|
|
510
|
+
* pos: {
|
|
511
|
+
* x: 0,
|
|
512
|
+
* y: 0
|
|
513
|
+
* }
|
|
514
|
+
* }
|
|
515
|
+
*
|
|
516
|
+
* // or use function to return image configuration dynamically
|
|
517
|
+
* image: function(v, id, i) {
|
|
518
|
+
* // Return different images based on value
|
|
519
|
+
* if (v > 500) {
|
|
520
|
+
* return {
|
|
521
|
+
* url: "./high-value.svg",
|
|
522
|
+
* width: 40,
|
|
523
|
+
* height: 40,
|
|
524
|
+
* pos: { x: 0, y: 0 }
|
|
525
|
+
* };
|
|
526
|
+
* } else if (v > 100) {
|
|
527
|
+
* return {
|
|
528
|
+
* url: "./medium-value.svg",
|
|
529
|
+
* width: 30,
|
|
530
|
+
* height: 30,
|
|
531
|
+
* pos: { x: 0, y: 0 }
|
|
532
|
+
* };
|
|
533
|
+
* } else if(v < 5) {
|
|
534
|
+
* // Return null in case don't want to show image
|
|
535
|
+
* return null;
|
|
536
|
+
* } else {
|
|
537
|
+
* return {
|
|
538
|
+
* url: "./low-value.svg",
|
|
539
|
+
* width: 20,
|
|
540
|
+
* height: 20,
|
|
541
|
+
* pos: { x: 0, y: 0 }
|
|
542
|
+
* };
|
|
543
|
+
* }
|
|
544
|
+
* }
|
|
545
|
+
*/
|
|
546
|
+
image?: {
|
|
547
|
+
/**
|
|
548
|
+
* Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
|
|
549
|
+
*/
|
|
550
|
+
url: string;
|
|
551
|
+
/**
|
|
552
|
+
* Image width in pixels.
|
|
553
|
+
*/
|
|
554
|
+
width: number;
|
|
555
|
+
/**
|
|
556
|
+
* Image height in pixels.
|
|
557
|
+
*/
|
|
558
|
+
height: number;
|
|
559
|
+
/**
|
|
560
|
+
* Image position relative to the label text.
|
|
561
|
+
*/
|
|
562
|
+
pos?: {
|
|
563
|
+
x?: number;
|
|
564
|
+
y?: number;
|
|
565
|
+
};
|
|
566
|
+
} | ((this: Chart, v: number, id: string, i: number) => {
|
|
567
|
+
url: string;
|
|
568
|
+
width: number;
|
|
569
|
+
height: number;
|
|
570
|
+
pos?: {
|
|
571
|
+
x?: number;
|
|
572
|
+
y?: number;
|
|
573
|
+
};
|
|
574
|
+
} | null);
|
|
425
575
|
};
|
|
426
576
|
|
|
427
577
|
/**
|
|
@@ -548,7 +698,82 @@ export interface PieOptions {
|
|
|
548
698
|
/**
|
|
549
699
|
* Set ratio of labels position.
|
|
550
700
|
*/
|
|
551
|
-
ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number
|
|
701
|
+
ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Set image to be displayed next to the label text.
|
|
705
|
+
* @example
|
|
706
|
+
* image: {
|
|
707
|
+
* url: "./sample.svg",
|
|
708
|
+
* // use placeholder to dynamically set image URL based on data ID
|
|
709
|
+
* url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
|
|
710
|
+
* width: 35,
|
|
711
|
+
* height: 35,
|
|
712
|
+
* pos: {
|
|
713
|
+
* x: 0,
|
|
714
|
+
* y: 0
|
|
715
|
+
* }
|
|
716
|
+
* }
|
|
717
|
+
*
|
|
718
|
+
* // or use function to return image configuration dynamically
|
|
719
|
+
* image: function(v, id, i) {
|
|
720
|
+
* // Return different images based on value
|
|
721
|
+
* if (v > 500) {
|
|
722
|
+
* return {
|
|
723
|
+
* url: "./high-value.svg",
|
|
724
|
+
* width: 40,
|
|
725
|
+
* height: 40,
|
|
726
|
+
* pos: { x: 0, y: 0 }
|
|
727
|
+
* };
|
|
728
|
+
* } else if (v > 100) {
|
|
729
|
+
* return {
|
|
730
|
+
* url: "./medium-value.svg",
|
|
731
|
+
* width: 30,
|
|
732
|
+
* height: 30,
|
|
733
|
+
* pos: { x: 0, y: 0 }
|
|
734
|
+
* };
|
|
735
|
+
* } else if(v < 5) {
|
|
736
|
+
* // Return null in case don't want to show image
|
|
737
|
+
* return null;
|
|
738
|
+
* } else {
|
|
739
|
+
* return {
|
|
740
|
+
* url: "./low-value.svg",
|
|
741
|
+
* width: 20,
|
|
742
|
+
* height: 20,
|
|
743
|
+
* pos: { x: 0, y: 0 }
|
|
744
|
+
* };
|
|
745
|
+
* }
|
|
746
|
+
* }
|
|
747
|
+
*/
|
|
748
|
+
image?: {
|
|
749
|
+
/**
|
|
750
|
+
* Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
|
|
751
|
+
*/
|
|
752
|
+
url: string;
|
|
753
|
+
/**
|
|
754
|
+
* Image width in pixels.
|
|
755
|
+
*/
|
|
756
|
+
width: number;
|
|
757
|
+
/**
|
|
758
|
+
* Image height in pixels.
|
|
759
|
+
*/
|
|
760
|
+
height: number;
|
|
761
|
+
/**
|
|
762
|
+
* Image position relative to the label text.
|
|
763
|
+
*/
|
|
764
|
+
pos?: {
|
|
765
|
+
x?: number;
|
|
766
|
+
y?: number;
|
|
767
|
+
};
|
|
768
|
+
} | ((this: Chart, v: number, id: string, i: number) => {
|
|
769
|
+
url: string;
|
|
770
|
+
width: number;
|
|
771
|
+
height: number;
|
|
772
|
+
pos?: {
|
|
773
|
+
x?: number;
|
|
774
|
+
y?: number;
|
|
775
|
+
};
|
|
776
|
+
} | null);
|
|
552
777
|
};
|
|
553
778
|
|
|
554
779
|
/**
|
|
@@ -616,7 +841,82 @@ export interface PolarOptions {
|
|
|
616
841
|
/**
|
|
617
842
|
* Set ratio of labels position.
|
|
618
843
|
*/
|
|
619
|
-
ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number
|
|
844
|
+
ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Set image to be displayed next to the label text.
|
|
848
|
+
* @example
|
|
849
|
+
* image: {
|
|
850
|
+
* url: "./sample.svg",
|
|
851
|
+
* // use placeholder to dynamically set image URL based on data ID
|
|
852
|
+
* url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
|
|
853
|
+
* width: 35,
|
|
854
|
+
* height: 35,
|
|
855
|
+
* pos: {
|
|
856
|
+
* x: 0,
|
|
857
|
+
* y: 0
|
|
858
|
+
* }
|
|
859
|
+
* }
|
|
860
|
+
*
|
|
861
|
+
* // or use function to return image configuration dynamically
|
|
862
|
+
* image: function(v, id, i) {
|
|
863
|
+
* // Return different images based on value
|
|
864
|
+
* if (v > 500) {
|
|
865
|
+
* return {
|
|
866
|
+
* url: "./high-value.svg",
|
|
867
|
+
* width: 40,
|
|
868
|
+
* height: 40,
|
|
869
|
+
* pos: { x: 0, y: 0 }
|
|
870
|
+
* };
|
|
871
|
+
* } else if (v > 100) {
|
|
872
|
+
* return {
|
|
873
|
+
* url: "./medium-value.svg",
|
|
874
|
+
* width: 30,
|
|
875
|
+
* height: 30,
|
|
876
|
+
* pos: { x: 0, y: 0 }
|
|
877
|
+
* };
|
|
878
|
+
* } else if(v < 5) {
|
|
879
|
+
* // Return null in case don't want to show image
|
|
880
|
+
* return null;
|
|
881
|
+
* } else {
|
|
882
|
+
* return {
|
|
883
|
+
* url: "./low-value.svg",
|
|
884
|
+
* width: 20,
|
|
885
|
+
* height: 20,
|
|
886
|
+
* pos: { x: 0, y: 0 }
|
|
887
|
+
* };
|
|
888
|
+
* }
|
|
889
|
+
* }
|
|
890
|
+
*/
|
|
891
|
+
image?: {
|
|
892
|
+
/**
|
|
893
|
+
* Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
|
|
894
|
+
*/
|
|
895
|
+
url: string;
|
|
896
|
+
/**
|
|
897
|
+
* Image width in pixels.
|
|
898
|
+
*/
|
|
899
|
+
width: number;
|
|
900
|
+
/**
|
|
901
|
+
* Image height in pixels.
|
|
902
|
+
*/
|
|
903
|
+
height: number;
|
|
904
|
+
/**
|
|
905
|
+
* Image position relative to the label text.
|
|
906
|
+
*/
|
|
907
|
+
pos?: {
|
|
908
|
+
x?: number;
|
|
909
|
+
y?: number;
|
|
910
|
+
};
|
|
911
|
+
} | ((this: Chart, v: number, id: string, i: number) => {
|
|
912
|
+
url: string;
|
|
913
|
+
width: number;
|
|
914
|
+
height: number;
|
|
915
|
+
pos?: {
|
|
916
|
+
x?: number;
|
|
917
|
+
y?: number;
|
|
918
|
+
};
|
|
919
|
+
} | null);
|
|
620
920
|
};
|
|
621
921
|
level?: {
|
|
622
922
|
/**
|