billboard.js 3.6.0-next.2 → 3.6.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.
Files changed (41) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +424 -237
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +538 -351
  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 +116 -116
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +116 -116
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +116 -116
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +116 -116
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +116 -116
  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 +342 -168
  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 +5 -5
  35. package/src/ChartInternal/internals/color.ts +50 -0
  36. package/src/ChartInternal/internals/legend.ts +246 -145
  37. package/src/ChartInternal/shape/area.ts +9 -38
  38. package/src/ChartInternal/shape/bar.ts +20 -3
  39. package/src/config/Options/common/legend.ts +18 -3
  40. package/src/config/Options/shape/bar.ts +32 -0
  41. package/types/options.d.ts +23 -4
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -111,7 +111,7 @@ var Plugin = /** @class */ (function () {
111
111
  delete _this[key];
112
112
  });
113
113
  };
114
- Plugin.version = "3.6.0-next.2";
114
+ Plugin.version = "3.6.0";
115
115
  return Plugin;
116
116
  }());
117
117
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -286,7 +286,7 @@ var Plugin = /** @class */ (function () {
286
286
  delete _this[key];
287
287
  });
288
288
  };
289
- Plugin.version = "3.6.0-next.2";
289
+ Plugin.version = "3.6.0";
290
290
  return Plugin;
291
291
  }());
292
292
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -494,7 +494,7 @@ var Plugin = /** @class */ (function () {
494
494
  delete _this[key];
495
495
  });
496
496
  };
497
- Plugin.version = "3.6.0-next.2";
497
+ Plugin.version = "3.6.0";
498
498
  return Plugin;
499
499
  }());
500
500
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -134,7 +134,7 @@ var Plugin = /** @class */ (function () {
134
134
  delete _this[key];
135
135
  });
136
136
  };
137
- Plugin.version = "3.6.0-next.2";
137
+ Plugin.version = "3.6.0";
138
138
  return Plugin;
139
139
  }());
140
140
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -270,7 +270,7 @@ var Plugin = /** @class */ (function () {
270
270
  delete _this[key];
271
271
  });
272
272
  };
273
- Plugin.version = "3.6.0-next.2";
273
+ Plugin.version = "3.6.0";
274
274
  return Plugin;
275
275
  }());
276
276
  var Plugin$1 = Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.6.0-next.2",
3
+ "version": "3.6.0",
4
4
  "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+",
5
5
  "homepage": "https://naver.github.io/billboard.js/",
6
6
  "main": "dist/billboard.js",
@@ -120,8 +120,8 @@
120
120
  "@types/d3": "^7.4.0",
121
121
  "@types/mocha": "^9.1.1",
122
122
  "@types/sinon": "^10.0.13",
123
- "@typescript-eslint/eslint-plugin": "^5.38.0",
124
- "@typescript-eslint/parser": "^5.38.0",
123
+ "@typescript-eslint/eslint-plugin": "^5.38.1",
124
+ "@typescript-eslint/parser": "^5.38.1",
125
125
  "babel-helper-modules": "^6.0.0",
126
126
  "babel-loader": "^8.2.5",
127
127
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -137,7 +137,7 @@
137
137
  "chai": "^4.3.4",
138
138
  "clean-webpack-plugin": "^4.0.0",
139
139
  "cloc": "^2.10.0",
140
- "core-js": "^3.25.2",
140
+ "core-js": "^3.25.3",
141
141
  "coveralls": "^3.1.1",
142
142
  "cross-env": "^7.0.3",
143
143
  "css-loader": "^6.7.1",
@@ -148,7 +148,7 @@
148
148
  "d3-polygon": "^3.0.1",
149
149
  "docdash": "^1.2.0",
150
150
  "dtslint": "^4.2.1",
151
- "eslint": "^8.23.1",
151
+ "eslint": "^8.24.0",
152
152
  "eslint-config-naver": "^2.1.0",
153
153
  "eslint-plugin-import": "^2.26.0",
154
154
  "eslint-plugin-jsdoc": "^39.3.6",
@@ -193,6 +193,56 @@ export default {
193
193
  }
194
194
  },
195
195
 
196
+ /**
197
+ * Get data gradient color url
198
+ * @param {string} id Data id
199
+ * @returns {string}
200
+ * @private
201
+ */
202
+ getGradienColortUrl(id: string): string {
203
+ return `url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(id)})`;
204
+ },
205
+
206
+ /**
207
+ * Update linear gradient definition (for area & bar only)
208
+ * @private
209
+ */
210
+ updateLinearGradient(): void {
211
+ const $$ = this;
212
+ const {config, data: {targets}, state: {datetimeId}, $el: {defs}} = $$;
213
+
214
+ targets.forEach(d => {
215
+ const id = `${datetimeId}-gradient${$$.getTargetSelectorSuffix(d.id)}`;
216
+ const supportedType = ($$.isAreaType(d) && "area") || ($$.isBarType(d) && "bar");
217
+ const isRotated = config.axis_rotated;
218
+
219
+ if (supportedType && defs.select(`#${id}`).empty()) {
220
+ const color = $$.color(d);
221
+ const {
222
+ x = isRotated ? [1, 0] : [0, 0],
223
+ y = isRotated ? [0, 0] : [0, 1],
224
+ stops = [[0, color, 1], [1, color, 0]]
225
+ } = config[`${supportedType}_linearGradient`];
226
+
227
+ const linearGradient = defs.append("linearGradient")
228
+ .attr("id", `${id}`)
229
+ .attr("x1", x[0])
230
+ .attr("x2", x[1])
231
+ .attr("y1", y[0])
232
+ .attr("y2", y[1]);
233
+
234
+ stops.forEach(v => {
235
+ const stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
236
+
237
+ linearGradient.append("stop")
238
+ .attr("offset", v[0])
239
+ .attr("stop-color", stopColor || color)
240
+ .attr("stop-opacity", v[2]);
241
+ });
242
+ }
243
+ });
244
+ },
245
+
196
246
  /**
197
247
  * Set the data over color.
198
248
  * When is out, will restate in its previous color value