@carbon/charts 0.30.24 → 0.30.25

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 (162) hide show
  1. package/CHANGELOG.md +330 -1052
  2. package/README.md +3 -0
  3. package/axis-chart.js +8 -14
  4. package/axis-chart.js.map +1 -1
  5. package/build/demo/{data/create-codesandbox.d.ts → create-codesandbox.d.ts} +16 -13
  6. package/build/demo/data/bar.d.ts +1 -1
  7. package/build/demo/data/line.d.ts +1 -1
  8. package/build/src/interfaces/axis-scales.d.ts +11 -11
  9. package/build/src/interfaces/charts.d.ts +1 -0
  10. package/bundle.js +1 -1
  11. package/chart.js +15 -24
  12. package/chart.js.map +1 -1
  13. package/charts/bar-grouped.js +3 -1
  14. package/charts/bar-grouped.js.map +1 -1
  15. package/charts/bar-simple.js +3 -1
  16. package/charts/bar-simple.js.map +1 -1
  17. package/charts/bar-stacked.js +3 -1
  18. package/charts/bar-stacked.js.map +1 -1
  19. package/charts/bubble.js +3 -1
  20. package/charts/bubble.js.map +1 -1
  21. package/charts/donut.js +3 -1
  22. package/charts/donut.js.map +1 -1
  23. package/charts/line.js +3 -1
  24. package/charts/line.js.map +1 -1
  25. package/charts/pie.js +3 -1
  26. package/charts/pie.js.map +1 -1
  27. package/charts/radar.js +1 -3
  28. package/charts/radar.js.map +1 -1
  29. package/charts/scatter.js +3 -1
  30. package/charts/scatter.js.map +1 -1
  31. package/components/axes/axis.js +72 -33
  32. package/components/axes/axis.js.map +1 -1
  33. package/components/axes/grid.js +23 -18
  34. package/components/axes/grid.js.map +1 -1
  35. package/components/axes/ruler.js +7 -5
  36. package/components/axes/ruler.js.map +1 -1
  37. package/components/axes/two-dimensional-axes.js +5 -2
  38. package/components/axes/two-dimensional-axes.js.map +1 -1
  39. package/components/axes/zero-line.js +2 -1
  40. package/components/axes/zero-line.js.map +1 -1
  41. package/components/component.js +2 -4
  42. package/components/component.js.map +1 -1
  43. package/components/essentials/legend.js +46 -23
  44. package/components/essentials/legend.js.map +1 -1
  45. package/components/essentials/threshold.js +11 -5
  46. package/components/essentials/threshold.js.map +1 -1
  47. package/components/essentials/title.js +6 -4
  48. package/components/essentials/title.js.map +1 -1
  49. package/components/essentials/tooltip-bar.js +39 -20
  50. package/components/essentials/tooltip-bar.js.map +1 -1
  51. package/components/essentials/tooltip-pie.js +4 -3
  52. package/components/essentials/tooltip-pie.js.map +1 -1
  53. package/components/essentials/tooltip-radar.js +6 -3
  54. package/components/essentials/tooltip-radar.js.map +1 -1
  55. package/components/essentials/tooltip-scatter.js +3 -1
  56. package/components/essentials/tooltip-scatter.js.map +1 -1
  57. package/components/essentials/tooltip.js +35 -15
  58. package/components/essentials/tooltip.js.map +1 -1
  59. package/components/graphs/bar-grouped.js +46 -20
  60. package/components/graphs/bar-grouped.js.map +1 -1
  61. package/components/graphs/bar-simple.js +39 -19
  62. package/components/graphs/bar-simple.js.map +1 -1
  63. package/components/graphs/bar-stacked.js +50 -28
  64. package/components/graphs/bar-stacked.js.map +1 -1
  65. package/components/graphs/bar.js.map +1 -1
  66. package/components/graphs/bubble.js +22 -8
  67. package/components/graphs/bubble.js.map +1 -1
  68. package/components/graphs/donut.js +12 -4
  69. package/components/graphs/donut.js.map +1 -1
  70. package/components/graphs/line.js +14 -7
  71. package/components/graphs/line.js.map +1 -1
  72. package/components/graphs/pie.js +80 -44
  73. package/components/graphs/pie.js.map +1 -1
  74. package/components/graphs/radar.js +271 -140
  75. package/components/graphs/radar.js.map +1 -1
  76. package/components/graphs/scatter.js +54 -21
  77. package/components/graphs/scatter.js.map +1 -1
  78. package/components/graphs/skeleton.js +29 -14
  79. package/components/graphs/skeleton.js.map +1 -1
  80. package/components/layout/layout.js +38 -26
  81. package/components/layout/layout.js.map +1 -1
  82. package/components/layout/spacer.js +2 -1
  83. package/components/layout/spacer.js.map +1 -1
  84. package/configuration.js +15 -13
  85. package/configuration.js.map +1 -1
  86. package/demo/{data/create-codesandbox.d.ts → create-codesandbox.d.ts} +16 -13
  87. package/demo/{data/create-codesandbox.js → create-codesandbox.js} +24 -21
  88. package/demo/create-codesandbox.js.map +1 -0
  89. package/demo/data/bar.d.ts +1 -1
  90. package/demo/data/bar.js +1 -1
  91. package/demo/data/bar.js.map +1 -1
  92. package/demo/data/bubble.js +5 -3
  93. package/demo/data/bubble.js.map +1 -1
  94. package/demo/data/bundle.js +1 -1
  95. package/demo/data/index.js +12 -7
  96. package/demo/data/index.js.map +1 -1
  97. package/demo/data/line.d.ts +1 -1
  98. package/demo/data/line.js +2 -4
  99. package/demo/data/line.js.map +1 -1
  100. package/demo/data/radar.js.map +1 -1
  101. package/demo/data/time-series-axis.js +1 -3
  102. package/demo/data/time-series-axis.js.map +1 -1
  103. package/demo/styles.css +50 -18
  104. package/demo/styles.css.map +1 -1
  105. package/demo/styles.min.css +1 -1
  106. package/demo/styles.min.css.map +1 -1
  107. package/demo/tsconfig.tsbuildinfo +68 -68
  108. package/index.js.map +1 -1
  109. package/interfaces/axis-scales.d.ts +11 -11
  110. package/interfaces/axis-scales.js.map +1 -1
  111. package/interfaces/charts.d.ts +1 -0
  112. package/interfaces/charts.js.map +1 -1
  113. package/interfaces/components.js.map +1 -1
  114. package/interfaces/enums.js.map +1 -1
  115. package/model.js +27 -16
  116. package/model.js.map +1 -1
  117. package/package.json +4 -2
  118. package/polyfills.js +7 -2
  119. package/polyfills.js.map +1 -1
  120. package/services/angle-utils.js +34 -9
  121. package/services/angle-utils.js.map +1 -1
  122. package/services/colors.js.map +1 -1
  123. package/services/curves.js +4 -2
  124. package/services/curves.js.map +1 -1
  125. package/services/essentials/dom-utils.js +4 -3
  126. package/services/essentials/dom-utils.js.map +1 -1
  127. package/services/essentials/transitions.js +3 -4
  128. package/services/essentials/transitions.js.map +1 -1
  129. package/services/scales-cartesian.js +63 -23
  130. package/services/scales-cartesian.js.map +1 -1
  131. package/services/time-series.js +28 -12
  132. package/services/time-series.js.map +1 -1
  133. package/styles/components/_axis.scss +4 -0
  134. package/styles/components/_layout.scss +0 -1
  135. package/styles/components/_ruler.scss +5 -2
  136. package/styles/components/_skeleton.scss +2 -3
  137. package/styles/components/_threshold.scss +2 -2
  138. package/styles/components/_tooltip.scss +6 -5
  139. package/styles/graphs/_bubble.scss +1 -1
  140. package/styles/graphs/_radar.scss +4 -2
  141. package/styles/graphs/_scatter.scss +1 -1
  142. package/styles/mixins.scss +2 -2
  143. package/styles-g10.css +11 -4
  144. package/styles-g10.css.map +1 -1
  145. package/styles-g10.min.css +1 -1
  146. package/styles-g10.min.css.map +1 -1
  147. package/styles-g100.css +11 -4
  148. package/styles-g100.css.map +1 -1
  149. package/styles-g100.min.css +1 -1
  150. package/styles-g100.min.css.map +1 -1
  151. package/styles-g90.css +11 -4
  152. package/styles-g90.css.map +1 -1
  153. package/styles-g90.min.css +1 -1
  154. package/styles-g90.min.css.map +1 -1
  155. package/styles.css +11 -4
  156. package/styles.css.map +1 -1
  157. package/styles.min.css +1 -1
  158. package/styles.min.css.map +1 -1
  159. package/tools.js +19 -7
  160. package/tools.js.map +1 -1
  161. package/tsconfig.tsbuildinfo +56 -56
  162. package/demo/data/create-codesandbox.js.map +0 -1
package/README.md CHANGED
@@ -18,14 +18,17 @@ yarn add @carbon/charts d3
18
18
  ```
19
19
 
20
20
  ## Step-by-step instructions
21
+
21
22
  [Read on carbondesignsystem.com](https://www.carbondesignsystem.com/data-visualization/getting-started/vanilla)
22
23
 
23
24
  ## Codesandbox examples
25
+
24
26
  [Sample use cases can be seen here](https://carbon-design-system.github.io/carbon-charts).
25
27
 
26
28
  **When opening the link above**, click on the **Edit on Codesandbox** button for each demo to see an isolated project showing you how to reproduce the demo.
27
29
 
28
30
  ## Charting data & options
31
+
29
32
  Although we will definitely introduce new models in the future as we start shipping new components such as maps, Data and options follow the same model in all charts, with minor exceptions and differences in specific components.
30
33
 
31
34
  For instance in the case of a donut chart you're able to pass in an additional field called `center` in your options configuring the donut center.
package/axis-chart.js CHANGED
@@ -36,9 +36,7 @@ var AxisChart = /** @class */ (function (_super) {
36
36
  AxisChart.prototype.getAxisChartComponents = function (graphFrameComponents) {
37
37
  var titleComponent = {
38
38
  id: "title",
39
- components: [
40
- new Title(this.model, this.services)
41
- ],
39
+ components: [new Title(this.model, this.services)],
42
40
  growth: {
43
41
  x: LayoutGrowth.PREFERRED,
44
42
  y: LayoutGrowth.FIXED
@@ -46,9 +44,7 @@ var AxisChart = /** @class */ (function (_super) {
46
44
  };
47
45
  var legendComponent = {
48
46
  id: "legend",
49
- components: [
50
- new Legend(this.model, this.services)
51
- ],
47
+ components: [new Legend(this.model, this.services)],
52
48
  growth: {
53
49
  x: LayoutGrowth.PREFERRED,
54
50
  y: LayoutGrowth.FIXED
@@ -70,13 +66,15 @@ var AxisChart = /** @class */ (function (_super) {
70
66
  if (legendPosition === LegendPositions.LEFT) {
71
67
  fullFrameComponentDirection = LayoutDirection.ROW;
72
68
  if (!this.model.getOptions().legend.orientation) {
73
- this.model.getOptions().legend.orientation = LegendOrientations.VERTICAL;
69
+ this.model.getOptions().legend.orientation =
70
+ LegendOrientations.VERTICAL;
74
71
  }
75
72
  }
76
73
  else if (legendPosition === LegendPositions.RIGHT) {
77
74
  fullFrameComponentDirection = LayoutDirection.ROW_REVERSE;
78
75
  if (!this.model.getOptions().legend.orientation) {
79
- this.model.getOptions().legend.orientation = LegendOrientations.VERTICAL;
76
+ this.model.getOptions().legend.orientation =
77
+ LegendOrientations.VERTICAL;
80
78
  }
81
79
  }
82
80
  else if (legendPosition === LegendPositions.BOTTOM) {
@@ -85,9 +83,7 @@ var AxisChart = /** @class */ (function (_super) {
85
83
  }
86
84
  var legendSpacerComponent = {
87
85
  id: "spacer",
88
- components: [
89
- new Spacer(this.model, this.services)
90
- ],
86
+ components: [new Spacer(this.model, this.services)],
91
87
  growth: {
92
88
  x: LayoutGrowth.PREFERRED,
93
89
  y: LayoutGrowth.FIXED
@@ -114,9 +110,7 @@ var AxisChart = /** @class */ (function (_super) {
114
110
  topLevelLayoutComponents.push(titleComponent);
115
111
  var titleSpacerComponent = {
116
112
  id: "spacer",
117
- components: [
118
- new Spacer(this.model, this.services)
119
- ],
113
+ components: [new Spacer(this.model, this.services)],
120
114
  growth: {
121
115
  x: LayoutGrowth.PREFERRED,
122
116
  y: LayoutGrowth.FIXED
package/axis-chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"axis-chart.js","sourceRoot":"","sources":["axis-chart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACN,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAGf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,eAAe,EACf,MAAM,EACN,KAAK,EAGL,MAAM,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE3D;IAA+B,6BAAK;IAMnC,mBAAY,MAAe,EAAE,YAA2C;QAAxE,YACC,kBAAM,MAAM,EAAE,YAAY,CAAC,SAC3B;QAPD,cAAQ,GAAQ,MAAM,CAAC,MAAM,CAAC,KAAI,CAAC,QAAQ,EAAE;YAC5C,eAAe,EAAE,eAAe;YAChC,MAAM,EAAE,MAAM;SACd,CAAC,CAAC;;IAIH,CAAC;IAES,0CAAsB,GAAhC,UAAiC,oBAA2B;QAC3D,IAAM,cAAc,GAAG;YACtB,EAAE,EAAE,OAAO;YACX,UAAU,EAAE;gBACX,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;aACpC;YACD,MAAM,EAAE;gBACP,CAAC,EAAE,YAAY,CAAC,SAAS;gBACzB,CAAC,EAAE,YAAY,CAAC,KAAK;aACrB;SACD,CAAC;QAEF,IAAM,eAAe,GAAG;YACvB,EAAE,EAAE,QAAQ;YACZ,UAAU,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AC,KAAK;iBACrB;aACD,CAAC;YAEF,wBAAwB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;SACpD;QACD,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAElD,OAAO;YACN,IAAI,eAAe,CAClB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,EACb,wBAAwB,EACxB;gBACC,SAAS,EAAE,eAAe,CAAC,MAAM;aACjC,CACD;SACD,CAAC;IACH,CAAC;IACF,gBAAC;AAAD,CAAC,AAjID,CAA+B,KAAK,GAiInC","sourcesContent":["import { Chart } from \"./chart\";\nimport {\n\tLayoutDirection,\n\tLayoutGrowth,\n\tLegendOrientations,\n\tLegendPositions,\n\tChartConfig,\n\tAxisChartOptions\n} from \"./interfaces/index\";\nimport {\n\tLayoutComponent,\n\tLegend,\n\tTitle,\n\tTooltip,\n\tTooltipBar,\n\tSpacer\n} from \"./components/index\";\nimport { Tools } from \"./tools\";\n\nimport { CartesianScales, Curves } from \"./services/index\";\n\nexport class AxisChart extends Chart {\n\tservices: any = Object.assign(this.services, {\n\t\tcartesianScales: CartesianScales,\n\t\tcurves: Curves\n\t});\n\n\tconstructor(holder: Element, chartConfigs: ChartConfig<AxisChartOptions>) {\n\t\tsuper(holder, chartConfigs);\n\t}\n\n\tprotected getAxisChartComponents(graphFrameComponents: any[]) {\n\t\tconst titleComponent = {\n\t\t\tid: \"title\",\n\t\t\tcomponents: [\n\t\t\t\tnew Title(this.model, this.services)\n\t\t\t],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst legendComponent = {\n\t\t\tid: \"legend\",\n\t\t\tcomponents: [\n\t\t\t\tnew Legend(this.model, this.services)\n\t\t\t],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst graphFrameComponent = {\n\t\t\tid: \"graph-frame\",\n\t\t\tcomponents: graphFrameComponents,\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.STRETCH,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst isLegendEnabled = this.model.getOptions().legend.enabled !== false;\n\n\t\t// Decide the position of the legend in reference to the chart\n\t\tlet fullFrameComponentDirection = LayoutDirection.COLUMN;\n\t\tif (isLegendEnabled) {\n\t\t\tconst legendPosition = Tools.getProperty(this.model.getOptions(), \"legend\", \"position\");\n\t\t\tif (legendPosition === LegendPositions.LEFT) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW;\n\n\t\t\t\tif (!this.model.getOptions().legend.orientation) {\n\t\t\t\t\tthis.model.getOptions().legend.orientation = LegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === LegendPositions.RIGHT) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW_REVERSE;\n\n\t\t\t\tif (!this.model.getOptions().legend.orientation) {\n\t\t\t\t\tthis.model.getOptions().legend.orientation = LegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === LegendPositions.BOTTOM) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;\n\t\t\t}\n\t\t}\n\n\t\tconst legendSpacerComponent = {\n\t\t\tid: \"spacer\",\n\t\t\tcomponents: [\n\t\t\t\tnew Spacer(this.model, this.services)\n\t\t\t],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst fullFrameComponent = {\n\t\t\tid: \"full-frame\",\n\t\t\tcomponents: [\n\t\t\t\tnew LayoutComponent(\n\t\t\t\t\tthis.model,\n\t\t\t\t\tthis.services,\n\t\t\t\t\t[\n\t\t\t\t\t\t...(isLegendEnabled ? [ legendComponent ] : [ ]),\n\t\t\t\t\t\tlegendSpacerComponent,\n\t\t\t\t\t\tgraphFrameComponent\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tdirection: fullFrameComponentDirection\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.STRETCH,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\t// Add chart title if it exists\n\t\tconst topLevelLayoutComponents = [];\n\t\tif (this.model.getOptions().title) {\n\t\t\ttopLevelLayoutComponents.push(titleComponent);\n\n\t\t\tconst titleSpacerComponent = {\n\t\t\t\tid: \"spacer\",\n\t\t\t\tcomponents: [\n\t\t\t\t\tnew Spacer(this.model, this.services)\n\t\t\t\t],\n\t\t\t\tgrowth: {\n\t\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttopLevelLayoutComponents.push(titleSpacerComponent);\n\t\t}\n\t\ttopLevelLayoutComponents.push(fullFrameComponent);\n\n\t\treturn [\n\t\t\tnew LayoutComponent(\n\t\t\t\tthis.model,\n\t\t\t\tthis.services,\n\t\t\t\ttopLevelLayoutComponents,\n\t\t\t\t{\n\t\t\t\t\tdirection: LayoutDirection.COLUMN\n\t\t\t\t}\n\t\t\t)\n\t\t];\n\t}\n}\n"]}
1
+ {"version":3,"file":"axis-chart.js","sourceRoot":"","sources":["axis-chart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACN,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAGf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,eAAe,EACf,MAAM,EACN,KAAK,EAGL,MAAM,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,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,iBAET,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC7C,qBAAqB;oBACrB,mBAAmB;oBAEpB;oBACC,SAAS,EAAE,2BAA2B;iBACtC,CACD;aACD;YACD,MAAM,EAAE;gBACP,CAAC,EAAE,YAAY,CAAC,OAAO;gBACvB,CAAC,EAAE,YAAY,CAAC,KAAK;aACrB;SACD,CAAC;QAEF,+BAA+B;QAC/B,IAAM,wBAAwB,GAAG,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE;YAClC,wBAAwB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAE9C,IAAM,oBAAoB,GAAG;gBAC5B,EAAE,EAAE,QAAQ;gBACZ,UAAU,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACnD,MAAM,EAAE;oBACP,CAAC,EAAE,YAAY,CAAC,SAAS;oBACzB,CAAC,EAAE,YAAY,CAAC,KAAK;iBACrB;aACD,CAAC;YAEF,wBAAwB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;SACpD;QACD,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAElD,OAAO;YACN,IAAI,eAAe,CAClB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,EACb,wBAAwB,EACxB;gBACC,SAAS,EAAE,eAAe,CAAC,MAAM;aACjC,CACD;SACD,CAAC;IACH,CAAC;IACF,gBAAC;AAAD,CAAC,AAhID,CAA+B,KAAK,GAgInC","sourcesContent":["import { Chart } from \"./chart\";\nimport {\n\tLayoutDirection,\n\tLayoutGrowth,\n\tLegendOrientations,\n\tLegendPositions,\n\tChartConfig,\n\tAxisChartOptions\n} from \"./interfaces/index\";\nimport {\n\tLayoutComponent,\n\tLegend,\n\tTitle,\n\tTooltip,\n\tTooltipBar,\n\tSpacer\n} from \"./components/index\";\nimport { Tools } from \"./tools\";\n\nimport { CartesianScales, Curves } from \"./services/index\";\n\nexport class AxisChart extends Chart {\n\tservices: any = Object.assign(this.services, {\n\t\tcartesianScales: CartesianScales,\n\t\tcurves: Curves\n\t});\n\n\tconstructor(holder: Element, chartConfigs: ChartConfig<AxisChartOptions>) {\n\t\tsuper(holder, chartConfigs);\n\t}\n\n\tprotected getAxisChartComponents(graphFrameComponents: any[]) {\n\t\tconst titleComponent = {\n\t\t\tid: \"title\",\n\t\t\tcomponents: [new Title(this.model, this.services)],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst legendComponent = {\n\t\t\tid: \"legend\",\n\t\t\tcomponents: [new Legend(this.model, this.services)],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst graphFrameComponent = {\n\t\t\tid: \"graph-frame\",\n\t\t\tcomponents: graphFrameComponents,\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.STRETCH,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst isLegendEnabled =\n\t\t\tthis.model.getOptions().legend.enabled !== false;\n\n\t\t// Decide the position of the legend in reference to the chart\n\t\tlet fullFrameComponentDirection = LayoutDirection.COLUMN;\n\t\tif (isLegendEnabled) {\n\t\t\tconst legendPosition = Tools.getProperty(\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\"legend\",\n\t\t\t\t\"position\"\n\t\t\t);\n\t\t\tif (legendPosition === LegendPositions.LEFT) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW;\n\n\t\t\t\tif (!this.model.getOptions().legend.orientation) {\n\t\t\t\t\tthis.model.getOptions().legend.orientation =\n\t\t\t\t\t\tLegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === LegendPositions.RIGHT) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW_REVERSE;\n\n\t\t\t\tif (!this.model.getOptions().legend.orientation) {\n\t\t\t\t\tthis.model.getOptions().legend.orientation =\n\t\t\t\t\t\tLegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === LegendPositions.BOTTOM) {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;\n\t\t\t}\n\t\t}\n\n\t\tconst legendSpacerComponent = {\n\t\t\tid: \"spacer\",\n\t\t\tcomponents: [new Spacer(this.model, this.services)],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\tconst fullFrameComponent = {\n\t\t\tid: \"full-frame\",\n\t\t\tcomponents: [\n\t\t\t\tnew LayoutComponent(\n\t\t\t\t\tthis.model,\n\t\t\t\t\tthis.services,\n\t\t\t\t\t[\n\t\t\t\t\t\t...(isLegendEnabled ? [legendComponent] : []),\n\t\t\t\t\t\tlegendSpacerComponent,\n\t\t\t\t\t\tgraphFrameComponent\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tdirection: fullFrameComponentDirection\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t],\n\t\t\tgrowth: {\n\t\t\t\tx: LayoutGrowth.STRETCH,\n\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t}\n\t\t};\n\n\t\t// Add chart title if it exists\n\t\tconst topLevelLayoutComponents = [];\n\t\tif (this.model.getOptions().title) {\n\t\t\ttopLevelLayoutComponents.push(titleComponent);\n\n\t\t\tconst titleSpacerComponent = {\n\t\t\t\tid: \"spacer\",\n\t\t\t\tcomponents: [new Spacer(this.model, this.services)],\n\t\t\t\tgrowth: {\n\t\t\t\t\tx: LayoutGrowth.PREFERRED,\n\t\t\t\t\ty: LayoutGrowth.FIXED\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttopLevelLayoutComponents.push(titleSpacerComponent);\n\t\t}\n\t\ttopLevelLayoutComponents.push(fullFrameComponent);\n\n\t\treturn [\n\t\t\tnew LayoutComponent(\n\t\t\t\tthis.model,\n\t\t\t\tthis.services,\n\t\t\t\ttopLevelLayoutComponents,\n\t\t\t\t{\n\t\t\t\t\tdirection: LayoutDirection.COLUMN\n\t\t\t\t}\n\t\t\t)\n\t\t];\n\t}\n}\n"]}
@@ -12,15 +12,15 @@ export declare const createVanillaChartApp: {
12
12
  "index.html": string;
13
13
  "src/index.js": string;
14
14
  "package.json": {
15
- "scripts": {
16
- "start": string;
17
- "build": string;
15
+ scripts: {
16
+ start: string;
17
+ build: string;
18
18
  };
19
- "dependencies": {
19
+ dependencies: {
20
20
  "@carbon/charts": any;
21
- "d3": string;
21
+ d3: string;
22
22
  };
23
- "devDependencies": {
23
+ devDependencies: {
24
24
  "parcel-bundler": string;
25
25
  };
26
26
  };
@@ -36,6 +36,7 @@ export declare const createReactChartApp: {
36
36
  (demo: any): {
37
37
  "src/index.html": string;
38
38
  "src/index.js": string;
39
+ "src/ibm-plex-font.css": string;
39
40
  "package.json": {
40
41
  dependencies: {
41
42
  "@carbon/charts": any;
@@ -60,6 +61,7 @@ export declare const createAngularChartApp: {
60
61
  "src/main.ts": string;
61
62
  "src/app/app.component.html": string;
62
63
  "src/app/app.component.ts": string;
64
+ "src/app/ibm-plex-font.css": string;
63
65
  "src/app/app.module.ts": string;
64
66
  ".angular-cli.json": string;
65
67
  "package.json": string;
@@ -74,6 +76,7 @@ export declare const createAngularChartApp: {
74
76
  export declare const createVueChartApp: {
75
77
  (demo: any): {
76
78
  "src/components/chart.vue": string;
79
+ "src/ibm-plex-font.css": string;
77
80
  "src/App.vue": string;
78
81
  "src/main.js": string;
79
82
  "package.json": string;
@@ -90,16 +93,16 @@ export declare const createSvelteChartApp: {
90
93
  "App.svelte": string;
91
94
  "index.js": string;
92
95
  "package.json": {
93
- "scripts": {
94
- "build": string;
95
- "autobuild": string;
96
- "dev": string;
97
- "start": string;
96
+ scripts: {
97
+ build: string;
98
+ autobuild: string;
99
+ dev: string;
100
+ start: string;
98
101
  "start:dev": string;
99
102
  };
100
- "devDependencies": {
103
+ devDependencies: {
101
104
  "npm-run-all": string;
102
- "rollup": string;
105
+ rollup: string;
103
106
  "rollup-plugin-commonjs": string;
104
107
  "rollup-plugin-node-resolve": string;
105
108
  "rollup-plugin-svelte": string;
@@ -94,7 +94,7 @@ export declare const simpleBarTimeSeriesOptions: {
94
94
  };
95
95
  };
96
96
  timeScale: {
97
- "localeObject": Locale;
97
+ localeObject: Locale;
98
98
  };
99
99
  };
100
100
  export declare const simpleHorizontalBarTimeSeriesOptions: {
@@ -24,7 +24,7 @@ export declare const lineOptions: {
24
24
  };
25
25
  };
26
26
  chartTypes: {
27
- "line": string[];
27
+ line: string[];
28
28
  };
29
29
  };
30
30
  export declare const lineTimeSeriesData: {
@@ -19,10 +19,10 @@ export interface AxisOptions {
19
19
  */
20
20
  domain?: AxisDomain[];
21
21
  /**
22
- * Whether the Axis should be forced to include 0 as a starting point
23
- * (or ending point, in case of all negative axis).
24
- * Default: true
25
- */
22
+ * Whether the Axis should be forced to include 0 as a starting point
23
+ * (or ending point, in case of all negative axis).
24
+ * Default: true
25
+ */
26
26
  includeZero?: boolean;
27
27
  /**
28
28
  * identifies what key within the data the axis values would map to
@@ -99,14 +99,14 @@ export interface TickFormats {
99
99
  }
100
100
  export interface TimeIntervalFormats {
101
101
  "15seconds"?: TickFormats;
102
- "minute"?: TickFormats;
102
+ minute?: TickFormats;
103
103
  "30minutes"?: TickFormats;
104
- "hourly"?: TickFormats;
105
- "daily"?: TickFormats;
106
- "weekly"?: TickFormats;
107
- "monthly"?: TickFormats;
108
- "quarterly"?: TickFormats;
109
- "yearly"?: TickFormats;
104
+ hourly?: TickFormats;
105
+ daily?: TickFormats;
106
+ weekly?: TickFormats;
107
+ monthly?: TickFormats;
108
+ quarterly?: TickFormats;
109
+ yearly?: TickFormats;
110
110
  }
111
111
  /**
112
112
  * customize the axes components
@@ -175,6 +175,7 @@ export interface PieChartOptions extends BaseChartOptions {
175
175
  export interface DonutChartOptions extends PieChartOptions {
176
176
  donut?: {
177
177
  center?: {
178
+ label?: string;
178
179
  numberFontSize?: Function;
179
180
  titleFontSize?: Function;
180
181
  titleYPosition?: Function;