charts-core 1.1.39 → 1.1.41

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/README.md CHANGED
@@ -1,57 +1,57 @@
1
- # ChartsCore Library
2
-
3
- ## Installation
4
-
5
- ```bash
6
- npm i charts-core
7
- ```
8
-
9
- Don't forget to connect CSS styles to the project. Project styles should be connected later and have priority for convenient override.
10
-
11
- ```js
12
- import 'charts-core/style.css'
13
- ```
14
-
15
- ## Quick start
16
-
17
- ### Line chart
18
-
19
- [See full Line chart documentation](./src/docs/line-chart.md)
20
-
21
- ```js
22
- // to create new instance of chart
23
- const chart = createLineChart('#line-chart', {
24
- chartId: 'some-chart',
25
- data: [
26
- { date: '2025-02-02T00:00:00.000Z', value: 2800 },
27
- { date: '2025-02-16T00:00:00.000Z', value: 2970 },
28
- { date: '2025-03-02T00:00:00.000Z', value: 4120 },
29
- { date: '2025-03-16T00:00:00.000Z', value: 4260 },
30
- { date: '2025-04-02T00:00:00.000Z', value: 4120 },
31
- ],
32
- config: {
33
- margin: {
34
- right: 50,
35
- },
36
- yAxis: {
37
- customTicks: true,
38
- ticks: [8, 'd'],
39
- },
40
- },
41
- })
42
-
43
- // to update it
44
- chart.update({
45
- data: newData,
46
- config: {
47
- theme: 'dark',
48
- },
49
- })
50
-
51
- // or destroy
52
- chart.destroy()
53
- ```
54
-
55
- ### Candlestick chart
56
-
57
- [See full Candlestick chart documentation](./src/docs/candlestick.md)
1
+ # ChartsCore Library
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ npm i charts-core
7
+ ```
8
+
9
+ Don't forget to connect CSS styles to the project. Project styles should be connected later and have priority for convenient override.
10
+
11
+ ```js
12
+ import 'charts-core/style.css'
13
+ ```
14
+
15
+ ## Quick start
16
+
17
+ ### Line chart
18
+
19
+ [See full Line chart documentation](./src/docs/line-chart.md)
20
+
21
+ ```js
22
+ // to create new instance of chart
23
+ const chart = createLineChart('#line-chart', {
24
+ chartId: 'some-chart',
25
+ data: [
26
+ { date: '2025-02-02T00:00:00.000Z', value: 2800 },
27
+ { date: '2025-02-16T00:00:00.000Z', value: 2970 },
28
+ { date: '2025-03-02T00:00:00.000Z', value: 4120 },
29
+ { date: '2025-03-16T00:00:00.000Z', value: 4260 },
30
+ { date: '2025-04-02T00:00:00.000Z', value: 4120 },
31
+ ],
32
+ config: {
33
+ margin: {
34
+ right: 50,
35
+ },
36
+ yAxis: {
37
+ customTicks: true,
38
+ ticks: [8, 'd'],
39
+ },
40
+ },
41
+ })
42
+
43
+ // to update it
44
+ chart.update({
45
+ data: newData,
46
+ config: {
47
+ theme: 'dark',
48
+ },
49
+ })
50
+
51
+ // or destroy
52
+ chart.destroy()
53
+ ```
54
+
55
+ ### Candlestick chart
56
+
57
+ [See full Candlestick chart documentation](./src/docs/candlestick.md)
@@ -840,16 +840,16 @@ var De = { exports: {} };
840
840
  De.exports;
841
841
  var si;
842
842
  function gn() {
843
- return si || (si = 1, function(i, e) {
843
+ return si || (si = 1, (function(i, e) {
844
844
  var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", f = "[object Date]", p = "[object Error]", _ = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", M = "[object RegExp]", T = "[object Set]", k = "[object String]", I = "[object Undefined]", V = "[object WeakMap]", Z = "[object ArrayBuffer]", te = "[object DataView]", K = "[object Float32Array]", z = "[object Float64Array]", Y = "[object Int8Array]", O = "[object Int16Array]", oe = "[object Int32Array]", it = "[object Uint8Array]", le = "[object Uint8ClampedArray]", be = "[object Uint16Array]", ye = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Ie = /^\[object .+?Constructor\]$/, Be = /^(?:0|[1-9]\d*)$/, F = {};
845
845
  F[K] = F[z] = F[Y] = F[O] = F[oe] = F[it] = F[le] = F[be] = F[ye] = !0, F[o] = F[c] = F[Z] = F[d] = F[te] = F[f] = F[p] = F[_] = F[b] = F[w] = F[y] = F[M] = F[T] = F[k] = F[V] = !1;
846
- var Re = typeof Ge == "object" && Ge && Ge.Object === Object && Ge, st = typeof self == "object" && self && self.Object === Object && self, P = Re || st || Function("return this")(), ee = e && !e.nodeType && e, W = ee && !0 && i && !i.nodeType && i, j = W && W.exports === ee, me = j && Re.process, we = function() {
846
+ var Re = typeof Ge == "object" && Ge && Ge.Object === Object && Ge, st = typeof self == "object" && self && self.Object === Object && self, P = Re || st || Function("return this")(), ee = e && !e.nodeType && e, W = ee && !0 && i && !i.nodeType && i, j = W && W.exports === ee, me = j && Re.process, we = (function() {
847
847
  try {
848
848
  var l = W && W.require && W.require("util").types;
849
849
  return l || me && me.binding && me.binding("util");
850
850
  } catch {
851
851
  }
852
- }(), xe = we && we.isTypedArray;
852
+ })(), xe = we && we.isTypedArray;
853
853
  function $e(l, u, m) {
854
854
  switch (m.length) {
855
855
  case 0:
@@ -881,20 +881,20 @@ function gn() {
881
881
  return l(u(m));
882
882
  };
883
883
  }
884
- var Ce = Array.prototype, Ai = Function.prototype, Pe = Object.prototype, at = P["__core-js_shared__"], ze = Ai.toString, ae = Pe.hasOwnProperty, Nt = function() {
884
+ var Ce = Array.prototype, Ai = Function.prototype, Pe = Object.prototype, at = P["__core-js_shared__"], ze = Ai.toString, ae = Pe.hasOwnProperty, Nt = (function() {
885
885
  var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
886
886
  return l ? "Symbol(src)_1." + l : "";
887
- }(), Ft = Pe.toString, Mi = ze.call(Object), Ti = RegExp(
887
+ })(), Ft = Pe.toString, Mi = ze.call(Object), Ti = RegExp(
888
888
  "^" + ze.call(ae).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
889
889
  ), Ve = j ? P.Buffer : void 0, Ht = P.Symbol, It = P.Uint8Array;
890
890
  Ve && Ve.allocUnsafe;
891
- var Bt = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = Pe.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0, We = function() {
891
+ var Bt = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = Pe.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0, We = (function() {
892
892
  try {
893
893
  var l = lt(Object, "defineProperty");
894
894
  return l({}, "", {}), l;
895
895
  } catch {
896
896
  }
897
- }(), Li = Ve ? Ve.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(P, "Map"), Se = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
897
+ })(), Li = Ve ? Ve.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(P, "Map"), Se = lt(Object, "create"), Ni = /* @__PURE__ */ (function() {
898
898
  function l() {
899
899
  }
900
900
  return function(u) {
@@ -906,7 +906,7 @@ function gn() {
906
906
  var m = new l();
907
907
  return l.prototype = void 0, m;
908
908
  };
909
- }();
909
+ })();
910
910
  function ue(l) {
911
911
  var u = -1, m = l == null ? 0 : l.length;
912
912
  for (this.clear(); ++u < m; ) {
@@ -1254,9 +1254,9 @@ function gn() {
1254
1254
  function Ue(l, u) {
1255
1255
  return l === u || l !== l && u !== u;
1256
1256
  }
1257
- var ht = Pt(/* @__PURE__ */ function() {
1257
+ var ht = Pt(/* @__PURE__ */ (function() {
1258
1258
  return arguments;
1259
- }()) ? Pt : function(l) {
1259
+ })()) ? Pt : function(l) {
1260
1260
  return Ae(l) && ae.call(l, "callee") && !Di.call(l, "callee");
1261
1261
  }, dt = Array.isArray;
1262
1262
  function ut(l) {
@@ -1313,7 +1313,7 @@ function gn() {
1313
1313
  return !1;
1314
1314
  }
1315
1315
  i.exports = ks;
1316
- }(De, De.exports)), De.exports;
1316
+ })(De, De.exports)), De.exports;
1317
1317
  }
1318
1318
  var fn = gn();
1319
1319
  const Je = /* @__PURE__ */ un(fn), ni = 12, mn = {
@@ -1947,7 +1947,7 @@ class Dn {
1947
1947
  mainColor: n.mainColor ?? s.main,
1948
1948
  textColor: n.textColor ?? s.text,
1949
1949
  lineColor: n.lineColor ?? s.line
1950
- }, r = t.convert(n.value), c = (n.formatter ?? ((h = this._defaults.formatter) == null ? void 0 : h.horizontal) ?? ((d) => d.toString()))(n.value);
1950
+ }, r = t.convert(n.value), o = n.formatter ?? ((h = this._defaults.formatter) == null ? void 0 : h.horizontal) ?? ((d) => d.toString()), c = n.text ?? o(n.value);
1951
1951
  return {
1952
1952
  value: n.value,
1953
1953
  text: c,
@@ -2921,7 +2921,7 @@ function wi(i) {
2921
2921
  function gi(i) {
2922
2922
  return U(i) / 255;
2923
2923
  }
2924
- var J = function() {
2924
+ var J = (function() {
2925
2925
  var i = "[-\\+]?\\d+%?", e = "[-\\+]?\\d*\\.\\d+%?", t = "(?:" + e + ")|(?:" + i + ")", s = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?", n = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?";
2926
2926
  return {
2927
2927
  CSS_UNIT: new RegExp(t),
@@ -2936,7 +2936,7 @@ var J = function() {
2936
2936
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2937
2937
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
2938
2938
  };
2939
- }();
2939
+ })();
2940
2940
  function se(i) {
2941
2941
  return !!J.CSS_UNIT.exec(i);
2942
2942
  }
@@ -3399,16 +3399,21 @@ const Sa = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
3399
3399
  x2: r.x,
3400
3400
  y2: r.y
3401
3401
  }
3402
- }), Aa(i, {
3402
+ });
3403
+ const c = i.canvas.width / (window.devicePixelRatio || 1);
3404
+ Aa(i, {
3403
3405
  text: e,
3404
- coords: r,
3406
+ coords: {
3407
+ x: c,
3408
+ y: r.y
3409
+ },
3405
3410
  padding: { x: 6, y: 4 },
3406
3411
  borderRadius: 4,
3407
3412
  fontSize: 10,
3408
3413
  textHeight: 12,
3409
3414
  align: {
3410
- x: a === "v" ? "middle" : s,
3411
- y: a === "h" ? "middle" : s
3415
+ x: "right",
3416
+ y: "middle"
3412
3417
  },
3413
3418
  colors: {
3414
3419
  text: o.text,
@@ -4119,9 +4124,9 @@ class Ka {
4119
4124
  this._model = e, this._view = t, this._enableLogging = !1, this._logger = new Qa(["scale_event"]);
4120
4125
  }
4121
4126
  subscribeWithLogging(e, t) {
4122
- const s = (n) => {
4127
+ const s = ((n) => {
4123
4128
  this._enableLogging && this._logger.log(e, n), t(n);
4124
- };
4129
+ });
4125
4130
  this._model.subscribe(e, s);
4126
4131
  }
4127
4132
  // [TODO]: optimize renderers, call only the necessary ones. Get rid of this._view.renderAll