@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/model.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["model.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,KAAK;AACL,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;qEACqE;AACrE;IAwBC,oBAAY,QAAa;QAfzB,uBAAuB;QACb,UAAK,GAAQ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C;QACtB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAA,SAAS;YACnC,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;gBACjC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;aAC9C;iBAAM;gBACN,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;aAC3C;YAED,IAAI,UAAU,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5C,UAAU,GAAG,CAAC,CAAC;aACf;iBAAM;gBACN,UAAU,EAAE,CAAC;aACb;QACF,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,YAAY,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;aAChD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,iBAAC;AAAD,CAAC,AA3aD,IA2aC","sourcesContent":["// Internal Imports\nimport * as Configuration from \"./configuration\";\nimport { Tools } from \"./tools\";\nimport * as colorPalettes from \"./services/colorPalettes\";\nimport { Events } from \"./interfaces\";\n\n// D3\nimport { scaleOrdinal } from \"d3-scale\";\nimport { map } from \"d3-collection\";\nimport { stack } from \"d3-shape\";\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\t// Callbacks\n\t/**\n\t * Function to be called when data or options update within the model\n\t * @type Function\n\t */\n\tprotected updateCallback: Function;\n\tprotected services: any;\n\n\t// Internal Model state\n\tprotected state: any = {\n\t\toptions: {}\n\t};\n\n\t// Data labels\n\t/**\n\t * A list of all the data groups that have existed within the lifetime of the chart\n\t * @type string[]\n\t */\n\tprotected allDataGroups: string[];\n\n\t// Fill scales & fill related objects\n\tprotected colorScale: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetDisplayData() {\n\t\tif (!this.get(\"data\")) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\t// Remove datasets that have been disabled\n\t\tconst displayData = Tools.clone(this.get(\"data\"));\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\treturn displayData.filter(datum => {\n\t\t\tconst group = dataGroups.find(group => group.name === datum[groupMapsTo]);\n\n\t\t\treturn group.status === ACTIVE;\n\t\t});\n\t}\n\n\tgetData() {\n\t\treturn this.get(\"data\");\n\t}\n\n\tisDataEmpty() {\n\t\treturn !this.getData().length;\n\t}\n\n\t/**\n\t *\n\t * @param newData The new raw data to be set\n\t */\n\tsetData(newData) {\n\t\tconst sanitizedData = this.sanitize(Tools.clone(newData));\n\t\tconst dataGroups = this.generateDataGroups(sanitizedData);\n\n\t\tthis.set({\n\t\t\tdata: sanitizedData,\n\t\t\tdataGroups\n\t\t});\n\n\t\treturn sanitizedData;\n\t}\n\n\tgetDataGroups() {\n\t\treturn this.get(\"dataGroups\");\n\t}\n\n\tgetActiveDataGroups() {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups().filter(dataGroup => dataGroup.status === ACTIVE);\n\t}\n\n\tgetDataGroupNames() {\n\t\treturn this.getDataGroups().map(dataGroup => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames() {\n\t\treturn this.getActiveDataGroups().map(dataGroup => dataGroup.name);\n\t}\n\n\tgetGroupedData() {\n\t\tconst displayData = this.getDisplayData();\n\t\tconst groupedData = {};\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\tdisplayData.map(datum => {\n\t\t\tconst group = datum[groupMapsTo];\n\t\t\tif (groupedData[group] !== null && groupedData[group] !== undefined) {\n\t\t\t\tgroupedData[group].push(datum);\n\t\t\t} else {\n\t\t\t\tgroupedData[group] = [datum];\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(groupedData)\n\t\t\t.map(groupName => ({\n\t\t\t\tname: groupName,\n\t\t\t\tdata: groupedData[groupName]\n\t\t\t}));\n\t}\n\n\tgetDataValuesGroupedByKeys() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst displayData = this.getDisplayData();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();\n\n\t\tconst stackKeys = map(displayData, datum => datum[domainIdentifier]).keys();\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\treturn stackKeys.map(key => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach(dataGroupName => {\n\t\t\t\tconst correspondingDatum = displayData.find(datum => {\n\t\t\t\t\treturn datum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum[domainIdentifier].toString() === key;\n\t\t\t\t});\n\n\t\t\t\tcorrespondingValues[dataGroupName] = correspondingDatum ? correspondingDatum[rangeIdentifier] : null;\n\t\t\t});\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys();\n\n\t\treturn stack().keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map(key => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, skipUpdate = false) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\n\t\tif (!skipUpdate) {\n\t\t\tthis.update();\n\t\t}\n\t}\n\n\tget(property?: string) {\n\t\tif (property) {\n\t\t\treturn this.state[property];\n\t\t} else {\n\t\t\treturn this.state;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param newOptions New options to be set\n\t */\n\tsetOptions(newOptions) {\n\t\tthis.set({\n\t\t\toptions: Tools.merge(this.getOptions(), newOptions)\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate() {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setColorScale();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE);\n\t}\n\n\tsetUpdateCallback(cb: Function) {\n\t\tthis.updateCallback = cb;\n\t}\n\n\t/*\n\t * Data labels\n\t*/\n\ttoggleDataLabel(changedLabel: string) {\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tconst hasDeactivatedItems = dataGroups.some(group => group.status === DISABLED);\n\t\tconst activeItems = dataGroups.filter(group => group.status === ACTIVE);\n\n\t\t// If there are deactivated items, toggle \"changedLabel\"\n\t\tif (hasDeactivatedItems) {\n\t\t\t// If the only active item is being toggled\n\t\t\t// Activate all items\n\t\t\tif (activeItems.length === 1 && activeItems[0].name === changedLabel) {\n\t\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\t\tdataGroups[i].status = ACTIVE;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst indexToChange = dataGroups.findIndex(group => group.name === changedLabel);\n\t\t\t\tdataGroups[indexToChange].status = dataGroups[indexToChange].status === DISABLED ? ACTIVE : DISABLED;\n\t\t\t}\n\t\t} else {\n\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\tdataGroups[i].status = (group.name === changedLabel ? ACTIVE : DISABLED);\n\t\t\t});\n\t\t}\n\n\t\t// dispatch legend filtering event with the status of all the dataLabels\n\t\tthis.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {\n\t\t\tdataGroups\n\t\t});\n\n\t\t// Update model\n\t\tthis.set({\n\t\t\tdataGroups\n\t\t});\n\t}\n\n\t/**\n\t * Should the data point be filled?\n\t * @param group\n\t * @param key\n\t * @param value\n\t * @param defaultFilled the default for this chart\n\t */\n\tgetIsFilled(group: any, key?: any, data?: any, defaultFilled?: boolean) {\n\t\tconst options = this.getOptions();\n\t\tif (options.getIsFilled) {\n\t\t\treturn options.getIsFilled(group, key, data, defaultFilled);\n\t\t} else {\n\t\t\treturn defaultFilled;\n\t\t}\n\t}\n\n\tgetFillColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultFillColor = this.getFillScale()(group);\n\t\tif (options.getFillColor) {\n\t\t\treturn options.getFillColor(group, key, data, defaultFillColor);\n\t\t} else {\n\t\t\treturn defaultFillColor;\n\t\t}\n\t}\n\n\tgetStrokeColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultStrokeColor = this.colorScale(group);\n\t\tif (options.getStrokeColor) {\n\t\t\treturn options.getStrokeColor(group, key, data, defaultStrokeColor);\n\t\t} else {\n\t\t\treturn defaultStrokeColor;\n\t\t}\n\t}\n\n\tgetFillScale() {\n\t\treturn this.colorScale;\n\t}\n\n\t/**\n\t * Converts data provided in the older format to tabular\n\t *\n\t */\n\tprotected transformToTabularData(data) {\n\t\tconsole.warn(\"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/tutorials--tabular-data-format\")\n\t\tconst tabularData = [];\n\t\tconst { datasets, labels } = data;\n\n\t\t// Loop through all datasets\n\t\tdatasets.forEach(dataset => {\n\t\t\t// Update each data point to the new format\n\t\t\tdataset.data.forEach((datum, i) => {\n\t\t\t\tlet group;\n\n\t\t\t\tconst datasetLabel = Tools.getProperty(dataset, \"label\");\n\t\t\t\tif (datasetLabel === null) {\n\t\t\t\t\tconst correspondingLabel = Tools.getProperty(labels, i);\n\t\t\t\t\tif (correspondingLabel) {\n\t\t\t\t\t\tgroup = correspondingLabel;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgroup = \"Ungrouped\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgroup = datasetLabel;\n\t\t\t\t}\n\n\t\t\t\tconst updatedDatum = {\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey: labels[i]\n\t\t\t\t};\n\n\t\t\t\tif (isNaN(datum)) {\n\t\t\t\t\tupdatedDatum[\"value\"] = datum.value;\n\t\t\t\t\tupdatedDatum[\"date\"] = datum.date;\n\t\t\t\t} else {\n\t\t\t\t\tupdatedDatum[\"value\"] = datum;\n\t\t\t\t}\n\n\t\t\t\ttabularData.push(updatedDatum);\n\t\t\t});\n\t\t});\n\n\t\treturn tabularData;\n\t}\n\n\tprotected getTabularData(data) {\n\t\t// if data is not an array\n\t\tif (!Array.isArray(data)) {\n\t\t\treturn this.transformToTabularData(data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\treturn this.getTabularData(data);\n\t}\n\n\t/*\n\t * Data groups\n\t*/\n\tprotected updateAllDataGroups() {\n\t\t// allDataGroups is used to generate a color scale that applies\n\t\t// to all the groups. Now when the data updates, you might remove a group,\n\t\t// and then bring it back in a newer data update, therefore\n\t\t// the order of the groups in allDataGroups matters so that you'd never\n\t\t// have an incorrect color assigned to a group.\n\n\t\t// Also, a new group should only be added to allDataGroups if\n\t\t// it doesn't currently exist\n\n\t\tif (!this.allDataGroups) {\n\t\t\tthis.allDataGroups = this.getDataGroupNames();\n\t\t} else {\n\t\t\t// Loop through current data groups\n\t\t\tthis.getDataGroupNames().forEach(dataGroupName => {\n\t\t\t\t// If group name hasn't been stored yet, store it\n\t\t\t\tif (this.allDataGroups.indexOf(dataGroupName) === -1) {\n\t\t\t\t\tthis.allDataGroups.push(dataGroupName);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected generateDataGroups(data) {\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\tconst uniqueDataGroups = map(data, datum => datum[groupMapsTo]).keys();\n\t\treturn uniqueDataGroups.map(groupName => ({\n\t\t\tname: groupName,\n\t\t\tstatus: ACTIVE\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t*/\n\tprotected setColorScale() {\n\t\tlet defaultColors = colorPalettes.DEFAULT;\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, \"color\", \"scale\");\n\n\t\t// If there is no valid user provided scale, use the default set of colors\n\t\tif (userProvidedScale === null || Object.keys(userProvidedScale).length === 0) {\n\t\t\tthis.colorScale = scaleOrdinal().range(defaultColors)\n\t\t\t\t.domain(this.allDataGroups);\n\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * Go through allDataGroups. If a data group has a color value provided\n\t\t * by the user, add that to the color range\n\t\t * If not, add a default color\n\t\t */\n\t\tconst colorRange = [];\n\t\tlet colorIndex = 0;\n\t\tthis.allDataGroups.forEach(dataGroup => {\n\t\t\tif (userProvidedScale[dataGroup]) {\n\t\t\t\tcolorRange.push(userProvidedScale[dataGroup]);\n\t\t\t} else {\n\t\t\t\tcolorRange.push(defaultColors[colorIndex]);\n\t\t\t}\n\n\t\t\tif (colorIndex === defaultColors.length - 1) {\n\t\t\t\tcolorIndex = 0;\n\t\t\t} else {\n\t\t\t\tcolorIndex++;\n\t\t\t}\n\t\t});\n\n\t\tthis.colorScale = scaleOrdinal().range(colorRange)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["model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AG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAEvE,0EAA0E;QAC1E,IACC,iBAAiB,KAAK,IAAI;YAC1B,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,KAAK,CAAC,EAC1C;YACD,IAAI,CAAC,UAAU,GAAG,YAAY,EAAE;iBAC9B,KAAK,CAAC,aAAa,CAAC;iBACpB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAE7B,OAAO;SACP;QAED;;;;WAIG;QACH,IAAM,UAAU,GAAG,EAAE,CAAC;QACtB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAA,SAAS;YACnC,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;gBACjC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;aAC9C;iBAAM;gBACN,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;aAC3C;YAED,IAAI,UAAU,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5C,UAAU,GAAG,CAAC,CAAC;aACf;iBAAM;gBACN,UAAU,EAAE,CAAC;aACb;QACF,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,YAAY,EAAE;aAC9B,KAAK,CAAC,UAAU,CAAC;aACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,iBAAC;AAAD,CAAC,AA3cD,IA2cC","sourcesContent":["// Internal Imports\nimport * as Configuration from \"./configuration\";\nimport { Tools } from \"./tools\";\nimport * as colorPalettes from \"./services/colorPalettes\";\nimport { Events } from \"./interfaces\";\n\n// D3\nimport { scaleOrdinal } from \"d3-scale\";\nimport { map } from \"d3-collection\";\nimport { stack } from \"d3-shape\";\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\t// Callbacks\n\t/**\n\t * Function to be called when data or options update within the model\n\t * @type Function\n\t */\n\tprotected updateCallback: Function;\n\tprotected services: any;\n\n\t// Internal Model state\n\tprotected state: any = {\n\t\toptions: {}\n\t};\n\n\t// Data labels\n\t/**\n\t * A list of all the data groups that have existed within the lifetime of the chart\n\t * @type string[]\n\t */\n\tprotected allDataGroups: string[];\n\n\t// Fill scales & fill related objects\n\tprotected colorScale: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetDisplayData() {\n\t\tif (!this.get(\"data\")) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\t// Remove datasets that have been disabled\n\t\tconst displayData = Tools.clone(this.get(\"data\"));\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\treturn displayData.filter(datum => {\n\t\t\tconst group = dataGroups.find(\n\t\t\t\tgroup => group.name === datum[groupMapsTo]\n\t\t\t);\n\n\t\t\treturn group.status === ACTIVE;\n\t\t});\n\t}\n\n\tgetData() {\n\t\treturn this.get(\"data\");\n\t}\n\n\tisDataEmpty() {\n\t\treturn !this.getData().length;\n\t}\n\n\t/**\n\t *\n\t * @param newData The new raw data to be set\n\t */\n\tsetData(newData) {\n\t\tconst sanitizedData = this.sanitize(Tools.clone(newData));\n\t\tconst dataGroups = this.generateDataGroups(sanitizedData);\n\n\t\tthis.set({\n\t\t\tdata: sanitizedData,\n\t\t\tdataGroups\n\t\t});\n\n\t\treturn sanitizedData;\n\t}\n\n\tgetDataGroups() {\n\t\treturn this.get(\"dataGroups\");\n\t}\n\n\tgetActiveDataGroups() {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups().filter(\n\t\t\tdataGroup => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames() {\n\t\treturn this.getDataGroups().map(dataGroup => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames() {\n\t\treturn this.getActiveDataGroups().map(dataGroup => dataGroup.name);\n\t}\n\n\tgetGroupedData() {\n\t\tconst displayData = this.getDisplayData();\n\t\tconst groupedData = {};\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\tdisplayData.map(datum => {\n\t\t\tconst group = datum[groupMapsTo];\n\t\t\tif (\n\t\t\t\tgroupedData[group] !== null &&\n\t\t\t\tgroupedData[group] !== undefined\n\t\t\t) {\n\t\t\t\tgroupedData[group].push(datum);\n\t\t\t} else {\n\t\t\t\tgroupedData[group] = [datum];\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(groupedData).map(groupName => ({\n\t\t\tname: groupName,\n\t\t\tdata: groupedData[groupName]\n\t\t}));\n\t}\n\n\tgetDataValuesGroupedByKeys() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst displayData = this.getDisplayData();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();\n\n\t\tconst stackKeys = map(\n\t\t\tdisplayData,\n\t\t\tdatum => datum[domainIdentifier]\n\t\t).keys();\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\treturn stackKeys.map(key => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach(dataGroupName => {\n\t\t\t\tconst correspondingDatum = displayData.find(datum => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum[domainIdentifier].toString() === key\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tcorrespondingValues[dataGroupName] = correspondingDatum\n\t\t\t\t\t? correspondingDatum[rangeIdentifier]\n\t\t\t\t\t: null;\n\t\t\t});\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys();\n\n\t\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map(key => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, skipUpdate = false) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\n\t\tif (!skipUpdate) {\n\t\t\tthis.update();\n\t\t}\n\t}\n\n\tget(property?: string) {\n\t\tif (property) {\n\t\t\treturn this.state[property];\n\t\t} else {\n\t\t\treturn this.state;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param newOptions New options to be set\n\t */\n\tsetOptions(newOptions) {\n\t\tthis.set({\n\t\t\toptions: Tools.merge(this.getOptions(), newOptions)\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate() {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setColorScale();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE);\n\t}\n\n\tsetUpdateCallback(cb: Function) {\n\t\tthis.updateCallback = cb;\n\t}\n\n\t/*\n\t * Data labels\n\t */\n\ttoggleDataLabel(changedLabel: string) {\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tconst hasDeactivatedItems = dataGroups.some(\n\t\t\tgroup => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(group => group.status === ACTIVE);\n\n\t\t// If there are deactivated items, toggle \"changedLabel\"\n\t\tif (hasDeactivatedItems) {\n\t\t\t// If the only active item is being toggled\n\t\t\t// Activate all items\n\t\t\tif (\n\t\t\t\tactiveItems.length === 1 &&\n\t\t\t\tactiveItems[0].name === changedLabel\n\t\t\t) {\n\t\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\t\tdataGroups[i].status = ACTIVE;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst indexToChange = dataGroups.findIndex(\n\t\t\t\t\tgroup => group.name === changedLabel\n\t\t\t\t);\n\t\t\t\tdataGroups[indexToChange].status =\n\t\t\t\t\tdataGroups[indexToChange].status === DISABLED\n\t\t\t\t\t\t? ACTIVE\n\t\t\t\t\t\t: DISABLED;\n\t\t\t}\n\t\t} else {\n\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\tdataGroups[i].status =\n\t\t\t\t\tgroup.name === changedLabel ? ACTIVE : DISABLED;\n\t\t\t});\n\t\t}\n\n\t\t// dispatch legend filtering event with the status of all the dataLabels\n\t\tthis.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {\n\t\t\tdataGroups\n\t\t});\n\n\t\t// Update model\n\t\tthis.set({\n\t\t\tdataGroups\n\t\t});\n\t}\n\n\t/**\n\t * Should the data point be filled?\n\t * @param group\n\t * @param key\n\t * @param value\n\t * @param defaultFilled the default for this chart\n\t */\n\tgetIsFilled(group: any, key?: any, data?: any, defaultFilled?: boolean) {\n\t\tconst options = this.getOptions();\n\t\tif (options.getIsFilled) {\n\t\t\treturn options.getIsFilled(group, key, data, defaultFilled);\n\t\t} else {\n\t\t\treturn defaultFilled;\n\t\t}\n\t}\n\n\tgetFillColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultFillColor = this.getFillScale()(group);\n\t\tif (options.getFillColor) {\n\t\t\treturn options.getFillColor(group, key, data, defaultFillColor);\n\t\t} else {\n\t\t\treturn defaultFillColor;\n\t\t}\n\t}\n\n\tgetStrokeColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultStrokeColor = this.colorScale(group);\n\t\tif (options.getStrokeColor) {\n\t\t\treturn options.getStrokeColor(group, key, data, defaultStrokeColor);\n\t\t} else {\n\t\t\treturn defaultStrokeColor;\n\t\t}\n\t}\n\n\tgetFillScale() {\n\t\treturn this.colorScale;\n\t}\n\n\t/**\n\t * Converts data provided in the older format to tabular\n\t *\n\t */\n\tprotected transformToTabularData(data) {\n\t\tconsole.warn(\n\t\t\t\"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/tutorials--tabular-data-format\"\n\t\t);\n\t\tconst tabularData = [];\n\t\tconst { datasets, labels } = data;\n\n\t\t// Loop through all datasets\n\t\tdatasets.forEach(dataset => {\n\t\t\t// Update each data point to the new format\n\t\t\tdataset.data.forEach((datum, i) => {\n\t\t\t\tlet group;\n\n\t\t\t\tconst datasetLabel = Tools.getProperty(dataset, \"label\");\n\t\t\t\tif (datasetLabel === null) {\n\t\t\t\t\tconst correspondingLabel = Tools.getProperty(labels, i);\n\t\t\t\t\tif (correspondingLabel) {\n\t\t\t\t\t\tgroup = correspondingLabel;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgroup = \"Ungrouped\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgroup = datasetLabel;\n\t\t\t\t}\n\n\t\t\t\tconst updatedDatum = {\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey: labels[i]\n\t\t\t\t};\n\n\t\t\t\tif (isNaN(datum)) {\n\t\t\t\t\tupdatedDatum[\"value\"] = datum.value;\n\t\t\t\t\tupdatedDatum[\"date\"] = datum.date;\n\t\t\t\t} else {\n\t\t\t\t\tupdatedDatum[\"value\"] = datum;\n\t\t\t\t}\n\n\t\t\t\ttabularData.push(updatedDatum);\n\t\t\t});\n\t\t});\n\n\t\treturn tabularData;\n\t}\n\n\tprotected getTabularData(data) {\n\t\t// if data is not an array\n\t\tif (!Array.isArray(data)) {\n\t\t\treturn this.transformToTabularData(data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\treturn this.getTabularData(data);\n\t}\n\n\t/*\n\t * Data groups\n\t */\n\tprotected updateAllDataGroups() {\n\t\t// allDataGroups is used to generate a color scale that applies\n\t\t// to all the groups. Now when the data updates, you might remove a group,\n\t\t// and then bring it back in a newer data update, therefore\n\t\t// the order of the groups in allDataGroups matters so that you'd never\n\t\t// have an incorrect color assigned to a group.\n\n\t\t// Also, a new group should only be added to allDataGroups if\n\t\t// it doesn't currently exist\n\n\t\tif (!this.allDataGroups) {\n\t\t\tthis.allDataGroups = this.getDataGroupNames();\n\t\t} else {\n\t\t\t// Loop through current data groups\n\t\t\tthis.getDataGroupNames().forEach(dataGroupName => {\n\t\t\t\t// If group name hasn't been stored yet, store it\n\t\t\t\tif (this.allDataGroups.indexOf(dataGroupName) === -1) {\n\t\t\t\t\tthis.allDataGroups.push(dataGroupName);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected generateDataGroups(data) {\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\tconst uniqueDataGroups = map(data, datum => datum[groupMapsTo]).keys();\n\t\treturn uniqueDataGroups.map(groupName => ({\n\t\t\tname: groupName,\n\t\t\tstatus: ACTIVE\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setColorScale() {\n\t\tlet defaultColors = colorPalettes.DEFAULT;\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, \"color\", \"scale\");\n\n\t\t// If there is no valid user provided scale, use the default set of colors\n\t\tif (\n\t\t\tuserProvidedScale === null ||\n\t\t\tObject.keys(userProvidedScale).length === 0\n\t\t) {\n\t\t\tthis.colorScale = scaleOrdinal()\n\t\t\t\t.range(defaultColors)\n\t\t\t\t.domain(this.allDataGroups);\n\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * Go through allDataGroups. If a data group has a color value provided\n\t\t * by the user, add that to the color range\n\t\t * If not, add a default color\n\t\t */\n\t\tconst colorRange = [];\n\t\tlet colorIndex = 0;\n\t\tthis.allDataGroups.forEach(dataGroup => {\n\t\t\tif (userProvidedScale[dataGroup]) {\n\t\t\t\tcolorRange.push(userProvidedScale[dataGroup]);\n\t\t\t} else {\n\t\t\t\tcolorRange.push(defaultColors[colorIndex]);\n\t\t\t}\n\n\t\t\tif (colorIndex === defaultColors.length - 1) {\n\t\t\t\tcolorIndex = 0;\n\t\t\t} else {\n\t\t\t\tcolorIndex++;\n\t\t\t}\n\t\t});\n\n\t\tthis.colorScale = scaleOrdinal()\n\t\t\t.range(colorRange)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon/charts",
3
- "version": "0.30.24",
3
+ "version": "0.30.25",
4
4
  "description": "Carbon charting components",
5
5
  "main": "./bundle.js",
6
6
  "module": "./index.js",
@@ -13,6 +13,7 @@
13
13
  "test": "karma start --single-run",
14
14
  "test:watch": "karma start --no-single-run",
15
15
  "clean": "rm -rf dist demo/bundle",
16
+ "format": "prettier . --write \"**/*.{scss,css,js,ts,md}\"",
16
17
  "start": "yarn run storybook",
17
18
  "storybook": "start-storybook -p 9006 -c .storybook -s ./.storybook/assets"
18
19
  },
@@ -96,6 +97,7 @@
96
97
  "lerna": "3.13.4",
97
98
  "marked": "0.8.2",
98
99
  "mini-css-extract-plugin": "0.9.0",
100
+ "prettier": "2.0.5",
99
101
  "raw-loader": "0.5.1",
100
102
  "react-docgen-typescript-loader": "^3.6.0",
101
103
  "rollup": "1.27.10",
@@ -113,7 +115,7 @@
113
115
  "typescript": "3.7.5",
114
116
  "url-loader": "0.6.2",
115
117
  "webpack": "4.41.0",
116
- "webpack-cli": "3.3.9",
118
+ "webpack-cli": "3.3.11",
117
119
  "webpack-dev-server": "3.7.0"
118
120
  },
119
121
  "publishConfig": {
package/polyfills.js CHANGED
@@ -4,7 +4,11 @@ if (typeof window !== "undefined") {
4
4
  return false;
5
5
  }
6
6
  function CustomEvent(event, params) {
7
- params = params || { bubbles: false, cancelable: false, detail: undefined };
7
+ params = params || {
8
+ bubbles: false,
9
+ cancelable: false,
10
+ detail: undefined
11
+ };
8
12
  var evt = document.createEvent("CustomEvent");
9
13
  evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
10
14
  return evt;
@@ -14,7 +18,8 @@ if (typeof window !== "undefined") {
14
18
  })();
15
19
  // Avoid multiple instances of babel-polyfill
16
20
  function idempotentBabelPolyfill() {
17
- if ((typeof global !== "undefined" && !global["_babelPolyfill"]) || !window["_babelPolyfill"]) {
21
+ if ((typeof global !== "undefined" && !global["_babelPolyfill"]) ||
22
+ !window["_babelPolyfill"]) {
18
23
  return require("babel-polyfill");
19
24
  }
20
25
  return null;
package/polyfills.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["polyfills.ts"],"names":[],"mappings":"AAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAClC,CAAC;QACA,IAAI,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,EAAE;YAAE,OAAO,KAAK,CAAC;SAAE;QAElE,SAAS,WAAW,CAAC,KAAK,EAAE,MAAM;YACjC,MAAM,GAAG,MAAM,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;YAC5E,IAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAChD,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YAC7E,OAAO,GAAG,CAAC;QACZ,CAAC;QAED,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;QAClD,MAAM,CAAC,aAAa,CAAC,GAAG,WAAkB,CAAC;IAC5C,CAAC,CAAC,EAAE,CAAC;IAEL,6CAA6C;IAC7C,SAAS,uBAAuB;QAC/B,IAAI,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;YAC9F,OAAO,OAAO,CAAC,gBAAgB,CAAC,CAAC;SACjC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED,uBAAuB,EAAE,CAAC;CAC1B","sourcesContent":["if (typeof window !== \"undefined\") {\n\t(function() {\n\t\tif (typeof window[\"CustomEvent\"] === \"function\") { return false; }\n\n\t\tfunction CustomEvent(event, params) {\n\t\t\tparams = params || { bubbles: false, cancelable: false, detail: undefined };\n\t\t\tconst evt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\treturn evt;\n\t\t}\n\n\t\tCustomEvent.prototype = window[\"Event\"].prototype;\n\t\twindow[\"CustomEvent\"] = CustomEvent as any;\n\t})();\n\n\t// Avoid multiple instances of babel-polyfill\n\tfunction idempotentBabelPolyfill() {\n\t\tif ((typeof global !== \"undefined\" && !global[\"_babelPolyfill\"]) || !window[\"_babelPolyfill\"]) {\n\t\t\treturn require(\"babel-polyfill\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tidempotentBabelPolyfill();\n}\n"]}
1
+ {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["polyfills.ts"],"names":[],"mappings":"AAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAClC,CAAC;QACA,IAAI,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,EAAE;YAChD,OAAO,KAAK,CAAC;SACb;QAED,SAAS,WAAW,CAAC,KAAK,EAAE,MAAM;YACjC,MAAM,GAAG,MAAM,IAAI;gBAClB,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,SAAS;aACjB,CAAC;YACF,IAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAChD,GAAG,CAAC,eAAe,CAClB,KAAK,EACL,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,MAAM,CACb,CAAC;YACF,OAAO,GAAG,CAAC;QACZ,CAAC;QAED,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;QAClD,MAAM,CAAC,aAAa,CAAC,GAAG,WAAkB,CAAC;IAC5C,CAAC,CAAC,EAAE,CAAC;IAEL,6CAA6C;IAC7C,SAAS,uBAAuB;QAC/B,IACC,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC5D,CAAC,MAAM,CAAC,gBAAgB,CAAC,EACxB;YACD,OAAO,OAAO,CAAC,gBAAgB,CAAC,CAAC;SACjC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED,uBAAuB,EAAE,CAAC;CAC1B","sourcesContent":["if (typeof window !== \"undefined\") {\n\t(function() {\n\t\tif (typeof window[\"CustomEvent\"] === \"function\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tfunction CustomEvent(event, params) {\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\t\t\tconst evt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(\n\t\t\t\tevent,\n\t\t\t\tparams.bubbles,\n\t\t\t\tparams.cancelable,\n\t\t\t\tparams.detail\n\t\t\t);\n\t\t\treturn evt;\n\t\t}\n\n\t\tCustomEvent.prototype = window[\"Event\"].prototype;\n\t\twindow[\"CustomEvent\"] = CustomEvent as any;\n\t})();\n\n\t// Avoid multiple instances of babel-polyfill\n\tfunction idempotentBabelPolyfill() {\n\t\tif (\n\t\t\t(typeof global !== \"undefined\" && !global[\"_babelPolyfill\"]) ||\n\t\t\t!window[\"_babelPolyfill\"]\n\t\t) {\n\t\t\treturn require(\"babel-polyfill\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tidempotentBabelPolyfill();\n}\n"]}
@@ -2,28 +2,53 @@ import { TextAnchor, DominantBaseline } from "../interfaces/enums";
2
2
  export function radialLabelPlacement(angleRadians) {
3
3
  var angle = mod(radToDeg(angleRadians), 360);
4
4
  if (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {
5
- return { textAnchor: TextAnchor.START, dominantBaseline: DominantBaseline.MIDDLE };
5
+ return {
6
+ textAnchor: TextAnchor.START,
7
+ dominantBaseline: DominantBaseline.MIDDLE
8
+ };
6
9
  }
7
10
  else if (isInRange(angle, [10, 80])) {
8
- return { textAnchor: TextAnchor.START, dominantBaseline: DominantBaseline.HANGING };
11
+ return {
12
+ textAnchor: TextAnchor.START,
13
+ dominantBaseline: DominantBaseline.HANGING
14
+ };
9
15
  }
10
16
  else if (isInRange(angle, [80, 100])) {
11
- return { textAnchor: TextAnchor.MIDDLE, dominantBaseline: DominantBaseline.HANGING };
17
+ return {
18
+ textAnchor: TextAnchor.MIDDLE,
19
+ dominantBaseline: DominantBaseline.HANGING
20
+ };
12
21
  }
13
22
  else if (isInRange(angle, [100, 170])) {
14
- return { textAnchor: TextAnchor.END, dominantBaseline: DominantBaseline.HANGING };
23
+ return {
24
+ textAnchor: TextAnchor.END,
25
+ dominantBaseline: DominantBaseline.HANGING
26
+ };
15
27
  }
16
28
  else if (isInRange(angle, [170, 190])) {
17
- return { textAnchor: TextAnchor.END, dominantBaseline: DominantBaseline.MIDDLE };
29
+ return {
30
+ textAnchor: TextAnchor.END,
31
+ dominantBaseline: DominantBaseline.MIDDLE
32
+ };
18
33
  }
19
34
  else if (isInRange(angle, [190, 260])) {
20
- return { textAnchor: TextAnchor.END, dominantBaseline: DominantBaseline.BASELINE };
35
+ return {
36
+ textAnchor: TextAnchor.END,
37
+ dominantBaseline: DominantBaseline.BASELINE
38
+ };
21
39
  }
22
40
  else if (isInRange(angle, [260, 280])) {
23
- return { textAnchor: TextAnchor.MIDDLE, dominantBaseline: DominantBaseline.BASELINE };
41
+ return {
42
+ textAnchor: TextAnchor.MIDDLE,
43
+ dominantBaseline: DominantBaseline.BASELINE
44
+ };
24
45
  }
25
- else { // 280 - 350
26
- return { textAnchor: TextAnchor.START, dominantBaseline: DominantBaseline.BASELINE };
46
+ else {
47
+ // 280 - 350
48
+ return {
49
+ textAnchor: TextAnchor.START,
50
+ dominantBaseline: DominantBaseline.BASELINE
51
+ };
27
52
  }
28
53
  }
29
54
  function mod(n, m) {
@@ -1 +1 @@
1
- {"version":3,"file":"angle-utils.js","sourceRoot":"","sources":["angle-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAcnE,MAAM,UAAU,oBAAoB,CAAC,YAAmB;IACvD,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;IAE/C,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5D,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,gBAAg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ent":["import { TextAnchor, DominantBaseline } from \"../interfaces/enums\";\n\nexport interface Point {\n\tx: number;\n\ty: number;\n}\n\nexport type Angle = number;\n\ninterface LabelAlignment {\n\ttextAnchor: TextAnchor;\n\tdominantBaseline: DominantBaseline;\n}\n\nexport function radialLabelPlacement(angleRadians: Angle): LabelAlignment {\n\tconst angle = mod(radToDeg(angleRadians), 360);\n\n\tif (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {\n\t\treturn { textAnchor: TextAnchor.START, dominantBaseline: DominantBaseline.MIDDLE };\n\t} else if (isInRange(angle, [10, 80])) {\n\t\treturn { textAnchor: TextAnchor.START, dominantBaseline: DominantBaseline.HANGING };\n\t} else if (isInRange(angle, [80, 100])) {\n\t\treturn { textAnchor: TextAnchor.MIDDLE, dominantBaseline: DominantBaseline.HANGING };\n\t} else if (isInRange(angle, [100, 170])) {\n\t\treturn { textAnchor: TextAnchor.END, dominantBaseline: DominantBaseline.HANGING };\n\t} else if (isInRange(angle, [170, 190])) {\n\t\treturn { textAnchor: TextAnchor.END, dominantBaseline: DominantBaseline.MIDDLE };\n\t} else if (isInRange(angle, [190, 260])) {\n\t\treturn { textAnchor: TextAnchor.END, dominantBaseline: DominantBaseline.BASELINE };\n\t} else if (isInRange(angle, [260, 280])) {\n\t\treturn { textAnchor: TextAnchor.MIDDLE, dominantBaseline: DominantBaseline.BASELINE };\n\t} else { // 280 - 350\n\t\treturn { textAnchor: TextAnchor.START, dominantBaseline: DominantBaseline.BASELINE };\n\t}\n}\n\nfunction mod(n: number, m: number) {\n\treturn ((n % m) + m) % m;\n}\n\nfunction isInRange(x: number, [min, max]: [number, number]) {\n\treturn x >= min && x <= max;\n}\n\nexport function radToDeg(rad: Angle): Angle {\n\treturn rad * (180 / Math.PI);\n}\n\nexport function degToRad(deg: Angle): Angle {\n\treturn deg * (Math.PI / 180);\n}\n\nexport function polarToCartesianCoords(a: Angle, r: number, t: Point = { x: 0, y: 0 }): Point {\n\tconst x = r * Math.cos(a) + t.x;\n\tconst y = r * Math.sin(a) + t.y;\n\treturn { x, y };\n}\n\n// Return the distance between a point (described with polar coordinates)\n// on a circumference and the vertical diameter.\n// If the point is on the left if the diameter, its distance is positive,\n// if it is on the right of the diameter, its distance is negative.\nexport function distanceBetweenPointOnCircAndVerticalDiameter(a: Angle, r: number) {\n\treturn r * Math.sin(a - Math.PI / 2);\n}\n"]}
1
+ {"version":3,"file":"angle-utils.js","sourceRoot":"","sources":["angle-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAcnE,MAAM,UAAU,oBAAoB,CAAC,YAAmB;IACvD,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;IAE/C,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5D,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,gBAAgB,EAAE,gBAAgB,CAAC,MAAM;SACzC,CAAC;KACF;SAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE;QACtC,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,KAAK;YAC5B,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;SAC1C,CAAC;KACF;SAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE;QACvC,OAAO;YACN,UAAU,EAAE,UAAU,CAAC,MAAM;YAC7B,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;SAC1C,CAAC;KACF;SAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;QACxC,OAAO;YACN,UAAU,EAAE,UA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AC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACrC,CAAQ,EACR,CAAS,EACT,CAAyB;IAAzB,kBAAA,EAAA,MAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAEzB,IAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC,IAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC;AACjB,CAAC;AAED,yEAAyE;AACzE,gDAAgD;AAChD,yEAAyE;AACzE,mEAAmE;AACnE,MAAM,UAAU,6CAA6C,CAC5D,CAAQ,EACR,CAAS;IAET,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { TextAnchor, DominantBaseline } from \"../interfaces/enums\";\n\nexport interface Point {\n\tx: number;\n\ty: number;\n}\n\nexport type Angle = number;\n\ninterface LabelAlignment {\n\ttextAnchor: TextAnchor;\n\tdominantBaseline: DominantBaseline;\n}\n\nexport function radialLabelPlacement(angleRadians: Angle): LabelAlignment {\n\tconst angle = mod(radToDeg(angleRadians), 360);\n\n\tif (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.MIDDLE\n\t\t};\n\t} else if (isInRange(angle, [10, 80])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.HANGING\n\t\t};\n\t} else if (isInRange(angle, [80, 100])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.MIDDLE,\n\t\t\tdominantBaseline: DominantBaseline.HANGING\n\t\t};\n\t} else if (isInRange(angle, [100, 170])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.HANGING\n\t\t};\n\t} else if (isInRange(angle, [170, 190])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.MIDDLE\n\t\t};\n\t} else if (isInRange(angle, [190, 260])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.END,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE\n\t\t};\n\t} else if (isInRange(angle, [260, 280])) {\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.MIDDLE,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE\n\t\t};\n\t} else {\n\t\t// 280 - 350\n\t\treturn {\n\t\t\ttextAnchor: TextAnchor.START,\n\t\t\tdominantBaseline: DominantBaseline.BASELINE\n\t\t};\n\t}\n}\n\nfunction mod(n: number, m: number) {\n\treturn ((n % m) + m) % m;\n}\n\nfunction isInRange(x: number, [min, max]: [number, number]) {\n\treturn x >= min && x <= max;\n}\n\nexport function radToDeg(rad: Angle): Angle {\n\treturn rad * (180 / Math.PI);\n}\n\nexport function degToRad(deg: Angle): Angle {\n\treturn deg * (Math.PI / 180);\n}\n\nexport function polarToCartesianCoords(\n\ta: Angle,\n\tr: number,\n\tt: Point = { x: 0, y: 0 }\n): Point {\n\tconst x = r * Math.cos(a) + t.x;\n\tconst y = r * Math.sin(a) + t.y;\n\treturn { x, y };\n}\n\n// Return the distance between a point (described with polar coordinates)\n// on a circumference and the vertical diameter.\n// If the point is on the left if the diameter, its distance is positive,\n// if it is on the right of the diameter, its distance is negative.\nexport function distanceBetweenPointOnCircAndVerticalDiameter(\n\ta: Angle,\n\tr: number\n) {\n\treturn r * Math.sin(a - Math.PI / 2);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","sourceRoot":"","sources":["colors.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,GAAG,EACH,IAAI,EACJ,MAAM,gBAAgB,CAAC;AAExB,IAAM,QAAQ,GAAG,UAAC,GAAG,EAAE,KAAK,IAAK,OAAA,GAAG,CAAC,KAAK,CAAC,EAAV,CAAU,CAAC;AAE5C,eAAe;IACd,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAArB,CAAqB;IACpC,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAArB,CAAqB;IACpC,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAtB,CAAsB;IACtC,OAAO,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAxB,CAAwB;IAC1C,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,EAAvB,CAAuB;IACxC,GAAG,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,EAApB,CAAoB;IAClC,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAArB,CAAqB;CACpC,CAAC","sourcesContent":["import {\n\tblue,\n\tcyan,\n\tgreen,\n\tmagenta,\n\tpurple,\n\tred,\n\tteal\n} from \"@carbon/colors\";\n\nconst getColor = (obj, shade) => obj[shade];\n\nexport default {\n\tblue: shade => getColor(blue, shade),\n\tcyan: shade => getColor(cyan, shade),\n\tgreen: shade => getColor(green, shade),\n\tmagenta: shade => getColor(magenta, shade),\n\tpurple: shade => getColor(purple, shade),\n\tred: shade => getColor(red, shade),\n\tteal: shade => getColor(teal, shade)\n};\n"]}
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE/E,IAAM,QAAQ,GAAG,UAAC,GAAG,EAAE,KAAK,IAAK,OAAA,GAAG,CAAC,KAAK,CAAC,EAAV,CAAU,CAAC;AAE5C,eAAe;IACd,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAArB,CAAqB;IACpC,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAArB,CAAqB;IACpC,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,EAAtB,CAAsB;IACtC,OAAO,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAxB,CAAwB;IAC1C,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,EAAvB,CAAuB;IACxC,GAAG,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,EAApB,CAAoB;IAClC,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAArB,CAAqB;CACpC,CAAC","sourcesContent":["import { blue, cyan, green, magenta, purple, red, teal } from \"@carbon/colors\";\n\nconst getColor = (obj, shade) => obj[shade];\n\nexport default {\n\tblue: shade => getColor(blue, shade),\n\tcyan: shade => getColor(cyan, shade),\n\tgreen: shade => getColor(green, shade),\n\tmagenta: shade => getColor(magenta, shade),\n\tpurple: shade => getColor(purple, shade),\n\tred: shade => getColor(red, shade),\n\tteal: shade => getColor(teal, shade)\n};\n"]}
@@ -46,10 +46,12 @@ var Curves = /** @class */ (function (_super) {
46
46
  // Parse curve type whether the user provided a string
47
47
  // Or an object with more options
48
48
  if (curveOptions) {
49
- if (typeof curveOptions === "string") { // curve: 'string'
49
+ if (typeof curveOptions === "string") {
50
+ // curve: 'string'
50
51
  curveName = curveOptions;
51
52
  }
52
- else { // curve: { name: 'string' }
53
+ else {
54
+ // curve: { name: 'string' }
53
55
  curveName = curveOptions.name;
54
56
  }
55
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"curves.js","sourceRoot":"","sources":["curves.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EAMf,MAAM,UAAU,CAAC;AAKlB,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;IAA4B,0BAAO;IAAnC;QAAA,qEAuDC;QAtDA,gBAAU,GAAG;YACZ,WAAW,aAAA;YACX,iBAAiB,mBAAA;YACjB,UAAU,YAAA;YACV,gBAAgB,kBAAA;YAChB,cAAc,gBAAA;YACd,WAAW,aAAA;YACX,aAAa,eAAA;YACb,mBAAmB,qBAAA;YACnB,iBAAiB,mBAAA;YACjB,eAAe,iBAAA;YACf,qBAAqB,uBAAA;YACrB,mBAAmB,qBAAA;YACnB,cAAc,gBAAA;YACd,cAAc,gBAAA;YACd,YAAY,cAAA;YACZ,SAAS,WAAA;YACT,cAAc,gBAAA;YACd,eAAe,iBAAA;SACf,CAAC;;IAmCH,CAAC;IAjCA,2BAAU,GAAV;QACC,IAAI,SAAS,GAAG,aAAa,CAAC;QAC9B,IAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;QAEnD,sDAAsD;QACtD,iCAAiC;QACjC,IAAI,YAAY,EAAE;YACjB,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,EAAE,kBAAkB;gBACzD,SAAS,GAAG,YAAY,CAAC;aACzB;iBAAM,EAAE,4BAA4B;gBACpC,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC;aAC9B;SACD;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC/B,iCAAiC;YACjC,IAAI,OAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAEvC,8CAA8C;YAC9C,IAAI,YAAY,EAAE;gBACjB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAA,UAAU;oBAC3C,IAAI,OAAK,CAAC,UAAU,CAAC,EAAE;wBACtB,OAAK,GAAG,OAAK,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;qBACpD;gBACF,CAAC,CAAC,CAAC;aACH;YAED,OAAO,OAAK,CAAC;SACb;QAED,OAAO,CAAC,IAAI,CAAC,qBAAmB,SAAS,8CAA2C,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC;IACF,aAAC;AAAD,CAAC,AAvDD,CAA4B,OAAO,GAuDlC","sourcesContent":["import {\n\tcurveBasis,\n\tcurveBasisClosed,\n\tcurveBasisOpen,\n\tcurveBundle,\n\tcurveCardinal,\n\tcurveCardinalClosed,\n\tcurveCardinalOpen,\n\tcurveCatmullRom,\n\tcurveCatmullRomClosed,\n\tcurveCatmullRomOpen,\n\tcurveLinear,\n\tcurveLinearClosed,\n\tcurveMonotoneX,\n\tcurveMonotoneY,\n\tcurveNatural,\n\tcurveStep,\n\tcurveStepAfter,\n\tcurveStepBefore,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tCurveBundleFactory,\n\tCurveCardinalFactory,\n\tCurveCatmullRomFactory,\n\tCurveGenerator\n} from \"d3-shape\";\n\n// this import is needed because of typescript bug (error TS4029)\nimport { Path } from \"d3-path\";\n\n// Internal Imports\nimport { Service } from \"./service\";\n\nexport class Curves extends Service {\n\tcurveTypes = {\n\t\tcurveLinear,\n\t\tcurveLinearClosed,\n\t\tcurveBasis,\n\t\tcurveBasisClosed,\n\t\tcurveBasisOpen,\n\t\tcurveBundle,\n\t\tcurveCardinal,\n\t\tcurveCardinalClosed,\n\t\tcurveCardinalOpen,\n\t\tcurveCatmullRom,\n\t\tcurveCatmullRomClosed,\n\t\tcurveCatmullRomOpen,\n\t\tcurveMonotoneX,\n\t\tcurveMonotoneY,\n\t\tcurveNatural,\n\t\tcurveStep,\n\t\tcurveStepAfter,\n\t\tcurveStepBefore\n\t};\n\n\tgetD3Curve() {\n\t\tlet curveName = \"curveLinear\";\n\t\tconst curveOptions = this.model.getOptions().curve;\n\n\t\t// Parse curve type whether the user provided a string\n\t\t// Or an object with more options\n\t\tif (curveOptions) {\n\t\t\tif (typeof curveOptions === \"string\") { // curve: 'string'\n\t\t\t\tcurveName = curveOptions;\n\t\t\t} else { // curve: { name: 'string' }\n\t\t\t\tcurveName = curveOptions.name;\n\t\t\t}\n\t\t}\n\n\t\tif (this.curveTypes[curveName]) {\n\t\t\t// Grab correct d3 curve function\n\t\t\tlet curve = this.curveTypes[curveName];\n\n\t\t\t// Apply user-provided options to the d3 curve\n\t\t\tif (curveOptions) {\n\t\t\t\tObject.keys(curveOptions).forEach(optionName => {\n\t\t\t\t\tif (curve[optionName]) {\n\t\t\t\t\t\tcurve = curve[optionName](curveOptions[optionName]);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn curve;\n\t\t}\n\n\t\tconsole.warn(`The curve type '${curveName}' is invalid, using 'curveLinear' instead`);\n\t\treturn this.curveTypes[\"curveLinear\"];\n\t}\n}\n"]}
1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AAE;YAC/B,iCAAiC;YACjC,IAAI,OAAK,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAEvC,8CAA8C;YAC9C,IAAI,YAAY,EAAE;gBACjB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAA,UAAU;oBAC3C,IAAI,OAAK,CAAC,UAAU,CAAC,EAAE;wBACtB,OAAK,GAAG,OAAK,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;qBACpD;gBACF,CAAC,CAAC,CAAC;aACH;YAED,OAAO,OAAK,CAAC;SACb;QAED,OAAO,CAAC,IAAI,CACX,qBAAmB,SAAS,8CAA2C,CACvE,CAAC;QACF,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC;IACF,aAAC;AAAD,CAAC,AA3DD,CAA4B,OAAO,GA2DlC","sourcesContent":["import {\n\tcurveBasis,\n\tcurveBasisClosed,\n\tcurveBasisOpen,\n\tcurveBundle,\n\tcurveCardinal,\n\tcurveCardinalClosed,\n\tcurveCardinalOpen,\n\tcurveCatmullRom,\n\tcurveCatmullRomClosed,\n\tcurveCatmullRomOpen,\n\tcurveLinear,\n\tcurveLinearClosed,\n\tcurveMonotoneX,\n\tcurveMonotoneY,\n\tcurveNatural,\n\tcurveStep,\n\tcurveStepAfter,\n\tcurveStepBefore,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tCurveBundleFactory,\n\tCurveCardinalFactory,\n\tCurveCatmullRomFactory,\n\tCurveGenerator\n} from \"d3-shape\";\n\n// this import is needed because of typescript bug (error TS4029)\nimport { Path } from \"d3-path\";\n\n// Internal Imports\nimport { Service } from \"./service\";\n\nexport class Curves extends Service {\n\tcurveTypes = {\n\t\tcurveLinear,\n\t\tcurveLinearClosed,\n\t\tcurveBasis,\n\t\tcurveBasisClosed,\n\t\tcurveBasisOpen,\n\t\tcurveBundle,\n\t\tcurveCardinal,\n\t\tcurveCardinalClosed,\n\t\tcurveCardinalOpen,\n\t\tcurveCatmullRom,\n\t\tcurveCatmullRomClosed,\n\t\tcurveCatmullRomOpen,\n\t\tcurveMonotoneX,\n\t\tcurveMonotoneY,\n\t\tcurveNatural,\n\t\tcurveStep,\n\t\tcurveStepAfter,\n\t\tcurveStepBefore\n\t};\n\n\tgetD3Curve() {\n\t\tlet curveName = \"curveLinear\";\n\t\tconst curveOptions = this.model.getOptions().curve;\n\n\t\t// Parse curve type whether the user provided a string\n\t\t// Or an object with more options\n\t\tif (curveOptions) {\n\t\t\tif (typeof curveOptions === \"string\") {\n\t\t\t\t// curve: 'string'\n\t\t\t\tcurveName = curveOptions;\n\t\t\t} else {\n\t\t\t\t// curve: { name: 'string' }\n\t\t\t\tcurveName = curveOptions.name;\n\t\t\t}\n\t\t}\n\n\t\tif (this.curveTypes[curveName]) {\n\t\t\t// Grab correct d3 curve function\n\t\t\tlet curve = this.curveTypes[curveName];\n\n\t\t\t// Apply user-provided options to the d3 curve\n\t\t\tif (curveOptions) {\n\t\t\t\tObject.keys(curveOptions).forEach(optionName => {\n\t\t\t\t\tif (curve[optionName]) {\n\t\t\t\t\t\tcurve = curve[optionName](curveOptions[optionName]);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn curve;\n\t\t}\n\n\t\tconsole.warn(\n\t\t\t`The curve type '${curveName}' is invalid, using 'curveLinear' instead`\n\t\t);\n\t\treturn this.curveTypes[\"curveLinear\"];\n\t}\n}\n"]}
@@ -123,7 +123,8 @@ var DOMUtils = /** @class */ (function (_super) {
123
123
  var elementToAppend = querySections[0];
124
124
  var selection = parent.select(query);
125
125
  if (selection.empty()) {
126
- return parent.append(elementToAppend)
126
+ return parent
127
+ .append(elementToAppend)
127
128
  .attr("class", querySections.slice(1).join(" "));
128
129
  }
129
130
  return selection;
@@ -188,8 +189,8 @@ var DOMUtils = /** @class */ (function (_super) {
188
189
  if (!holder) {
189
190
  return;
190
191
  }
191
- if (Math.abs(containerWidth - holder.clientWidth) > 1
192
- || Math.abs(containerHeight - holder.clientHeight) > 1) {
192
+ if (Math.abs(containerWidth - holder.clientWidth) > 1 ||
193
+ Math.abs(containerHeight - holder.clientHeight) > 1) {
193
194
  containerWidth = holder.clientWidth;
194
195
  containerHeight = holder.clientHeight;
195
196
  _this.services.events.dispatchEvent(Events.Chart.RESIZE);
@@ -1 +1 @@
1
- {"version":3,"file":"dom-utils.js","sourceRoot":"","sources":["dom-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,aAAa;AACb,OAAO,EAAE,MAAM,EAAa,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,yCAAyC;AACzC,OAAO,QAAQ,MAAM,0CAA0C,CAAC;AAEhE,OAAO;AACP,OAAO,cAAc,MAAM,0BAA0B,CAAC;AAEtD;IAA8B,4BAAO;IAArC;;IAuNA,CAAC;IAtNO,0BAAiB,GAAxB,UAAyB,WAA0C,EAAE,OAAa;QACjF,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;YACtB,WAAW,GAAG,MAAM,CAAC,WAAkB,CAAC,CAAC;SACzC;QAED,IAAM,eAAe,GAAG;YACvB,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;SACT,CAAC;QAEF,IAAM,wBAAwB,GAAG,UAAA,UAAU;YAC1C,IAAI,UAAU,EAAE;gBACf,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,UAAA,YAAY;oBAChD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE;wBAC7B,IAAM,SAAS,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;wBAC3C,IAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;wBAC9C,IA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AI,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC;mBACjD,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;gBACxD,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC;gBACpC,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC;gBAEtC,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACxD;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,kDAAkD;QAClD,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;QAC1D,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACF,eAAC;AAAD,CAAC,AAvND,CAA8B,OAAO,GAuNpC","sourcesContent":["// Internal Imports\nimport { Service } from \"../service\";\nimport { Events } from \"./../../interfaces\";\n\n// D3 Imports\nimport { select, Selection } from \"d3-selection\";\nimport { Tools } from \"../../tools\";\n\n// import the settings for the css prefix\nimport settings from \"carbon-components/es/globals/js/settings\";\n\n// MISC\nimport ResizeObserver from \"resize-observer-polyfill\";\n\nexport class DOMUtils extends Service {\n\tstatic getSVGElementSize(svgSelector: Selection<any, any, any, any>, options?: any) {\n\t\tif (!svgSelector.attr) {\n\t\t\tsvgSelector = select(svgSelector as any);\n\t\t}\n\n\t\tconst finalDimensions = {\n\t\t\twidth: 0,\n\t\t\theight: 0\n\t\t};\n\n\t\tconst validateAndSetDimensions = dimensions => {\n\t\t\tif (dimensions) {\n\t\t\t\tObject.keys(finalDimensions).forEach(dimensionKey => {\n\t\t\t\t\tif (dimensions[dimensionKey]) {\n\t\t\t\t\t\tconst dimension = dimensions[dimensionKey];\n\t\t\t\t\t\tconst dimensionNumber = parseFloat(dimension);\n\t\t\t\t\t\tif (dimension &&\n\t\t\t\t\t\t\tdimensionNumber > finalDimensions[dimensionKey] &&\n\t\t\t\t\t\t\t(\"\" + dimension).indexOf(\"%\") === -1) {\n\t\t\t\t\t\t\tfinalDimensions[dimensionKey] = dimensionNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tconst attrDimensions = {\n\t\t\twidth: svgSelector.attr(\"width\"),\n\t\t\theight: svgSelector.attr(\"height\")\n\t\t};\n\n\t\tlet bbox, bboxDimensions, boundingRect, boundingRectDimensions;\n\t\t// In many versions of Firefox\n\t\t// getBBox will cause an \"NSFailure\" error\n\t\ttry {\n\t\t\tbbox = svgSelector.node().getBBox();\n\t\t\tbboxDimensions = {\n\t\t\t\twidth: bbox.width,\n\t\t\t\theight: bbox.height\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\ttry {\n\t\t\tboundingRect = svgSelector.node().getBoundingClientRect();\n\t\t\tboundingRectDimensions = {\n\t\t\t\twidth: boundingRect.width,\n\t\t\t\theight: boundingRect.height\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\tconst clientDimensions = {\n\t\t\twidth: svgSelector.node().clientWidth,\n\t\t\theight: svgSelector.node().clientHeight\n\t\t};\n\n\t\t// If both attribute values are numbers\n\t\t// And not percentages or NaN\n\t\tif (options) {\n\t\t\tif (options.useAttrs) {\n\t\t\t\tvalidateAndSetDimensions(attrDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn finalDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useClientDimensions) {\n\t\t\t\tvalidateAndSetDimensions(clientDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn clientDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBBox) {\n\t\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn bboxDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBoundingRect) {\n\t\t\t\tvalidateAndSetDimensions(boundingRectDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn boundingRectDimensions;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst nativeDimensions = {\n\t\t\t\twidth: Tools.getProperty(svgSelector.node(), \"width\", \"baseVal\", \"value\"),\n\t\t\t\theight: Tools.getProperty(svgSelector.node(), \"height\", \"baseVal\", \"value\")\n\t\t\t};\n\n\t\t\tvalidateAndSetDimensions(nativeDimensions);\n\t\t} catch (e) {\n\t\t\tvalidateAndSetDimensions(clientDimensions);\n\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\t\t\tvalidateAndSetDimensions(attrDimensions);\n\t\t}\n\n\t\treturn finalDimensions;\n\t}\n\n\tstatic appendOrSelect(parent, query) {\n\t\tconst querySections = query.split(\".\");\n\t\tconst elementToAppend = querySections[0];\n\n\t\tconst selection = parent.select(query);\n\t\tif (selection.empty()) {\n\t\t\treturn parent.append(elementToAppend)\n\t\t\t\t.attr(\"class\", querySections.slice(1).join(\" \"));\n\t\t}\n\n\t\treturn selection;\n\t}\n\n\tprotected svg: Element;\n\tprotected width: string;\n\tprotected height: string;\n\n\tinit() {\n\t\t// Add width & height to the chart holder if necessary, and add a classname\n\t\tthis.styleHolderElement();\n\n\t\t// Add main SVG\n\t\tthis.addSVGElement();\n\n\t\tif (this.model.getOptions().resizable) {\n\t\t\tthis.addResizeListener();\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.styleHolderElement();\n\t}\n\n\tstyleHolderElement() {\n\t\tconst holderElement = this.getHolder() as HTMLElement;\n\n\t\t// Add class to chart holder\n\t\tselect(this.getHolder()).classed(`${settings.prefix}--chart-holder`, true);\n\n\t\t// In order for resize events to not clash with these updates\n\t\t// We'll check if the width & height values passed in options\n\t\t// Have changed, before setting them to the holder\n\t\tconst { width, height } = this.model.getOptions();\n\t\tif (width !== this.width) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.width = width;\n\n\t\t\tthis.width = width;\n\t\t}\n\n\t\tif (height !== this.height) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.height = height;\n\n\t\t\tthis.height = height;\n\t\t}\n\t}\n\n\tgetHolder() {\n\t\treturn this.model.get(\"holder\");\n\t}\n\n\taddSVGElement() {\n\t\tconst chartsprefix = Tools.getProperty(this.model.getOptions(), \"style\", \"prefix\");\n\t\tconst svg = select(this.getHolder())\n\t\t\t.append(\"svg\")\n\t\t\t.classed(`${settings.prefix}--${chartsprefix}--chart-svg`, true)\n\t\t\t.attr(\"height\", \"100%\")\n\t\t\t.attr(\"width\", \"100%\");\n\n\t\tthis.svg = svg.node();\n\t}\n\n\tgetMainSVG() {\n\t\treturn this.svg;\n\t}\n\n\taddResizeListener() {\n\t\tconst holder = this.getHolder();\n\n\t\tif (!holder) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Grab current dimensions of the chart holder\n\t\tlet containerWidth = holder.clientWidth;\n\t\tlet containerHeight = holder.clientHeight;\n\n\t\t// The resize callback function\n\t\tconst resizeCallback = Tools.debounce((entries, observer) => {\n\t\t\tif (!holder) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Math.abs(containerWidth - holder.clientWidth) > 1\n\t\t\t\t|| Math.abs(containerHeight - holder.clientHeight) > 1) {\n\t\t\t\tcontainerWidth = holder.clientWidth;\n\t\t\t\tcontainerHeight = holder.clientHeight;\n\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.RESIZE);\n\t\t\t}\n\t\t}, 12.5);\n\n\t\t// Observe the behaviour of resizing on the holder\n\t\tconst resizeObserver = new ResizeObserver(resizeCallback);\n\t\tresizeObserver.observe(holder);\n\t}\n}\n"]}
1
+ {"version":3,"file":"dom-utils.js","sourceRoot":"","sources":["dom-utils.ts"],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AC,MAAM,CAAC,CAAC;aACxD;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,kDAAkD;QAClD,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;QAC1D,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACF,eAAC;AAAD,CAAC,AAhPD,CAA8B,OAAO,GAgPpC","sourcesContent":["// Internal Imports\nimport { Service } from \"../service\";\nimport { Events } from \"./../../interfaces\";\n\n// D3 Imports\nimport { select, Selection } from \"d3-selection\";\nimport { Tools } from \"../../tools\";\n\n// import the settings for the css prefix\nimport settings from \"carbon-components/es/globals/js/settings\";\n\n// MISC\nimport ResizeObserver from \"resize-observer-polyfill\";\n\nexport class DOMUtils extends Service {\n\tstatic getSVGElementSize(\n\t\tsvgSelector: Selection<any, any, any, any>,\n\t\toptions?: any\n\t) {\n\t\tif (!svgSelector.attr) {\n\t\t\tsvgSelector = select(svgSelector as any);\n\t\t}\n\n\t\tconst finalDimensions = {\n\t\t\twidth: 0,\n\t\t\theight: 0\n\t\t};\n\n\t\tconst validateAndSetDimensions = dimensions => {\n\t\t\tif (dimensions) {\n\t\t\t\tObject.keys(finalDimensions).forEach(dimensionKey => {\n\t\t\t\t\tif (dimensions[dimensionKey]) {\n\t\t\t\t\t\tconst dimension = dimensions[dimensionKey];\n\t\t\t\t\t\tconst dimensionNumber = parseFloat(dimension);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdimension &&\n\t\t\t\t\t\t\tdimensionNumber > finalDimensions[dimensionKey] &&\n\t\t\t\t\t\t\t(\"\" + dimension).indexOf(\"%\") === -1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfinalDimensions[dimensionKey] = dimensionNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tconst attrDimensions = {\n\t\t\twidth: svgSelector.attr(\"width\"),\n\t\t\theight: svgSelector.attr(\"height\")\n\t\t};\n\n\t\tlet bbox, bboxDimensions, boundingRect, boundingRectDimensions;\n\t\t// In many versions of Firefox\n\t\t// getBBox will cause an \"NSFailure\" error\n\t\ttry {\n\t\t\tbbox = svgSelector.node().getBBox();\n\t\t\tbboxDimensions = {\n\t\t\t\twidth: bbox.width,\n\t\t\t\theight: bbox.height\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\ttry {\n\t\t\tboundingRect = svgSelector.node().getBoundingClientRect();\n\t\t\tboundingRectDimensions = {\n\t\t\t\twidth: boundingRect.width,\n\t\t\t\theight: boundingRect.height\n\t\t\t};\n\t\t} catch (e) {}\n\n\t\tconst clientDimensions = {\n\t\t\twidth: svgSelector.node().clientWidth,\n\t\t\theight: svgSelector.node().clientHeight\n\t\t};\n\n\t\t// If both attribute values are numbers\n\t\t// And not percentages or NaN\n\t\tif (options) {\n\t\t\tif (options.useAttrs) {\n\t\t\t\tvalidateAndSetDimensions(attrDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn finalDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useClientDimensions) {\n\t\t\t\tvalidateAndSetDimensions(clientDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn clientDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBBox) {\n\t\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn bboxDimensions;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (options.useBoundingRect) {\n\t\t\t\tvalidateAndSetDimensions(boundingRectDimensions);\n\n\t\t\t\tif (finalDimensions.width > 0 && finalDimensions.height > 0) {\n\t\t\t\t\treturn boundingRectDimensions;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst nativeDimensions = {\n\t\t\t\twidth: Tools.getProperty(\n\t\t\t\t\tsvgSelector.node(),\n\t\t\t\t\t\"width\",\n\t\t\t\t\t\"baseVal\",\n\t\t\t\t\t\"value\"\n\t\t\t\t),\n\t\t\t\theight: Tools.getProperty(\n\t\t\t\t\tsvgSelector.node(),\n\t\t\t\t\t\"height\",\n\t\t\t\t\t\"baseVal\",\n\t\t\t\t\t\"value\"\n\t\t\t\t)\n\t\t\t};\n\n\t\t\tvalidateAndSetDimensions(nativeDimensions);\n\t\t} catch (e) {\n\t\t\tvalidateAndSetDimensions(clientDimensions);\n\t\t\tvalidateAndSetDimensions(bboxDimensions);\n\t\t\tvalidateAndSetDimensions(attrDimensions);\n\t\t}\n\n\t\treturn finalDimensions;\n\t}\n\n\tstatic appendOrSelect(parent, query) {\n\t\tconst querySections = query.split(\".\");\n\t\tconst elementToAppend = querySections[0];\n\n\t\tconst selection = parent.select(query);\n\t\tif (selection.empty()) {\n\t\t\treturn parent\n\t\t\t\t.append(elementToAppend)\n\t\t\t\t.attr(\"class\", querySections.slice(1).join(\" \"));\n\t\t}\n\n\t\treturn selection;\n\t}\n\n\tprotected svg: Element;\n\tprotected width: string;\n\tprotected height: string;\n\n\tinit() {\n\t\t// Add width & height to the chart holder if necessary, and add a classname\n\t\tthis.styleHolderElement();\n\n\t\t// Add main SVG\n\t\tthis.addSVGElement();\n\n\t\tif (this.model.getOptions().resizable) {\n\t\t\tthis.addResizeListener();\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.styleHolderElement();\n\t}\n\n\tstyleHolderElement() {\n\t\tconst holderElement = this.getHolder() as HTMLElement;\n\n\t\t// Add class to chart holder\n\t\tselect(this.getHolder()).classed(\n\t\t\t`${settings.prefix}--chart-holder`,\n\t\t\ttrue\n\t\t);\n\n\t\t// In order for resize events to not clash with these updates\n\t\t// We'll check if the width & height values passed in options\n\t\t// Have changed, before setting them to the holder\n\t\tconst { width, height } = this.model.getOptions();\n\t\tif (width !== this.width) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.width = width;\n\n\t\t\tthis.width = width;\n\t\t}\n\n\t\tif (height !== this.height) {\n\t\t\t// Apply formatted width attribute to chart\n\t\t\tholderElement.style.height = height;\n\n\t\t\tthis.height = height;\n\t\t}\n\t}\n\n\tgetHolder() {\n\t\treturn this.model.get(\"holder\");\n\t}\n\n\taddSVGElement() {\n\t\tconst chartsprefix = Tools.getProperty(\n\t\t\tthis.model.getOptions(),\n\t\t\t\"style\",\n\t\t\t\"prefix\"\n\t\t);\n\t\tconst svg = select(this.getHolder())\n\t\t\t.append(\"svg\")\n\t\t\t.classed(`${settings.prefix}--${chartsprefix}--chart-svg`, true)\n\t\t\t.attr(\"height\", \"100%\")\n\t\t\t.attr(\"width\", \"100%\");\n\n\t\tthis.svg = svg.node();\n\t}\n\n\tgetMainSVG() {\n\t\treturn this.svg;\n\t}\n\n\taddResizeListener() {\n\t\tconst holder = this.getHolder();\n\n\t\tif (!holder) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Grab current dimensions of the chart holder\n\t\tlet containerWidth = holder.clientWidth;\n\t\tlet containerHeight = holder.clientHeight;\n\n\t\t// The resize callback function\n\t\tconst resizeCallback = Tools.debounce((entries, observer) => {\n\t\t\tif (!holder) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tMath.abs(containerWidth - holder.clientWidth) > 1 ||\n\t\t\t\tMath.abs(containerHeight - holder.clientHeight) > 1\n\t\t\t) {\n\t\t\t\tcontainerWidth = holder.clientWidth;\n\t\t\t\tcontainerHeight = holder.clientHeight;\n\n\t\t\t\tthis.services.events.dispatchEvent(Events.Chart.RESIZE);\n\t\t\t}\n\t\t}, 12.5);\n\n\t\t// Observe the behaviour of resizing on the holder\n\t\tconst resizeObserver = new ResizeObserver(resizeCallback);\n\t\tresizeObserver.observe(holder);\n\t}\n}\n"]}
@@ -28,8 +28,7 @@ var Transitions = /** @class */ (function (_super) {
28
28
  // transitions: Transition<any, any, any, any>[];
29
29
  Transitions.prototype.init = function () {
30
30
  var _this = this;
31
- this.services.events
32
- .addEventListener(Events.Model.UPDATE, function () {
31
+ this.services.events.addEventListener(Events.Model.UPDATE, function () {
33
32
  _this.pendingTransitions = {};
34
33
  });
35
34
  };
@@ -38,8 +37,8 @@ var Transitions = /** @class */ (function (_super) {
38
37
  if (this.model.getOptions().animations === false || animate === false) {
39
38
  return this.getInstantTransition(name);
40
39
  }
41
- var t = transition(name)
42
- .duration(Tools.getProperty(Configuration.transitions, name, "duration") || Configuration.transitions.default.duration);
40
+ var t = transition(name).duration(Tools.getProperty(Configuration.transitions, name, "duration") ||
41
+ Configuration.transitions.default.duration);
43
42
  this.pendingTransitions[t._id] = t;
44
43
  t.on("end interrupt cancel", function () {
45
44
  delete _this.pendingTransitions[t._id];
@@ -1 +1 @@
1
- {"version":3,"file":"transitions.js","sourceRoot":"","sources":["transitions.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,aAAa;AACb,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD;IAAiC,+BAAO;IAAxC;QAAA,qEAyCC;QAxCA,wBAAkB,GAAG,EAAE,CAAC;;IAwCzB,CAAC;IAvCA,iDAAiD;IAEjD,0BAAI,GAAJ;QAAA,iBAKC;QAJA,IAAI,CAAC,QAAQ,CAAC,MAAM;aAClB,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;YACtC,KAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,mCAAa,GAAb,UAAc,IAAa,EAAE,OAAiB;QAA9C,iBAcC;QAbA,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,KAAK,KAAK,IAAI,OAAO,KAAK,KAAK,EAAE;YACtE,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;SACvC;QAED,IAAM,CAAC,GAAQ,UAAU,CAAC,IAAI,CAAC;aAC7B,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEzH,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,EAAE,CAAC,sBAAsB,EAAE;YAC5B,OAAO,KAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC;IACV,CAAC;IAED,0CAAoB,GAApB,UAAqB,IAAa;QAAlC,iBASC;QARA,IAAM,CAAC,GAAS,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE7C,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,EAAE,CAAC,sBAAsB,EAAE;YAC5B,OAAO,KAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC;IACV,CAAC;IAED,2CAAqB,GAArB;QACC,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IACF,kBAAC;AAAD,CAAC,AAzCD,CAAiC,OAAO,GAyCvC","sourcesContent":["// Internal Imports\nimport { Service } from \"../service\";\nimport * as Configuration from \"../../configuration\";\nimport { Events } from \"./../../interfaces\";\nimport { Tools } from \"../../tools\";\n\n// D3 Imports\nimport { Transition, transition } from \"d3-transition\";\n\nexport class Transitions extends Service {\n\tpendingTransitions = {};\n\t// transitions: Transition<any, any, any, any>[];\n\n\tinit() {\n\t\tthis.services.events\n\t\t\t.addEventListener(Events.Model.UPDATE, () => {\n\t\t\t\tthis.pendingTransitions = {};\n\t\t\t});\n\t}\n\n\tgetTransition(name?: string, animate?: boolean): Transition<any, any, any, any> {\n\t\tif (this.model.getOptions().animations === false || animate === false) {\n\t\t\treturn this.getInstantTransition(name);\n\t\t}\n\n\t\tconst t: any = transition(name)\n\t\t\t.duration(Tools.getProperty(Configuration.transitions, name, \"duration\") || Configuration.transitions.default.duration);\n\n\t\tthis.pendingTransitions[t._id] = t;\n\t\tt.on(\"end interrupt cancel\", () => {\n\t\t\tdelete this.pendingTransitions[t._id];\n\t\t});\n\n\t\treturn t;\n\t}\n\n\tgetInstantTransition(name?: string): Transition<any, any, any, any> {\n\t\tconst t: any = transition(name).duration(0);\n\n\t\tthis.pendingTransitions[t._id] = t;\n\t\tt.on(\"end interrupt cancel\", () => {\n\t\t\tdelete this.pendingTransitions[t._id];\n\t\t});\n\n\t\treturn t;\n\t}\n\n\tgetPendingTransitions() {\n\t\treturn this.pendingTransitions;\n\t}\n}\n"]}
1
+ {"version":3,"file":"transitions.js","sourceRoot":"","sources":["transitions.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,aAAa;AACb,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD;IAAiC,+BAAO;IAAxC;QAAA,qEA6CC;QA5CA,wBAAkB,GAAG,EAAE,CAAC;;IA4CzB,CAAC;IA3CA,iDAAiD;IAEjD,0BAAI,GAAJ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;IACV,CAAC;IAED,2CAAqB,GAArB;QACC,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IACF,kBAAC;AAAD,CAAC,AA7CD,CAAiC,OAAO,GA6CvC","sourcesContent":["// Internal Imports\nimport { Service } from \"../service\";\nimport * as Configuration from \"../../configuration\";\nimport { Events } from \"./../../interfaces\";\nimport { Tools } from \"../../tools\";\n\n// D3 Imports\nimport { Transition, transition } from \"d3-transition\";\n\nexport class Transitions extends Service {\n\tpendingTransitions = {};\n\t// transitions: Transition<any, any, any, any>[];\n\n\tinit() {\n\t\tthis.services.events.addEventListener(Events.Model.UPDATE, () => {\n\t\t\tthis.pendingTransitions = {};\n\t\t});\n\t}\n\n\tgetTransition(\n\t\tname?: string,\n\t\tanimate?: boolean\n\t): Transition<any, any, any, any> {\n\t\tif (this.model.getOptions().animations === false || animate === false) {\n\t\t\treturn this.getInstantTransition(name);\n\t\t}\n\n\t\tconst t: any = transition(name).duration(\n\t\t\tTools.getProperty(Configuration.transitions, name, \"duration\") ||\n\t\t\t\tConfiguration.transitions.default.duration\n\t\t);\n\n\t\tthis.pendingTransitions[t._id] = t;\n\t\tt.on(\"end interrupt cancel\", () => {\n\t\t\tdelete this.pendingTransitions[t._id];\n\t\t});\n\n\t\treturn t;\n\t}\n\n\tgetInstantTransition(name?: string): Transition<any, any, any, any> {\n\t\tconst t: any = transition(name).duration(0);\n\n\t\tthis.pendingTransitions[t._id] = t;\n\t\tt.on(\"end interrupt cancel\", () => {\n\t\t\tdelete this.pendingTransitions[t._id];\n\t\t});\n\n\t\treturn t;\n\t}\n\n\tgetPendingTransitions() {\n\t\treturn this.pendingTransitions;\n\t}\n}\n"]}
@@ -62,11 +62,15 @@ var CartesianScales = /** @class */ (function (_super) {
62
62
  var mainHorizontalAxisPosition = this.findMainHorizontalAxisPosition();
63
63
  // Now we have horizontal & vertical main axes to choose domain & range axes from
64
64
  var domainAndRangeAxesPositions = this.findDomainAndRangeAxesPositions(mainVerticalAxisPosition, mainHorizontalAxisPosition);
65
- this.domainAxisPosition = domainAndRangeAxesPositions.domainAxisPosition;
65
+ this.domainAxisPosition =
66
+ domainAndRangeAxesPositions.domainAxisPosition;
66
67
  this.rangeAxisPosition = domainAndRangeAxesPositions.rangeAxisPosition;
67
68
  };
68
69
  CartesianScales.prototype.determineOrientation = function () {
69
- if (this.rangeAxisPosition === AxisPositions.LEFT && this.domainAxisPosition === AxisPositions.BOTTOM) {
70
+ if ((this.rangeAxisPosition === AxisPositions.LEFT ||
71
+ this.rangeAxisPosition === AxisPositions.RIGHT) &&
72
+ (this.domainAxisPosition === AxisPositions.BOTTOM ||
73
+ this.domainAxisPosition === AxisPositions.TOP)) {
70
74
  this.orientation = CartesianOrientations.VERTICAL;
71
75
  }
72
76
  else {
@@ -90,15 +94,19 @@ var CartesianScales = /** @class */ (function (_super) {
90
94
  };
91
95
  // Find the main x-axis out of the 2 x-axis on the chart (when 2D axis is used)
92
96
  CartesianScales.prototype.getMainXAxisPosition = function () {
93
- var possibleXAxisPositions = [AxisPositions.BOTTOM, AxisPositions.TOP];
94
- return [this.domainAxisPosition, this.rangeAxisPosition]
95
- .find(function (position) { return possibleXAxisPositions.indexOf(position) > -1; });
97
+ var possibleXAxisPositions = [
98
+ AxisPositions.BOTTOM,
99
+ AxisPositions.TOP
100
+ ];
101
+ return [this.domainAxisPosition, this.rangeAxisPosition].find(function (position) { return possibleXAxisPositions.indexOf(position) > -1; });
96
102
  };
97
103
  // Find the main y-axis out of the 2 y-axis on the chart (when 2D axis is used)
98
104
  CartesianScales.prototype.getMainYAxisPosition = function () {
99
- var possibleYAxisPositions = [AxisPositions.LEFT, AxisPositions.RIGHT];
100
- return [this.domainAxisPosition, this.rangeAxisPosition]
101
- .find(function (position) { return possibleYAxisPositions.indexOf(position) > -1; });
105
+ var possibleYAxisPositions = [
106
+ AxisPositions.LEFT,
107
+ AxisPositions.RIGHT
108
+ ];
109
+ return [this.domainAxisPosition, this.rangeAxisPosition].find(function (position) { return possibleYAxisPositions.indexOf(position) > -1; });
102
110
  };
103
111
  CartesianScales.prototype.getMainXScale = function () {
104
112
  return this.scales[this.getMainXAxisPosition()];
@@ -168,18 +176,22 @@ var CartesianScales = /** @class */ (function (_super) {
168
176
  };
169
177
  CartesianScales.prototype.findMainVerticalAxisPosition = function () {
170
178
  var options = this.model.getOptions();
171
- var axisOptions = Tools.getProperty(options, "axes");
179
+ var axesOptions = Tools.getProperty(options, "axes");
172
180
  // If right axis has been specified as `main`
173
- if (Tools.getProperty(axisOptions, AxisPositions.RIGHT, "main") === true) {
181
+ if ((Tools.getProperty(axesOptions, AxisPositions.LEFT) === null &&
182
+ Tools.getProperty(axesOptions, AxisPositions.RIGHT) !== null) ||
183
+ Tools.getProperty(axesOptions, AxisPositions.RIGHT, "main") === true) {
174
184
  return AxisPositions.RIGHT;
175
185
  }
176
186
  return AxisPositions.LEFT;
177
187
  };
178
188
  CartesianScales.prototype.findMainHorizontalAxisPosition = function () {
179
189
  var options = this.model.getOptions();
180
- var axisOptions = Tools.getProperty(options, "axes");
190
+ var axesOptions = Tools.getProperty(options, "axes");
181
191
  // If top axis has been specified as `main`
182
- if (Tools.getProperty(axisOptions, AxisPositions.TOP, "main") === true) {
192
+ if ((Tools.getProperty(axesOptions, AxisPositions.BOTTOM) === null &&
193
+ Tools.getProperty(axesOptions, AxisPositions.TOP) !== null) ||
194
+ Tools.getProperty(axesOptions, AxisPositions.TOP, "main") === true) {
183
195
  return AxisPositions.TOP;
184
196
  }
185
197
  return AxisPositions.BOTTOM;
@@ -194,11 +206,13 @@ var CartesianScales = /** @class */ (function (_super) {
194
206
  domainAxisPosition: null,
195
207
  rangeAxisPosition: null
196
208
  };
197
- if (mainHorizontalScaleType === ScaleTypes.LABELS || mainHorizontalScaleType === ScaleTypes.TIME) {
209
+ if (mainHorizontalScaleType === ScaleTypes.LABELS ||
210
+ mainHorizontalScaleType === ScaleTypes.TIME) {
198
211
  result.domainAxisPosition = mainHorizontalAxisPosition;
199
212
  result.rangeAxisPosition = mainVerticalAxisPosition;
200
213
  }
201
- else if (mainVerticalScaleType === ScaleTypes.LABELS || mainVerticalScaleType === ScaleTypes.TIME) {
214
+ else if (mainVerticalScaleType === ScaleTypes.LABELS ||
215
+ mainVerticalScaleType === ScaleTypes.TIME) {
202
216
  result.domainAxisPosition = mainVerticalAxisPosition;
203
217
  result.rangeAxisPosition = mainHorizontalAxisPosition;
204
218
  }
@@ -233,7 +247,9 @@ var CartesianScales = /** @class */ (function (_super) {
233
247
  // If the scale is stacked
234
248
  if (axisOptions.stacked) {
235
249
  var dataValuesGroupedByKeys = this.model.getDataValuesGroupedByKeys();
236
- allDataValues = dataValuesGroupedByKeys.map(function (dataValues) { return sum(values(dataValues)); });
250
+ allDataValues = dataValuesGroupedByKeys.map(function (dataValues) {
251
+ return sum(values(dataValues));
252
+ });
237
253
  }
238
254
  else {
239
255
  allDataValues = displayData.map(function (datum) { return datum[mapsTo]; });
@@ -306,28 +322,52 @@ function addSpacingToTimeDomain(domain, spaceToAddToEdges) {
306
322
  var startDate = new Date(domain[0]);
307
323
  var endDate = new Date(domain[1]);
308
324
  if (differenceInYears(endDate, startDate) > 1) {
309
- return [subYears(startDate, spaceToAddToEdges), addYears(endDate, spaceToAddToEdges)];
325
+ return [
326
+ subYears(startDate, spaceToAddToEdges),
327
+ addYears(endDate, spaceToAddToEdges)
328
+ ];
310
329
  }
311
330
  if (differenceInMonths(endDate, startDate) > 1) {
312
- return [subMonths(startDate, spaceToAddToEdges), addMonths(endDate, spaceToAddToEdges)];
331
+ return [
332
+ subMonths(startDate, spaceToAddToEdges),
333
+ addMonths(endDate, spaceToAddToEdges)
334
+ ];
313
335
  }
314
336
  if (differenceInDays(endDate, startDate) > 1) {
315
- return [subDays(startDate, spaceToAddToEdges), addDays(endDate, spaceToAddToEdges)];
337
+ return [
338
+ subDays(startDate, spaceToAddToEdges),
339
+ addDays(endDate, spaceToAddToEdges)
340
+ ];
316
341
  }
317
342
  if (differenceInHours(endDate, startDate) > 1) {
318
- return [subHours(startDate, spaceToAddToEdges), addHours(endDate, spaceToAddToEdges)];
343
+ return [
344
+ subHours(startDate, spaceToAddToEdges),
345
+ addHours(endDate, spaceToAddToEdges)
346
+ ];
319
347
  }
320
348
  if (differenceInMinutes(endDate, startDate) > 30) {
321
- return [subMinutes(startDate, spaceToAddToEdges * 30), addMinutes(endDate, spaceToAddToEdges * 30)];
349
+ return [
350
+ subMinutes(startDate, spaceToAddToEdges * 30),
351
+ addMinutes(endDate, spaceToAddToEdges * 30)
352
+ ];
322
353
  }
323
354
  if (differenceInMinutes(endDate, startDate) > 1) {
324
- return [subMinutes(startDate, spaceToAddToEdges), addMinutes(endDate, spaceToAddToEdges)];
355
+ return [
356
+ subMinutes(startDate, spaceToAddToEdges),
357
+ addMinutes(endDate, spaceToAddToEdges)
358
+ ];
325
359
  }
326
360
  if (differenceInSeconds(endDate, startDate) > 15) {
327
- return [subSeconds(startDate, spaceToAddToEdges * 15), addSeconds(endDate, spaceToAddToEdges * 15)];
361
+ return [
362
+ subSeconds(startDate, spaceToAddToEdges * 15),
363
+ addSeconds(endDate, spaceToAddToEdges * 15)
364
+ ];
328
365
  }
329
366
  if (differenceInSeconds(endDate, startDate) > 1) {
330
- return [subSeconds(startDate, spaceToAddToEdges), addSeconds(endDate, spaceToAddToEdges)];
367
+ return [
368
+ subSeconds(startDate, spaceToAddToEdges),
369
+ addSeconds(endDate, spaceToAddToEdges)
370
+ ];
331
371
  }
332
372
  return [startDate, endDate];
333
373
  }