billboard.js 3.7.0 → 3.7.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.
Files changed (45) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +48 -37
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +1256 -1206
  6. package/dist/billboard.pkgd.min.js +2 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1159 -1130
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1160 -1131
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1204 -1165
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1161 -1132
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1161 -1132
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +46 -37
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +9 -9
  35. package/src/Chart/api/data.ts +2 -2
  36. package/src/Chart/api/grid.x.ts +2 -2
  37. package/src/Chart/api/grid.y.ts +4 -2
  38. package/src/Chart/api/regions.ts +2 -2
  39. package/src/Chart/api/tooltip.ts +2 -2
  40. package/src/ChartInternal/ChartInternal.ts +2 -2
  41. package/src/ChartInternal/internals/clip.ts +12 -14
  42. package/src/ChartInternal/internals/text.ts +14 -4
  43. package/src/ChartInternal/shape/bar.ts +4 -2
  44. package/src/ChartInternal/shape/treemap.ts +7 -4
  45. package/types/chart.d.ts +13 -3
@@ -262,15 +262,17 @@ export default {
262
262
  const yScale = $$.getYScaleById.bind($$);
263
263
 
264
264
  return (d: IDataRow, i: number) => {
265
- const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
265
+ const {id} = d;
266
+ const y0 = yScale.call($$, id, isSub)($$.getShapeYMin(id));
266
267
  const offset = barOffset(d, i) || y0; // offset is for stacked bar chart
267
268
  const width = isNumber(barW) ? barW : barW[d.id] || barW._$width;
269
+ const isInverted = config[`axis_${$$.axis.getId(id)}_inverted`];
268
270
  const value = d.value as number;
269
271
  const posX = barX(d);
270
272
  let posY = barY(d);
271
273
 
272
274
  // fix posY not to overflow opposite quadrant
273
- if (config.axis_rotated && (
275
+ if (config.axis_rotated && !isInverted && (
274
276
  (value > 0 && posY < y0) || (value < 0 && y0 < posY)
275
277
  )) {
276
278
  posY = y0;
@@ -66,8 +66,11 @@ function convertDataToTreemapData(data: IData[]): ITreemapData[] {
66
66
  export default {
67
67
  initTreemap(): void {
68
68
  const $$ = this;
69
- const {$el, state: {current: {width, height}, clip}} = $$;
70
- const clipId = clip.id;
69
+ const {$el, state: {
70
+ current: {width, height}, clip, datetimeId
71
+ }} = $$;
72
+
73
+ clip.id = `${datetimeId}-clip`;
71
74
 
72
75
  $$.treemap = d3Treemap()
73
76
  .tile($$.getTreemapTile());
@@ -83,13 +86,13 @@ export default {
83
86
 
84
87
  $el.defs
85
88
  .append("clipPath")
86
- .attr("id", clipId)
89
+ .attr("id", clip.id)
87
90
  .append("rect")
88
91
  .attr("width", width)
89
92
  .attr("height", height);
90
93
 
91
94
  $el.treemap = $el.main.select(`.${$COMMON.chart}`)
92
- .attr("clip-path", `url(#${clipId})`)
95
+ .attr("clip-path", `url(#${clip.id})`)
93
96
  .append("g")
94
97
  .classed($TREEMAP.chartTreemaps, true);
95
98
 
package/types/chart.d.ts CHANGED
@@ -102,20 +102,30 @@ export interface Chart {
102
102
  * Update regions.
103
103
  * @param regions Regions will be replaced with this argument. The format of this argument is the same as regions.
104
104
  */
105
- (regions: any[]): void;
105
+ (regions: Array<{
106
+ axis: "x" | "y" | "y2",
107
+ start?: number | Date,
108
+ end?: number | Date,
109
+ class?: string
110
+ }>): void;
106
111
 
107
112
  /**
108
113
  * Add new region. This API adds new region instead of replacing like regions.
109
114
  * @param grids New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
110
115
  */
111
- add(regions: any[] | {}): void;
116
+ add<T = {
117
+ axis: "x" | "y" | "y2",
118
+ start?: number | Date,
119
+ end?: number | Date,
120
+ class?: string
121
+ }>(regions: T | T[]): void;
112
122
 
113
123
  /**
114
124
  * Remove regions. This API removes regions.
115
125
  * @param args This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be
116
126
  * removed.
117
127
  */
118
- remove(args?: { value?: number | string; class?: string }): void;
128
+ remove(args?: { classes: string[] }): void;
119
129
  };
120
130
 
121
131
  data: {