@carbon/charts 1.12.0 → 1.13.1

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/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- import { t as Y, g as l, m as a, o as r, e as J, f as V } from "./color-scale-utils-faf67b75.mjs";
2
- import { T as Bt, j as It, l as Ht, n as Gt, p as Vt, q as Nt, s as Ut, d as Zt, u as _t, v as zt, L as Wt, h as jt, w as $t, M as Kt, N as Jt, O as qt, P as Xt, Q as Qt, x as Yt, y as eo, R as so, z as to, A as oo, B as no, C as io, D as ro, E as ao, F as ho, G as co, J as mo, H as lo, I as po, K as Co } from "./color-scale-utils-faf67b75.mjs";
1
+ import { t as Y, g as l, m as a, o as r, e as J, f as V } from "./color-scale-utils-2eb80bd2.mjs";
2
+ import { T as Bt, j as It, l as Ht, n as Gt, p as Vt, q as Nt, s as Ut, d as Zt, u as _t, v as zt, L as Wt, h as jt, w as $t, M as Kt, N as Jt, O as qt, P as Xt, Q as Qt, x as Yt, y as eo, R as so, z as to, A as oo, B as no, C as io, D as ro, E as ao, F as ho, G as co, J as mo, H as lo, I as po, K as Co } from "./color-scale-utils-2eb80bd2.mjs";
3
3
  import { i as vo } from "./index-ec554115.mjs";
4
4
  import { ChartModel as Re, ChartModelCartesian as Te, AlluvialChartModel as be, BoxplotChartModel as Oe, BulletChartModel as fe, ChoroplethModel as Se, CirclePackChartModel as Ae, PieChartModel as xe, GaugeChartModel as ye, HeatmapModel as De, ChartModelBinned as Fe, MeterChartModel as Le, RadarChartModel as Pe, TreeChartModel as Me, TreemapChartModel as ke, WordCloudModel as Be } from "./model/index.mjs";
5
5
  import { _ as j, r as i, q as c, L as Z, y as A, t as N, e as $, S as Ie, u as K, F as p, l as R } from "./enums-a96ef472.mjs";
6
6
  import { A as wo, a as Eo, b as Ro, c as To, d as bo, f as Oo, B as fo, g as So, C as Ao, h as xo, i as yo, j as Do, k as Fo, m as Lo, n as Po, D as Mo, o as ko, G as Bo, p as Io, s as Ho, v as Go, M as Vo, w as No, P as Uo, x as Zo, R as _o, z as zo, H as Wo, T as jo, I as $o, J as Ko, K as Jo, N as qo, O as Xo, Q as Qo, U as Yo, V as en, W as sn, Z as tn, X as on, Y as nn } from "./enums-a96ef472.mjs";
7
- import { c as He, L as ee, C as Ge, T as _, a as z, b as g, S as F, d as se, M as W, e as Ve, f as Ne, g as Ue, H as Ze, Z as _e, A as te, h as ze, i as d, G as w, R as B, j as k, k as oe, l as M, m as C, B as We, n as I, o as je, p as $e, q as ne, r as Ke, s as Je, t as ie, u as re, v as U, w as ae, x as he, y as ce, P as qe, D as Xe, z as Qe, E as Ye, F as es, I as ss, J as ts, K as os, N as ns, O as is, Q as rs, U as as, V as hs, W as cs } from "./choropleth-17b85d55.mjs";
8
- import { X as an, a8 as hn, a9 as cn, a7 as mn, Y as ln, _ as pn, $ as dn, a0 as Cn, a1 as un, a2 as vn, a3 as gn, a4 as wn, a5 as En, a6 as Rn } from "./choropleth-17b85d55.mjs";
9
- import { C as ms, E as ls, F as ps, T as ds, a as Cs, b as us, Z as vs, f as gs } from "./index-b0e98af9.mjs";
10
- import { D as ws, G as Es } from "./angle-utils-6b17e95b.mjs";
11
- import { S as bn, d as On, a as fn, p as Sn, b as An, r as xn } from "./angle-utils-6b17e95b.mjs";
7
+ import { c as He, L as ee, C as Ge, T as _, a as z, b as g, S as F, d as se, M as W, e as Ve, f as Ne, g as Ue, H as Ze, Z as _e, A as te, h as ze, i as d, G as w, R as B, j as k, k as oe, l as M, m as C, B as We, n as I, o as je, p as $e, q as ne, r as Ke, s as Je, t as ie, u as re, v as U, w as ae, x as he, y as ce, P as qe, D as Xe, z as Qe, E as Ye, F as es, I as ss, J as ts, K as os, N as ns, O as is, Q as rs, U as as, V as hs, W as cs } from "./choropleth-75258a8a.mjs";
8
+ import { X as an, a8 as hn, a9 as cn, a7 as mn, Y as ln, _ as pn, $ as dn, a0 as Cn, a1 as un, a2 as vn, a3 as gn, a4 as wn, a5 as En, a6 as Rn } from "./choropleth-75258a8a.mjs";
9
+ import { C as ms, E as ls, F as ps, T as ds, a as Cs, b as us, Z as vs, f as gs } from "./index-e91144ae.mjs";
10
+ import { D as ws, G as Es } from "./angle-utils-8034b0e5.mjs";
11
+ import { S as bn, d as On, a as fn, p as Sn, b as An, r as xn } from "./angle-utils-8034b0e5.mjs";
12
12
  import "d3";
13
13
  import "./a11y-7bad4f48.mjs";
14
- import "./_baseEach-76cda8a8.mjs";
14
+ import "./_baseEach-8433307e.mjs";
15
15
  import "d3-sankey";
16
16
  import "d3-cloud";
17
17
  function Rs(o, e, s) {
@@ -113,6 +113,12 @@ export interface BaseChartOptions {
113
113
  colors?: Array<string>;
114
114
  };
115
115
  };
116
+ fileDownload?: {
117
+ /**
118
+ * the number of color variants in the palette (defaults to using the number of data groups in the given data)
119
+ */
120
+ fileName?: string | ((type: 'png' | 'jpg' | 'csv') => string);
121
+ };
116
122
  /**
117
123
  * whether this type of chart is experimental
118
124
  */
@@ -1,7 +1,7 @@
1
- import { S as z, V as F, ab as U, g as u, z as b, e as G, y as j, a9 as M, M as k, ac as L, f as _, v as V, a0 as K, a1 as y, O as R, _ as x } from "../color-scale-utils-faf67b75.mjs";
2
- import { bin as Z, stack as A, stackOffsetDiverging as H, scaleOrdinal as $, quantile as E, ascending as Q, min as P, max as N, extent as W, scaleLinear as X, scaleQuantize as Y } from "d3";
1
+ import { S as z, V as F, ab as U, g as u, z as b, e as G, y as j, a9 as M, M as k, ac as L, f as _, v as V, a0 as K, a1 as y, O as $, _ as x } from "../color-scale-utils-2eb80bd2.mjs";
2
+ import { bin as Z, stack as A, stackOffsetDiverging as H, scaleOrdinal as R, quantile as E, ascending as Q, min as N, max as P, extent as W, scaleLinear as X, scaleQuantize as Y } from "d3";
3
3
  import { S as D, _ as B, d as w, e as O, s as J } from "../enums-a96ef472.mjs";
4
- import { b as tt } from "../_baseEach-76cda8a8.mjs";
4
+ import { b as tt } from "../_baseEach-8433307e.mjs";
5
5
  function et(h, t, e, s) {
6
6
  for (var a = -1, o = h == null ? 0 : h.length; ++a < o; ) {
7
7
  var i = h[a];
@@ -339,13 +339,21 @@ class m {
339
339
  }
340
340
  exportToCSV() {
341
341
  const t = this.getTabularDataArray().map(
342
- (a) => a.map((o) => `"${o === "&ndash;" ? "–" : o}"`)
342
+ (n) => n.map((r) => `"${r === "&ndash;" ? "–" : r}"`)
343
343
  );
344
344
  let e = "", s = "";
345
- t.forEach(function(a, o) {
346
- s = a.join(","), e += o < t.length ? s + `
345
+ t.forEach(function(n, r) {
346
+ s = n.join(","), e += r < t.length ? s + `
347
347
  ` : s;
348
- }), this.services.files.downloadCSV(e, "myChart.csv");
348
+ });
349
+ const a = this.getOptions();
350
+ let o = "myChart";
351
+ const i = u(
352
+ a,
353
+ "fileDownload",
354
+ "fileName"
355
+ );
356
+ typeof i == "function" ? o = i("csv") : typeof i == "string" && (o = i), this.services.files.downloadCSV(e, `${o}.csv`);
349
357
  }
350
358
  getTabularData(t) {
351
359
  return Array.isArray(t) ? t : this.transformToTabularData(t);
@@ -400,7 +408,7 @@ class m {
400
408
  const n = this.allDataGroups.map(
401
409
  (r, l) => `${o}-${s}-${l % 14 + 1}`
402
410
  );
403
- this.colorClassNames = $().range(n).domain(this.allDataGroups);
411
+ this.colorClassNames = R().range(n).domain(this.allDataGroups);
404
412
  }
405
413
  }
406
414
  class S extends m {
@@ -543,10 +551,10 @@ class dt extends S {
543
551
  for (const v of r)
544
552
  v < d || v > f ? T.push(v) : C.push(v);
545
553
  l.outliers = T;
546
- const I = P(C), q = N(C);
554
+ const I = N(C), q = P(C);
547
555
  l.whiskers = {
548
- min: I || P([l.quartiles.q_25, l.quartiles.q_50, l.quartiles.q_75]),
549
- max: q || N([l.quartiles.q_25, l.quartiles.q_50, l.quartiles.q_75])
556
+ min: I || N([l.quartiles.q_25, l.quartiles.q_50, l.quartiles.q_75]),
557
+ max: q || P([l.quartiles.q_25, l.quartiles.q_50, l.quartiles.q_75])
550
558
  }, a.push(l);
551
559
  }
552
560
  return a;
@@ -576,7 +584,7 @@ class dt extends S {
576
584
  const a = V.pairingOptions;
577
585
  s = s <= a["1-color"] ? s : 1;
578
586
  const o = this.allDataGroups.map(() => `1-${s}-1`);
579
- this.colorClassNames = $().range(o).domain(this.allDataGroups);
587
+ this.colorClassNames = R().range(o).domain(this.allDataGroups);
580
588
  }
581
589
  }
582
590
  class Dt extends S {
@@ -659,7 +667,7 @@ class ft extends m {
659
667
  }
660
668
  setColorClassNames() {
661
669
  const t = u(this.getOptions(), "color");
662
- this._colorScale = R(this.getDisplayData(), t);
670
+ this._colorScale = $(this.getDisplayData(), t);
663
671
  }
664
672
  }
665
673
  class mt extends m {
@@ -946,7 +954,7 @@ class xt extends S {
946
954
  }
947
955
  this._colorScale = Y().domain(o).range(n);
948
956
  const r = u(this.getOptions(), "color");
949
- this._colorScale = R(this.getDisplayData(), r);
957
+ this._colorScale = $(this.getDisplayData(), r);
950
958
  }
951
959
  }
952
960
  class Ct extends S {