@carbon/charts 0.52.0 → 0.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/src/components/essentials/modal.d.ts +0 -1
  3. package/build/src/services/essentials/files.d.ts +1 -1
  4. package/bundle.js +1 -1
  5. package/chart.js +1 -0
  6. package/chart.js.map +1 -1
  7. package/charts/combo.js.map +1 -1
  8. package/components/component.js +6 -2
  9. package/components/component.js.map +1 -1
  10. package/components/essentials/modal.d.ts +0 -1
  11. package/components/essentials/modal.js +0 -5
  12. package/components/essentials/modal.js.map +1 -1
  13. package/components/graphs/bar-stacked.js +1 -1
  14. package/components/graphs/bar-stacked.js.map +1 -1
  15. package/demo/data/bundle.js +1 -1
  16. package/demo/data/hightlight.js +1 -1
  17. package/demo/data/hightlight.js.map +1 -1
  18. package/demo/styles.css +4 -0
  19. package/demo/styles.css.map +1 -1
  20. package/demo/styles.min.css +1 -1
  21. package/demo/styles.min.css.map +1 -1
  22. package/demo/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +1 -1
  24. package/services/essentials/files.d.ts +1 -1
  25. package/services/essentials/files.js +4 -4
  26. package/services/essentials/files.js.map +1 -1
  27. package/services/service.js +6 -2
  28. package/services/service.js.map +1 -1
  29. package/styles/components/_highlights.scss +1 -0
  30. package/styles-g10.css +1 -0
  31. package/styles-g10.css.map +1 -1
  32. package/styles-g10.min.css +1 -1
  33. package/styles-g10.min.css.map +1 -1
  34. package/styles-g100.css +1 -0
  35. package/styles-g100.css.map +1 -1
  36. package/styles-g100.min.css +1 -1
  37. package/styles-g100.min.css.map +1 -1
  38. package/styles-g90.css +1 -0
  39. package/styles-g90.css.map +1 -1
  40. package/styles-g90.min.css +1 -1
  41. package/styles-g90.min.css.map +1 -1
  42. package/styles.css +1 -0
  43. package/styles.css.map +1 -1
  44. package/styles.min.css +1 -1
  45. package/styles.min.css.map +1 -1
  46. package/tsconfig.tsbuildinfo +9 -9
package/chart.js CHANGED
@@ -24,6 +24,7 @@ var Chart = /** @class */ (function () {
24
24
  canvasZoom: CanvasZoom,
25
25
  };
26
26
  this.model = new ChartModel(this.services);
27
+ // do nothing.
27
28
  }
28
29
  // Contains the code that uses properties that are overridable by the super-class
29
30
  Chart.prototype.init = function (holder, chartConfigs) {
package/chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"chart.js","sourceRoot":"","sources":["chart.ts"],"names":[],"mappings":";;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAGN,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,MAAM,IAAI,WAAW,EACrB,WAAW,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO;AACP,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAEN,KAAK,EACL,KAAK,EACL,MAAM,EACN,eAAe,EACf,OAAO,EACP,OAAO,EACP,MAAM,EACN,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,WAAW;AACX,OAAO,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,aAAa,EACb,WAAW,GACX,MAAM,kBAAkB,CAAC;AAE1B;IAYC,eAAY,MAAe,EAAE,YAA2C;QAVxE,aAAQ,GAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,aAAa;YAC5B,WAAW,EAAE,WAAW;YACxB,UAAU,EAAE,UAAU;SACtB,CAAC;QACF,UAAK,GAAe,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEyB,CAAC;IAE5E,iFAAiF;IACjF,oBAAI,GAAJ,UAAK,MAAe,EAAE,YAA2C;QAAjE,iBA8BC;QA7BA,gCAAgC;QAChC,IAAI,CAAC,KAAK,CAAC,GAAG,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ACZ,UAAU,EAAE;oBACX,IAAI,MAAM,CACT,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,EACb,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CACzC;iBACD;gBACD,MAAM,EAAE,YAAY,CAAC,SAAS;aAC9B,CAAC;YAEF,wBAAwB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;SACpD;QACD,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAElD,OAAO;YACN,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACtC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACpC,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,YAAC;AAAD,CAAC,AA5PD,IA4PC","sourcesContent":["// Internal Imports\nimport {\n\tChartConfig,\n\tBaseChartOptions,\n\tLayoutGrowth,\n\tLayoutAlignItems,\n\tLayoutDirection,\n\tLegendOrientations,\n\tEvents as ChartEvents,\n\tRenderTypes,\n} from './interfaces';\n\n// Misc\nimport { ChartModel } from './model/model';\nimport {\n\tComponent,\n\tModal,\n\tTitle,\n\tLegend,\n\tLayoutComponent,\n\tToolbar,\n\tTooltip,\n\tSpacer,\n\tCanvasChartClip,\n} from './components';\nimport { Tools } from './tools';\n\n// Services\nimport {\n\tCanvasZoom,\n\tDOMUtils,\n\tEvents,\n\tFiles,\n\tGradientUtils,\n\tTransitions,\n} from './services/index';\n\nexport class Chart {\n\tcomponents: Component[];\n\tservices: any = {\n\t\tdomUtils: DOMUtils,\n\t\tfiles: Files,\n\t\tevents: Events,\n\t\tgradientUtils: GradientUtils,\n\t\ttransitions: Transitions,\n\t\tcanvasZoom: CanvasZoom,\n\t};\n\tmodel: ChartModel = new ChartModel(this.services);\n\n\tconstructor(holder: Element, chartConfigs: ChartConfig<BaseChartOptions>) {}\n\n\t// Contains the code that uses properties that are overridable by the super-class\n\tinit(holder: Element, chartConfigs: ChartConfig<BaseChartOptions>) {\n\t\t// Store the holder in the model\n\t\tthis.model.set({ holder }, { skipUpdate: true });\n\n\t\t// Initialize all services\n\t\tObject.keys(this.services).forEach((serviceName) => {\n\t\t\tconst serviceObj = this.services[serviceName];\n\t\t\tthis.services[serviceName] = new serviceObj(\n\t\t\t\tthis.model,\n\t\t\t\tthis.services\n\t\t\t);\n\t\t});\n\n\t\t// Call update() when model has been updated\n\t\tthis.services.events.addEventListener(ChartEvents.Model.UPDATE, (e) => {\n\t\t\tconst animate = !!Tools.getProperty(e, 'detail', 'animate');\n\t\t\tthis.update(animate);\n\t\t});\n\n\t\t// Set model data & options\n\t\tthis.model.setData(chartConfigs.data);\n\n\t\t// Set chart resize event listener\n\t\tthis.services.events.addEventListener(ChartEvents.Chart.RESIZE, () => {\n\t\t\tthis.update(false);\n\t\t});\n\n\t\tthis.components = this.getComponents();\n\n\t\tthis.update();\n\t}\n\n\tgetComponents(): any[] {\n\t\tconsole.error('getComponents() method is not implemented');\n\n\t\treturn null;\n\t}\n\n\tupdate(animate = true) {\n\t\tif (!this.components) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update all services\n\t\tObject.keys(this.services).forEach((serviceName) => {\n\t\t\tconst serviceObj = this.services[serviceName];\n\t\t\tserviceObj.update();\n\t\t});\n\n\t\t// Render all components\n\t\tthis.components.forEach((component) => component.render(animate));\n\n\t\t// Asynchronously dispatch a \"render-finished\" event\n\t\t// This is needed because of d3-transitions\n\t\t// Since at the start of the transition\n\t\t// Elements do not hold their final size or position\n\t\tconst pendingTransitions = this.services.transitions.getPendingTransitions();\n\t\tconst promises = Object.keys(pendingTransitions).map((transitionID) => {\n\t\t\tconst transition = pendingTransitions[transitionID];\n\t\t\treturn transition.end().catch((e) => e); // Skip rejects since we don't care about those;\n\t\t});\n\n\t\tPromise.all(promises).then(() =>\n\t\t\tthis.services.events.dispatchEvent(\n\t\t\t\tChartEvents.Chart.RENDER_FINISHED\n\t\t\t)\n\t\t);\n\t}\n\n\tdestroy() {\n\t\t// Call the destroy() method on all components\n\t\tthis.components.forEach((component) => component.destroy());\n\n\t\t// Remove the chart holder\n\t\tthis.services.domUtils.getHolder().remove();\n\n\t\tthis.model.set({ destroyed: true }, { skipUpdate: true });\n\t}\n\n\tprotected getChartComponents(\n\t\tgraphFrameComponents: any[],\n\t\tconfigs?: object\n\t) {\n\t\tconst options = this.model.getOptions();\n\n\t\tconst toolbarEnabled = Tools.getProperty(options, 'toolbar', 'enabled');\n\n\t\tconst legendComponent = {\n\t\t\tid: 'legend',\n\t\t\tcomponents: [new Legend(this.model, this.services)],\n\t\t\tgrowth: LayoutGrowth.PREFERRED,\n\t\t};\n\n\t\t// if canvas zoom is enabled\n\t\tconst isZoomEnabled = Tools.getProperty(\n\t\t\toptions,\n\t\t\t'canvasZoom',\n\t\t\t'enabled'\n\t\t);\n\n\t\tif (isZoomEnabled && isZoomEnabled === true) {\n\t\t\tgraphFrameComponents.push(\n\t\t\t\tnew CanvasChartClip(this.model, this.services)\n\t\t\t);\n\t\t}\n\n\t\tconst titleAvailable = !!this.model.getOptions().title;\n\t\tconst titleComponent = {\n\t\t\tid: 'title',\n\t\t\tcomponents: [new Title(this.model, this.services)],\n\t\t\tgrowth: LayoutGrowth.STRETCH,\n\t\t};\n\n\t\tconst toolbarComponent = {\n\t\t\tid: 'toolbar',\n\t\t\tcomponents: [new Toolbar(this.model, this.services)],\n\t\t\tgrowth: LayoutGrowth.PREFERRED,\n\t\t};\n\n\t\tconst headerComponent = {\n\t\t\tid: 'header',\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// always add title to keep layout correct\n\t\t\t\t\t\ttitleComponent,\n\t\t\t\t\t\t...(toolbarEnabled ? [toolbarComponent] : []),\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tdirection: LayoutDirection.ROW,\n\t\t\t\t\t\talignItems: LayoutAlignItems.CENTER,\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t],\n\t\t\tgrowth: LayoutGrowth.PREFERRED,\n\t\t};\n\n\t\tconst graphFrameComponent = {\n\t\t\tid: 'graph-frame',\n\t\t\tcomponents: graphFrameComponents,\n\t\t\tgrowth: LayoutGrowth.STRETCH,\n\t\t\trenderType:\n\t\t\t\tTools.getProperty(configs, 'graphFrameRenderType') ||\n\t\t\t\tRenderTypes.SVG,\n\t\t};\n\n\t\tconst isLegendEnabled =\n\t\t\tTools.getProperty(configs, 'excludeLegend') !== true &&\n\t\t\toptions.legend.enabled !== false;\n\t\t// TODORF - REUSE BETWEEN AXISCHART & CHART\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\toptions,\n\t\t\t\t'legend',\n\t\t\t\t'position'\n\t\t\t);\n\t\t\tif (legendPosition === 'left') {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW;\n\n\t\t\t\tif (!options.legend.orientation) {\n\t\t\t\t\toptions.legend.orientation = LegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === 'right') {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW_REVERSE;\n\n\t\t\t\tif (!options.legend.orientation) {\n\t\t\t\t\toptions.legend.orientation = LegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === '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: LayoutGrowth.PREFERRED,\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\t...(isLegendEnabled ? [legendSpacerComponent] : []),\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: LayoutGrowth.STRETCH,\n\t\t};\n\n\t\t// Add chart title if it exists\n\t\tconst topLevelLayoutComponents = [];\n\n\t\tif (titleAvailable || toolbarEnabled) {\n\t\t\ttopLevelLayoutComponents.push(headerComponent);\n\n\t\t\tconst titleSpacerComponent = {\n\t\t\t\tid: 'spacer',\n\t\t\t\tcomponents: [\n\t\t\t\t\tnew Spacer(\n\t\t\t\t\t\tthis.model,\n\t\t\t\t\t\tthis.services,\n\t\t\t\t\t\ttoolbarEnabled ? { size: 15 } : undefined\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t\tgrowth: LayoutGrowth.PREFERRED,\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 Tooltip(this.model, this.services),\n\t\t\tnew Modal(this.model, this.services),\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":"chart.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,CAAC,CAAC;SACpD;QACD,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAElD,OAAO;YACN,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACtC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACpC,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,YAAC;AAAD,CAAC,AA9PD,IA8PC","sourcesContent":["// Internal Imports\nimport {\n\tChartConfig,\n\tBaseChartOptions,\n\tLayoutGrowth,\n\tLayoutAlignItems,\n\tLayoutDirection,\n\tLegendOrientations,\n\tEvents as ChartEvents,\n\tRenderTypes,\n} from './interfaces';\n\n// Misc\nimport { ChartModel } from './model/model';\nimport {\n\tComponent,\n\tModal,\n\tTitle,\n\tLegend,\n\tLayoutComponent,\n\tToolbar,\n\tTooltip,\n\tSpacer,\n\tCanvasChartClip,\n} from './components';\nimport { Tools } from './tools';\n\n// Services\nimport {\n\tCanvasZoom,\n\tDOMUtils,\n\tEvents,\n\tFiles,\n\tGradientUtils,\n\tTransitions,\n} from './services/index';\n\nexport class Chart {\n\tcomponents: Component[];\n\tservices: any = {\n\t\tdomUtils: DOMUtils,\n\t\tfiles: Files,\n\t\tevents: Events,\n\t\tgradientUtils: GradientUtils,\n\t\ttransitions: Transitions,\n\t\tcanvasZoom: CanvasZoom,\n\t};\n\tmodel: ChartModel = new ChartModel(this.services);\n\n\tconstructor(holder: Element, chartConfigs: ChartConfig<BaseChartOptions>) {\n\t\t// do nothing.\n\t}\n\n\t// Contains the code that uses properties that are overridable by the super-class\n\tinit(holder: Element, chartConfigs: ChartConfig<BaseChartOptions>) {\n\t\t// Store the holder in the model\n\t\tthis.model.set({ holder }, { skipUpdate: true });\n\n\t\t// Initialize all services\n\t\tObject.keys(this.services).forEach((serviceName) => {\n\t\t\tconst serviceObj = this.services[serviceName];\n\t\t\tthis.services[serviceName] = new serviceObj(\n\t\t\t\tthis.model,\n\t\t\t\tthis.services\n\t\t\t);\n\t\t});\n\n\t\t// Call update() when model has been updated\n\t\tthis.services.events.addEventListener(ChartEvents.Model.UPDATE, (e) => {\n\t\t\tconst animate = !!Tools.getProperty(e, 'detail', 'animate');\n\t\t\tthis.update(animate);\n\t\t});\n\n\t\t// Set model data & options\n\t\tthis.model.setData(chartConfigs.data);\n\n\t\t// Set chart resize event listener\n\t\tthis.services.events.addEventListener(ChartEvents.Chart.RESIZE, () => {\n\t\t\tthis.update(false);\n\t\t});\n\n\t\tthis.components = this.getComponents();\n\n\t\tthis.update();\n\t}\n\n\tgetComponents(): any[] {\n\t\tconsole.error('getComponents() method is not implemented');\n\n\t\treturn null;\n\t}\n\n\tupdate(animate = true) {\n\t\tif (!this.components) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update all services\n\t\tObject.keys(this.services).forEach((serviceName) => {\n\t\t\tconst serviceObj = this.services[serviceName];\n\t\t\tserviceObj.update();\n\t\t});\n\n\t\t// Render all components\n\t\tthis.components.forEach((component) => component.render(animate));\n\n\t\t// Asynchronously dispatch a \"render-finished\" event\n\t\t// This is needed because of d3-transitions\n\t\t// Since at the start of the transition\n\t\t// Elements do not hold their final size or position\n\t\tconst pendingTransitions = this.services.transitions.getPendingTransitions();\n\t\tconst promises = Object.keys(pendingTransitions).map((transitionID) => {\n\t\t\tconst transition = pendingTransitions[transitionID];\n\t\t\treturn transition.end().catch((e) => e); // Skip rejects since we don't care about those;\n\t\t});\n\n\t\tPromise.all(promises).then(() =>\n\t\t\tthis.services.events.dispatchEvent(\n\t\t\t\tChartEvents.Chart.RENDER_FINISHED\n\t\t\t)\n\t\t);\n\t}\n\n\tdestroy() {\n\t\t// Call the destroy() method on all components\n\t\tthis.components.forEach((component) => component.destroy());\n\n\t\t// Remove the chart holder\n\t\tthis.services.domUtils.getHolder().remove();\n\n\t\tthis.model.set({ destroyed: true }, { skipUpdate: true });\n\t}\n\n\tprotected getChartComponents(\n\t\tgraphFrameComponents: any[],\n\t\tconfigs?: object\n\t) {\n\t\tconst options = this.model.getOptions();\n\n\t\tconst toolbarEnabled = Tools.getProperty(options, 'toolbar', 'enabled');\n\n\t\tconst legendComponent = {\n\t\t\tid: 'legend',\n\t\t\tcomponents: [new Legend(this.model, this.services)],\n\t\t\tgrowth: LayoutGrowth.PREFERRED,\n\t\t};\n\n\t\t// if canvas zoom is enabled\n\t\tconst isZoomEnabled = Tools.getProperty(\n\t\t\toptions,\n\t\t\t'canvasZoom',\n\t\t\t'enabled'\n\t\t);\n\n\t\tif (isZoomEnabled && isZoomEnabled === true) {\n\t\t\tgraphFrameComponents.push(\n\t\t\t\tnew CanvasChartClip(this.model, this.services)\n\t\t\t);\n\t\t}\n\n\t\tconst titleAvailable = !!this.model.getOptions().title;\n\t\tconst titleComponent = {\n\t\t\tid: 'title',\n\t\t\tcomponents: [new Title(this.model, this.services)],\n\t\t\tgrowth: LayoutGrowth.STRETCH,\n\t\t};\n\n\t\tconst toolbarComponent = {\n\t\t\tid: 'toolbar',\n\t\t\tcomponents: [new Toolbar(this.model, this.services)],\n\t\t\tgrowth: LayoutGrowth.PREFERRED,\n\t\t};\n\n\t\tconst headerComponent = {\n\t\t\tid: 'header',\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// always add title to keep layout correct\n\t\t\t\t\t\ttitleComponent,\n\t\t\t\t\t\t...(toolbarEnabled ? [toolbarComponent] : []),\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tdirection: LayoutDirection.ROW,\n\t\t\t\t\t\talignItems: LayoutAlignItems.CENTER,\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t],\n\t\t\tgrowth: LayoutGrowth.PREFERRED,\n\t\t};\n\n\t\tconst graphFrameComponent = {\n\t\t\tid: 'graph-frame',\n\t\t\tcomponents: graphFrameComponents,\n\t\t\tgrowth: LayoutGrowth.STRETCH,\n\t\t\trenderType:\n\t\t\t\tTools.getProperty(configs, 'graphFrameRenderType') ||\n\t\t\t\tRenderTypes.SVG,\n\t\t};\n\n\t\tconst isLegendEnabled =\n\t\t\tTools.getProperty(configs, 'excludeLegend') !== true &&\n\t\t\toptions.legend.enabled !== false;\n\t\t// TODORF - REUSE BETWEEN AXISCHART & CHART\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\toptions,\n\t\t\t\t'legend',\n\t\t\t\t'position'\n\t\t\t);\n\t\t\tif (legendPosition === 'left') {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW;\n\n\t\t\t\tif (!options.legend.orientation) {\n\t\t\t\t\toptions.legend.orientation = LegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === 'right') {\n\t\t\t\tfullFrameComponentDirection = LayoutDirection.ROW_REVERSE;\n\n\t\t\t\tif (!options.legend.orientation) {\n\t\t\t\t\toptions.legend.orientation = LegendOrientations.VERTICAL;\n\t\t\t\t}\n\t\t\t} else if (legendPosition === '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: LayoutGrowth.PREFERRED,\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\t...(isLegendEnabled ? [legendSpacerComponent] : []),\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: LayoutGrowth.STRETCH,\n\t\t};\n\n\t\t// Add chart title if it exists\n\t\tconst topLevelLayoutComponents = [];\n\n\t\tif (titleAvailable || toolbarEnabled) {\n\t\t\ttopLevelLayoutComponents.push(headerComponent);\n\n\t\t\tconst titleSpacerComponent = {\n\t\t\t\tid: 'spacer',\n\t\t\t\tcomponents: [\n\t\t\t\t\tnew Spacer(\n\t\t\t\t\t\tthis.model,\n\t\t\t\t\t\tthis.services,\n\t\t\t\t\t\ttoolbarEnabled ? { size: 15 } : undefined\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t\tgrowth: LayoutGrowth.PREFERRED,\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 Tooltip(this.model, this.services),\n\t\t\tnew Modal(this.model, this.services),\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 +1 @@
1
- {"version":3,"file":"combo.js","sourceRoot":"","sources":["combo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAGN,UAAU,EACV,SAAS,GACT,MAAM,qBAAqB,CAAC;A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IAAI,CAAC,QAAQ,EAAE;gBACvC,QAAQ,EAAE,SAAS,CAAC,IAAI;aACxB,CAAC;WACC,CAAC,mBAAmB;YACtB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EACvC,IAAI,CAAC,kBAAkB,EAAE,CAC5B,CAAC;QAEF,IAAM,UAAU,GAAU,IAAI,CAAC,sBAAsB,CACpD,oBAAoB,CACpB,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC;IACF,iBAAC;AAAD,CAAC,AAnHD,CAAgC,SAAS,GAmHxC","sourcesContent":["// Internal Imports\nimport { AxisChart } from '../axis-chart';\nimport * as Configuration from '../configuration';\nimport {\n\tChartConfig,\n\tComboChartOptions,\n\tChartTypes,\n\tSkeletons,\n} from '../interfaces/index';\nimport { Tools } from '../tools';\n\n// Components\nimport {\n\tGrid,\n\tGroupedBar,\n\tSimpleBar,\n\tStackedBar,\n\tLine,\n\tTwoDimensionalAxes,\n\tZeroLine,\n\tScatter,\n\tStackedScatter,\n\tArea,\n\tStackedArea,\n\tRuler,\n\tStackedRuler,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tLegend,\n\tLayoutComponent,\n\tComponent,\n\tSkeleton,\n} from '../components/index';\n\nconst graphComponentsMap = {\n\t[ChartTypes.LINE]: [Line, Scatter],\n\t[ChartTypes.SCATTER]: [Scatter],\n\t[ChartTypes.AREA]: [Area, Line, Scatter],\n\t[ChartTypes.STACKED_AREA]: [\n\t\tStackedArea,\n\t\tLine,\n\t\tStackedScatter,\n\t\tStackedRuler,\n\t],\n\t[ChartTypes.SIMPLE_BAR]: [SimpleBar],\n\t[ChartTypes.GROUPED_BAR]: [GroupedBar, ZeroLine],\n\t[ChartTypes.STACKED_BAR]: [StackedBar, StackedRuler],\n};\n\nexport class ComboChart extends AxisChart {\n\tconstructor(holder: Element, chartConfigs: ChartConfig<ComboChartOptions>) {\n\t\tsuper(holder, chartConfigs);\n\n\t\t// Merge the default options for this chart\n\t\t// With the user provided options\n\t\tconst chartOptions = Tools.mergeDefaultChartOptions(\n\t\t\tConfiguration.options.comboChart,\n\t\t\tchartConfigs.options\n\t\t);\n\n\t\t// Warn user if no comboChartTypes defined\n\t\t// Use skeleton chart instead\n\t\tif (!chartConfigs.options.comboChartTypes) {\n\t\t\tconsole.error('No comboChartTypes defined for the Combo Chart!');\n\t\t\t// add a default chart to get an empty chart\n\t\t\tchartOptions.comboChartTypes = [\n\t\t\t\t{ type: ChartTypes.LINE, correspondingDatasets: [] },\n\t\t\t];\n\t\t}\n\n\t\t// set the global options\n\t\tthis.model.setOptions(chartOptions);\n\n\t\t// Initialize data, services, components etc.\n\t\tthis.init(holder, chartConfigs);\n\t}\n\n\tgetGraphComponents() {\n\t\tconst { comboChartTypes } = this.model.getOptions();\n\t\tlet counter = 0;\n\t\tconst graphComponents = comboChartTypes\n\t\t\t.map((graph) => {\n\t\t\t\tconst type = graph.type;\n\t\t\t\tlet options;\n\n\t\t\t\t// initializes the components using input strings with the base configs for each chart\n\t\t\t\tif (typeof graph.type === 'string') {\n\t\t\t\t\t// check if it is in the components map\n\t\t\t\t\t// if it isn't then it is not a valid carbon chart to use in combo\n\t\t\t\t\tif (!Object.keys(graphComponentsMap).includes(graph.type)) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`Invalid chart type \"${graph.type}\" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tlet stacked;\n\t\t\t\t\toptions = Tools.merge(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tConfiguration.options[\n\t\t\t\t\t\t\t`${Tools.camelCase(graph.type)}Chart`\n\t\t\t\t\t\t],\n\t\t\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\t\tgraph.options\n\t\t\t\t\t);\n\t\t\t\t\t// if we are creating a stacked area, the contained Line chart needs to know it is stacked\n\t\t\t\t\tif (graph.type === ChartTypes.STACKED_AREA) {\n\t\t\t\t\t\tstacked = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn graphComponentsMap[graph.type].map(\n\t\t\t\t\t\t(Component, i) =>\n\t\t\t\t\t\t\tnew Component(this.model, this.services, {\n\t\t\t\t\t\t\t\tgroups: graph.correspondingDatasets,\n\t\t\t\t\t\t\t\tid: counter++,\n\t\t\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\t\t\tstacked,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// user has imported a type or custom component to instantiate\n\t\t\t\t\toptions = Tools.merge(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\t\tgraph.options\n\t\t\t\t\t);\n\t\t\t\t\treturn new type(this.model, this.services, {\n\t\t\t\t\t\tgroups: graph.correspondingDatasets,\n\t\t\t\t\t\tid: counter++,\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((item) => item !== null);\n\n\t\treturn Tools.flatten(graphComponents);\n\t}\n\n\tgetComponents() {\n\t\tconst { comboChartTypes } = this.model.getOptions();\n\t\t// don't add the regular ruler if stacked ruler is added\n\t\tconst stackedRulerEnabled = comboChartTypes.some(\n\t\t\t(chartObject) =>\n\t\t\t\tchartObject.type === ChartTypes.STACKED_BAR ||\n\t\t\t\tchartObject.type === ChartTypes.STACKED_AREA\n\t\t);\n\n\t\t// Specify what to render inside the graph-frame\n\t\tconst graphFrameComponents = [\n\t\t\tnew TwoDimensionalAxes(this.model, this.services),\n\t\t\tnew Grid(this.model, this.services),\n\t\t\tnew Skeleton(this.model, this.services, {\n\t\t\t\tskeleton: Skeletons.GRID,\n\t\t\t}),\n\t\t\t...(stackedRulerEnabled\n\t\t\t\t? []\n\t\t\t\t: [new Ruler(this.model, this.services)]),\n\t\t\t...this.getGraphComponents(),\n\t\t];\n\n\t\tconst components: any[] = this.getAxisChartComponents(\n\t\t\tgraphFrameComponents\n\t\t);\n\n\t\treturn components;\n\t}\n}\n"]}
1
+ {"version":3,"file":"combo.js","sourceRoot":"","sources":["combo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAGN,UAAU,EACV,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,aAAa;AACb,OAAO,EACN,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,IAAI,EACJ,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,IAAI,EACJ,WAAW,EACX,KAAK,EACL,YAAY,EAIZ,QAAQ,GACR,MAAM,qBAAqB,CAAC;AAE7B,IAAM,kBAAkB;IACvB,GAAC,UAAU,CAAC,IAAI,IAAG,CAAC,IAAI,EAAE,OAAO,CAAC;IAClC,GAAC,UAAU,CAAC,OAAO,IAAG,CAAC,OAAO,CAAC;IAC/B,GAAC,UAAU,CAAC,IAAI,IAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC;IACxC,GAAC,UAAU,CAAC,YAAY,IAAG;QAC1B,WAAW;QACX,IAAI;QACJ,cAAc;QACd,YAAY;KACZ;IACD,GAAC,UAAU,CAAC,UAAU,IAAG,CAAC,SAAS,CAAC;IACpC,GAAC,UAAU,CAAC,WAAW,IAAG,CAAC,UAAU,EAAE,QAAQ,CAAC;IAChD,GAAC,UAAU,CAAC,WAAW,IAAG,CAAC,UAAU,EAAE,YAAY,CAAC;OACpD,CAAC;AAEF;IAAgC,8BAAS;IACxC,oBAAY,MAAe,EAAE,YAA4C;QAAzE,YACC,kBAAM,MAAM,E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AC/C,UAAC,WAAW;YACX,OAAA,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW;gBAC3C,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,YAAY;QAD5C,CAC4C,CAC7C,CAAC;QAEF,gDAAgD;QAChD,IAAM,oBAAoB;YACzB,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACjD,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACnC,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE;gBACvC,QAAQ,EAAE,SAAS,CAAC,IAAI;aACxB,CAAC;WACC,CAAC,mBAAmB;YACtB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EACvC,IAAI,CAAC,kBAAkB,EAAE,CAC5B,CAAC;QAEF,IAAM,UAAU,GAAU,IAAI,CAAC,sBAAsB,CACpD,oBAAoB,CACpB,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC;IACF,iBAAC;AAAD,CAAC,AAnHD,CAAgC,SAAS,GAmHxC","sourcesContent":["// Internal Imports\nimport { AxisChart } from '../axis-chart';\nimport * as Configuration from '../configuration';\nimport {\n\tChartConfig,\n\tComboChartOptions,\n\tChartTypes,\n\tSkeletons,\n} from '../interfaces/index';\nimport { Tools } from '../tools';\n\n// Components\nimport {\n\tGrid,\n\tGroupedBar,\n\tSimpleBar,\n\tStackedBar,\n\tLine,\n\tTwoDimensionalAxes,\n\tZeroLine,\n\tScatter,\n\tStackedScatter,\n\tArea,\n\tStackedArea,\n\tRuler,\n\tStackedRuler,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tLegend,\n\tLayoutComponent,\n\tSkeleton,\n} from '../components/index';\n\nconst graphComponentsMap = {\n\t[ChartTypes.LINE]: [Line, Scatter],\n\t[ChartTypes.SCATTER]: [Scatter],\n\t[ChartTypes.AREA]: [Area, Line, Scatter],\n\t[ChartTypes.STACKED_AREA]: [\n\t\tStackedArea,\n\t\tLine,\n\t\tStackedScatter,\n\t\tStackedRuler,\n\t],\n\t[ChartTypes.SIMPLE_BAR]: [SimpleBar],\n\t[ChartTypes.GROUPED_BAR]: [GroupedBar, ZeroLine],\n\t[ChartTypes.STACKED_BAR]: [StackedBar, StackedRuler],\n};\n\nexport class ComboChart extends AxisChart {\n\tconstructor(holder: Element, chartConfigs: ChartConfig<ComboChartOptions>) {\n\t\tsuper(holder, chartConfigs);\n\n\t\t// Merge the default options for this chart\n\t\t// With the user provided options\n\t\tconst chartOptions = Tools.mergeDefaultChartOptions(\n\t\t\tConfiguration.options.comboChart,\n\t\t\tchartConfigs.options\n\t\t);\n\n\t\t// Warn user if no comboChartTypes defined\n\t\t// Use skeleton chart instead\n\t\tif (!chartConfigs.options.comboChartTypes) {\n\t\t\tconsole.error('No comboChartTypes defined for the Combo Chart!');\n\t\t\t// add a default chart to get an empty chart\n\t\t\tchartOptions.comboChartTypes = [\n\t\t\t\t{ type: ChartTypes.LINE, correspondingDatasets: [] },\n\t\t\t];\n\t\t}\n\n\t\t// set the global options\n\t\tthis.model.setOptions(chartOptions);\n\n\t\t// Initialize data, services, components etc.\n\t\tthis.init(holder, chartConfigs);\n\t}\n\n\tgetGraphComponents() {\n\t\tconst { comboChartTypes } = this.model.getOptions();\n\t\tlet counter = 0;\n\t\tconst graphComponents = comboChartTypes\n\t\t\t.map((graph) => {\n\t\t\t\tconst type = graph.type;\n\t\t\t\tlet options;\n\n\t\t\t\t// initializes the components using input strings with the base configs for each chart\n\t\t\t\tif (typeof graph.type === 'string') {\n\t\t\t\t\t// check if it is in the components map\n\t\t\t\t\t// if it isn't then it is not a valid carbon chart to use in combo\n\t\t\t\t\tif (!Object.keys(graphComponentsMap).includes(graph.type)) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`Invalid chart type \"${graph.type}\" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tlet stacked;\n\t\t\t\t\toptions = Tools.merge(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tConfiguration.options[\n\t\t\t\t\t\t\t`${Tools.camelCase(graph.type)}Chart`\n\t\t\t\t\t\t],\n\t\t\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\t\tgraph.options\n\t\t\t\t\t);\n\t\t\t\t\t// if we are creating a stacked area, the contained Line chart needs to know it is stacked\n\t\t\t\t\tif (graph.type === ChartTypes.STACKED_AREA) {\n\t\t\t\t\t\tstacked = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn graphComponentsMap[graph.type].map(\n\t\t\t\t\t\t(Component, i) =>\n\t\t\t\t\t\t\tnew Component(this.model, this.services, {\n\t\t\t\t\t\t\t\tgroups: graph.correspondingDatasets,\n\t\t\t\t\t\t\t\tid: counter++,\n\t\t\t\t\t\t\t\toptions: options,\n\t\t\t\t\t\t\t\tstacked,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// user has imported a type or custom component to instantiate\n\t\t\t\t\toptions = Tools.merge(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\t\tgraph.options\n\t\t\t\t\t);\n\t\t\t\t\treturn new type(this.model, this.services, {\n\t\t\t\t\t\tgroups: graph.correspondingDatasets,\n\t\t\t\t\t\tid: counter++,\n\t\t\t\t\t\toptions: options,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((item) => item !== null);\n\n\t\treturn Tools.flatten(graphComponents);\n\t}\n\n\tgetComponents() {\n\t\tconst { comboChartTypes } = this.model.getOptions();\n\t\t// don't add the regular ruler if stacked ruler is added\n\t\tconst stackedRulerEnabled = comboChartTypes.some(\n\t\t\t(chartObject) =>\n\t\t\t\tchartObject.type === ChartTypes.STACKED_BAR ||\n\t\t\t\tchartObject.type === ChartTypes.STACKED_AREA\n\t\t);\n\n\t\t// Specify what to render inside the graph-frame\n\t\tconst graphFrameComponents = [\n\t\t\tnew TwoDimensionalAxes(this.model, this.services),\n\t\t\tnew Grid(this.model, this.services),\n\t\t\tnew Skeleton(this.model, this.services, {\n\t\t\t\tskeleton: Skeletons.GRID,\n\t\t\t}),\n\t\t\t...(stackedRulerEnabled\n\t\t\t\t? []\n\t\t\t\t: [new Ruler(this.model, this.services)]),\n\t\t\t...this.getGraphComponents(),\n\t\t];\n\n\t\tconst components: any[] = this.getAxisChartComponents(\n\t\t\tgraphFrameComponents\n\t\t);\n\n\t\treturn components;\n\t}\n}\n"]}
@@ -23,12 +23,16 @@ var Component = /** @class */ (function () {
23
23
  this.setParent(select(this.services.domUtils.getMainContainer()));
24
24
  }
25
25
  }
26
- Component.prototype.init = function () { };
26
+ Component.prototype.init = function () {
27
+ // do nothing.
28
+ };
27
29
  Component.prototype.render = function (animate) {
28
30
  if (animate === void 0) { animate = true; }
29
31
  console.error('render() method is not implemented');
30
32
  };
31
- Component.prototype.destroy = function () { };
33
+ Component.prototype.destroy = function () {
34
+ // do nothing.
35
+ };
32
36
  // Used to pass down information to the components
33
37
  Component.prototype.setModel = function (newObj) {
34
38
  this.model = newObj;
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,yCAAyC;AACzC,OAAO,QAAQ,MAAM,0CAA0C,CAAC;AAEhE;IAaC,mBAAY,KAAiB,E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,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAElD,IAAI,WAAW,EAAE;oBAChB,IAAM,kBAAkB,GAAG,MAAM,CAAC,MAAI,WAAa,CAAC,CAAC;oBACrD,IAAM,sBAAsB,GAAG,kBAAkB,CAAC,MAAM,CACvD,MAAM,CACN,CAAC;oBAEF;;;uBAGG;oBACH,IACC,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC;wBACnC,UAAU,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,EACpD;wBACD,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,UAAQ,WAAW,MAAG,CAAC,CAAC;qBACpD;iBACD;aACD;YAED,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SAC9D;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,8BAAU,GAAV;QACC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzB,IAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAC1B,EAAE,EACF,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,EACvB,IAAI,CAAC,OAAO,CAAC,OAAO,CACpB,CAAC;YACF,OAAO,OAAO,CAAC;SACf;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IACF,gBAAC;AAAD,CAAC,AAlJD,IAkJC","sourcesContent":["// Internal Imports\nimport { ChartModel } from '../model/model';\nimport { DOMUtils } from '../services';\nimport { RenderTypes } from '../interfaces';\nimport { Tools } from '../tools';\n\n// D3 Imports\nimport { select } from 'd3-selection';\n\n// import the settings for the css prefix\nimport settings from 'carbon-components/es/globals/js/settings';\n\nexport class Component {\n\tpublic type: string;\n\tpublic renderType = RenderTypes.HTML;\n\n\tpublic id: string;\n\n\tprotected parent: any;\n\n\tprotected configs: any = {};\n\n\tprotected model: any;\n\tprotected services: any;\n\n\tconstructor(model: ChartModel, services: any, configs?: any) {\n\t\tthis.model = model;\n\t\tthis.services = services;\n\n\t\tif (configs) {\n\t\t\tthis.configs = configs;\n\t\t\tif (this.configs.id) {\n\t\t\t\tconst chartprefix = Tools.getProperty(\n\t\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\t'style',\n\t\t\t\t\t'prefix'\n\t\t\t\t);\n\t\t\t\tthis.id = `${chartprefix}--${this.configs.id}`;\n\t\t\t}\n\t\t}\n\n\t\t// Set parent element to shell SVG if no parent exists for component\n\t\tif (!this.parent) {\n\t\t\tthis.setParent(select(this.services.domUtils.getMainContainer()));\n\t\t}\n\t}\n\n\tinit() {}\n\n\trender(animate = true) {\n\t\tconsole.error('render() method is not implemented');\n\t}\n\n\tdestroy() {}\n\n\t// Used to pass down information to the components\n\tsetModel(newObj) {\n\t\tthis.model = newObj;\n\t}\n\n\t// Used to pass down information to the components\n\tsetServices(newObj) {\n\t\tthis.services = newObj;\n\t}\n\n\tsetParent(parent) {\n\t\tconst oldParent = this.parent;\n\t\tthis.parent = parent;\n\n\t\tif (oldParent && oldParent.node() === parent.node()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.type) {\n\t\t\tconst chartprefix = Tools.getProperty(\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\t'style',\n\t\t\t\t'prefix'\n\t\t\t);\n\t\t\tthis.parent.classed(\n\t\t\t\t`${settings.prefix}--${chartprefix}--${this.type}`,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tif (oldParent) {\n\t\t\t\toldParent.classed(\n\t\t\t\t\t`${settings.prefix}--${chartprefix}--${this.type}`,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetParent() {\n\t\treturn this.parent;\n\t}\n\n\tgetComponentContainer(configs = { withinChartClip: false }) {\n\t\tif (this.type) {\n\t\t\tconst chartprefix = Tools.getProperty(\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\t'style',\n\t\t\t\t'prefix'\n\t\t\t);\n\n\t\t\tconst idSelector = this.id ? `#${this.id}` : '';\n\t\t\tconst container = DOMUtils.appendOrSelect(\n\t\t\t\tthis.parent,\n\t\t\t\t`${\n\t\t\t\t\tthis.renderType === RenderTypes.SVG ? 'svg' : 'div'\n\t\t\t\t}${idSelector}.${settings.prefix}--${chartprefix}--${this.type}`\n\t\t\t);\n\n\t\t\tif (configs.withinChartClip) {\n\t\t\t\t// get unique chartClipId int this chart from model\n\t\t\t\tconst chartClipId = this.model.get('chartClipId');\n\n\t\t\t\tif (chartClipId) {\n\t\t\t\t\tconst chartClipSelection = select(`#${chartClipId}`);\n\t\t\t\t\tconst chartClipRectSelection = chartClipSelection.select(\n\t\t\t\t\t\t'rect'\n\t\t\t\t\t);\n\n\t\t\t\t\t/*\n\t\t\t\t\t * these checks are needed because of a chrome bug\n\t\t\t\t\t * related to the rendering of the clip path\n\t\t\t\t\t */\n\t\t\t\t\tif (\n\t\t\t\t\t\tchartClipRectSelection.size() !== 0 &&\n\t\t\t\t\t\tparseFloat(chartClipRectSelection.attr('height')) > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontainer.attr('clip-path', `url(#${chartClipId})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn container.attr('width', '100%').attr('height', '100%');\n\t\t}\n\n\t\treturn this.parent;\n\t}\n\n\t/**\n\t * graphs used in combo charts share a model with global options but can receive their own local options.\n\t * this function retrieves the global options and merges it with any options passed into this\n\t * component's config.options object.\n\t */\n\tgetOptions() {\n\t\tif (this.configs.options) {\n\t\t\tconst options = Tools.merge(\n\t\t\t\t{},\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\tthis.configs.options\n\t\t\t);\n\t\t\treturn options;\n\t\t}\n\t\treturn this.model.getOptions();\n\t}\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"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KAAK,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IACF,gBAAC;AAAD,CAAC,AAtJD,IAsJC","sourcesContent":["// Internal Imports\nimport { ChartModel } from '../model/model';\nimport { DOMUtils } from '../services';\nimport { RenderTypes } from '../interfaces';\nimport { Tools } from '../tools';\n\n// D3 Imports\nimport { select } from 'd3-selection';\n\n// import the settings for the css prefix\nimport settings from 'carbon-components/es/globals/js/settings';\n\nexport class Component {\n\tpublic type: string;\n\tpublic renderType = RenderTypes.HTML;\n\n\tpublic id: string;\n\n\tprotected parent: any;\n\n\tprotected configs: any = {};\n\n\tprotected model: any;\n\tprotected services: any;\n\n\tconstructor(model: ChartModel, services: any, configs?: any) {\n\t\tthis.model = model;\n\t\tthis.services = services;\n\n\t\tif (configs) {\n\t\t\tthis.configs = configs;\n\t\t\tif (this.configs.id) {\n\t\t\t\tconst chartprefix = Tools.getProperty(\n\t\t\t\t\tthis.model.getOptions(),\n\t\t\t\t\t'style',\n\t\t\t\t\t'prefix'\n\t\t\t\t);\n\t\t\t\tthis.id = `${chartprefix}--${this.configs.id}`;\n\t\t\t}\n\t\t}\n\n\t\t// Set parent element to shell SVG if no parent exists for component\n\t\tif (!this.parent) {\n\t\t\tthis.setParent(select(this.services.domUtils.getMainContainer()));\n\t\t}\n\t}\n\n\tinit() {\n\t\t// do nothing.\n\t}\n\n\trender(animate = true) {\n\t\tconsole.error('render() method is not implemented');\n\t}\n\n\tdestroy() {\n\t\t// do nothing.\n\t}\n\n\t// Used to pass down information to the components\n\tsetModel(newObj) {\n\t\tthis.model = newObj;\n\t}\n\n\t// Used to pass down information to the components\n\tsetServices(newObj) {\n\t\tthis.services = newObj;\n\t}\n\n\tsetParent(parent) {\n\t\tconst oldParent = this.parent;\n\t\tthis.parent = parent;\n\n\t\tif (oldParent && oldParent.node() === parent.node()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.type) {\n\t\t\tconst chartprefix = Tools.getProperty(\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\t'style',\n\t\t\t\t'prefix'\n\t\t\t);\n\t\t\tthis.parent.classed(\n\t\t\t\t`${settings.prefix}--${chartprefix}--${this.type}`,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tif (oldParent) {\n\t\t\t\toldParent.classed(\n\t\t\t\t\t`${settings.prefix}--${chartprefix}--${this.type}`,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetParent() {\n\t\treturn this.parent;\n\t}\n\n\tgetComponentContainer(configs = { withinChartClip: false }) {\n\t\tif (this.type) {\n\t\t\tconst chartprefix = Tools.getProperty(\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\t'style',\n\t\t\t\t'prefix'\n\t\t\t);\n\n\t\t\tconst idSelector = this.id ? `#${this.id}` : '';\n\t\t\tconst container = DOMUtils.appendOrSelect(\n\t\t\t\tthis.parent,\n\t\t\t\t`${\n\t\t\t\t\tthis.renderType === RenderTypes.SVG ? 'svg' : 'div'\n\t\t\t\t}${idSelector}.${settings.prefix}--${chartprefix}--${this.type}`\n\t\t\t);\n\n\t\t\tif (configs.withinChartClip) {\n\t\t\t\t// get unique chartClipId int this chart from model\n\t\t\t\tconst chartClipId = this.model.get('chartClipId');\n\n\t\t\t\tif (chartClipId) {\n\t\t\t\t\tconst chartClipSelection = select(`#${chartClipId}`);\n\t\t\t\t\tconst chartClipRectSelection = chartClipSelection.select(\n\t\t\t\t\t\t'rect'\n\t\t\t\t\t);\n\n\t\t\t\t\t/*\n\t\t\t\t\t * these checks are needed because of a chrome bug\n\t\t\t\t\t * related to the rendering of the clip path\n\t\t\t\t\t */\n\t\t\t\t\tif (\n\t\t\t\t\t\tchartClipRectSelection.size() !== 0 &&\n\t\t\t\t\t\tparseFloat(chartClipRectSelection.attr('height')) > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontainer.attr('clip-path', `url(#${chartClipId})`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn container.attr('width', '100%').attr('height', '100%');\n\t\t}\n\n\t\treturn this.parent;\n\t}\n\n\t/**\n\t * graphs used in combo charts share a model with global options but can receive their own local options.\n\t * this function retrieves the global options and merges it with any options passed into this\n\t * component's config.options object.\n\t */\n\tgetOptions() {\n\t\tif (this.configs.options) {\n\t\t\tconst options = Tools.merge(\n\t\t\t\t{},\n\t\t\t\tthis.model.getOptions(),\n\t\t\t\tthis.configs.options\n\t\t\t);\n\t\t\treturn options;\n\t\t}\n\t\treturn this.model.getOptions();\n\t}\n}\n"]}
@@ -6,7 +6,6 @@ export declare class Modal extends Component {
6
6
  modal: any;
7
7
  constructor(model: ChartModel, services: any, configs?: any);
8
8
  handleShowModal: () => void;
9
- handleHideModal: () => void;
10
9
  addEventListeners(): void;
11
10
  removeEventListeners(): void;
12
11
  getModalHTML(): string;
@@ -37,21 +37,16 @@ var Modal = /** @class */ (function (_super) {
37
37
  var modalInstance = CarbonModalComponent.create(_this.modal.node());
38
38
  modalInstance.show();
39
39
  };
40
- _this.handleHideModal = function () { };
41
40
  _this.init();
42
41
  return _this;
43
42
  }
44
43
  Modal.prototype.addEventListeners = function () {
45
44
  // listen to show-modal Custom Events to render the modal
46
45
  this.services.events.addEventListener(Events.Modal.SHOW, this.handleShowModal);
47
- // listen to hide-modal Custom Events to hide the modal
48
- this.services.events.addEventListener(Events.Modal.HIDE, this.handleHideModal);
49
46
  };
50
47
  Modal.prototype.removeEventListeners = function () {
51
48
  // remove show-modal Custom Events
52
49
  this.services.events.removeEventListener(Events.Modal.SHOW, this.handleShowModal);
53
- // remove hide-modal Custom Events
54
- this.services.events.removeEventListener(Events.Modal.HIDE, this.handleHideModal);
55
50
  };
56
51
  Modal.prototype.getModalHTML = function () {
57
52
  var options = this.model.getOptions();
@@ -1 +1 @@
1
- {"version":3,"file":"modal.js","sourceRoot":"","sources":["modal.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC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,CAAC;IAED,sBAAM,GAAN;QACC,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC/B,2BAA2B;YAC3B,IAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;YAC1D,IAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAClE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,cAAc,CACnC,MAAM,EACN,SAAO,QAAQ,CAAC,MAAM,UAAK,WAAW,YAAS,CAC/C,CAAC;YAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,KAAK;iBACR,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;iBACxB,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;iBAC1B,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC;iBACtB,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;iBACxB,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC;iBACtC,IAAI,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;iBAC7C,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;SACvB;IACF,CAAC;IAED,uBAAO,GAAP;QACC,+BAA+B;QAC/B,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACnC,CAAC;IACF,YAAC;AAAD,CAAC,AArID,CAA2B,SAAS,GAqInC","sourcesContent":["import { Component } from '../component';\nimport { Tools } from '../../tools';\nimport { DOMUtils } from '../../services';\nimport { ChartModel } from '../../model/model';\nimport { Events, ScaleTypes } from '../../interfaces';\n\n// Carbon modal\nimport { Modal as CarbonModalComponent } from 'carbon-components';\n\n// import the settings for the css prefix\nimport settings from 'carbon-components/es/globals/js/settings';\n\n// D3 Imports\nimport { select } from 'd3-selection';\n\n// date formatting\nimport { format } from 'date-fns';\n\nimport { get } from 'lodash-es';\n\nexport class Modal extends Component {\n\ttype = 'modal';\n\n\t// flag for checking whether tooltip event listener is added or not\n\tisEventListenerAdded = false;\n\tmodal: any;\n\n\tconstructor(model: ChartModel, services: any, configs?: any) {\n\t\tsuper(model, services, configs);\n\n\t\tthis.init();\n\t}\n\n\thandleShowModal = () => {\n\t\tthis.modal.html(this.getModalHTML());\n\t\tthis.modal\n\t\t\t.select('div.bx--modal-footer button.bx--btn')\n\t\t\t.on('click', () => this.model.exportToCSV());\n\n\t\tconst modalInstance = CarbonModalComponent.create(this.modal.node());\n\t\tmodalInstance.show();\n\t};\n\n\thandleHideModal = () => {};\n\n\taddEventListeners() {\n\t\t// listen to show-modal Custom Events to render the modal\n\t\tthis.services.events.addEventListener(\n\t\t\tEvents.Modal.SHOW,\n\t\t\tthis.handleShowModal\n\t\t);\n\n\t\t// listen to hide-modal Custom Events to hide the modal\n\t\tthis.services.events.addEventListener(\n\t\t\tEvents.Modal.HIDE,\n\t\t\tthis.handleHideModal\n\t\t);\n\t}\n\n\tremoveEventListeners() {\n\t\t// remove show-modal Custom Events\n\t\tthis.services.events.removeEventListener(\n\t\t\tEvents.Modal.SHOW,\n\t\t\tthis.handleShowModal\n\t\t);\n\n\t\t// remove hide-modal Custom Events\n\t\tthis.services.events.removeEventListener(\n\t\t\tEvents.Modal.HIDE,\n\t\t\tthis.handleHideModal\n\t\t);\n\t}\n\n\tgetModalHTML() {\n\t\tconst options = this.model.getOptions();\n\n\t\tconst chartprefix = Tools.getProperty(options, 'style', 'prefix');\n\n\t\tconst tableArray = this.model.getTabularDataArray();\n\n\t\treturn `\n\t\t<div class=\"bx--modal-container\">\n\t\t\t<div class=\"bx--modal-header\">\n\t\t\t\t<p class=\"bx--modal-header__label bx--type-delta\" id=\"modal-title\">Tabular representation</p>\n\t\t\t\t<p class=\"bx--modal-header__heading bx--type-beta\" id=\"modal-description\">${\n\t\t\t\t\toptions.title\n\t\t\t\t}</p>\n\t\t\t\t<button class=\"bx--modal-close\" type=\"button\" data-modal-close aria-label=\"close modal\" data-modal-primary-focus>\n\t\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" aria-label=\"Close\" width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" role=\"img\" class=\"bx--modal-close__icon\">\n\t\t\t\t\t\t<path d=\"M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z\"></path>\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class=\"bx--modal-content\"><table class=\"bx--data-table bx--data-table--no-border\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t${get(tableArray, 0)\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t(heading) => `<th scope=\"col\">\n\t\t\t\t\t\t\t\t<div class=\"bx--table-header-label\">${heading}</div>\n\t\t\t\t\t\t\t</th>`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join('')}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>${tableArray\n\t\t\t\t\t\t.slice(1)\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(row) => `\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t${row.map((column) => `<td>${column}</td>`).join('')}\n\t\t\t\t\t\t\t</tr>`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('')}\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=\"bx--modal-footer\">\n\t\t\t <div class=\"${settings.prefix}--${chartprefix}-modal-footer-spacer\"></div>\n\t\t\t <button class=\"bx--btn bx--btn--primary\" type=\"button\" data-modal-primary-focus>Download as CSV</button>\n\t\t\t</div>\n\t\t</div>`;\n\t}\n\n\trender() {\n\t\tconst options = this.model.getOptions();\n\t\tif (!this.isEventListenerAdded) {\n\t\t\t// Grab the tooltip element\n\t\t\tconst holder = select(this.services.domUtils.getHolder());\n\t\t\tconst chartprefix = Tools.getProperty(options, 'style', 'prefix');\n\t\t\tthis.modal = DOMUtils.appendOrSelect(\n\t\t\t\tholder,\n\t\t\t\t`div.${settings.prefix}--${chartprefix}--modal`\n\t\t\t);\n\n\t\t\tthis.addEventListeners();\n\t\t\tthis.isEventListenerAdded = true;\n\t\t\tthis.modal\n\t\t\t\t.attr('data-modal', true)\n\t\t\t\t.attr('class', 'bx--modal')\n\t\t\t\t.attr('role', 'dialog')\n\t\t\t\t.attr('aria-modal', true)\n\t\t\t\t.attr('aria-labelledby', 'modal-title')\n\t\t\t\t.attr('aria-describedby', 'modal-description')\n\t\t\t\t.attr('tabindex', -1);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\t// remove tooltip eventListener\n\t\tthis.removeEventListeners();\n\t\tthis.isEventListenerAdded = false;\n\t}\n}\n"]}
1
+ {"version":3,"file":"modal.js","sourceRoot":"","sources":["modal.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,eAAe;AACf,OAAO,EAAE,KAAK,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAElE,yCAAyC;AACzC,OAAO,QAAQ,MAAM,0CAA0C,CAAC;AAEhE,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,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E,WAAW,CAAC;iBAC1B,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC;iBACtB,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;iBACxB,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC;iBACtC,IAAI,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;iBAC7C,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;SACvB;IACF,CAAC;IAED,uBAAO,GAAP;QACC,+BAA+B;QAC/B,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACnC,CAAC;IACF,YAAC;AAAD,CAAC,AAvHD,CAA2B,SAAS,GAuHnC","sourcesContent":["import { Component } from '../component';\nimport { Tools } from '../../tools';\nimport { DOMUtils } from '../../services';\nimport { ChartModel } from '../../model/model';\nimport { Events } from '../../interfaces';\n\n// Carbon modal\nimport { Modal as CarbonModalComponent } from 'carbon-components';\n\n// import the settings for the css prefix\nimport settings from 'carbon-components/es/globals/js/settings';\n\n// D3 Imports\nimport { select } from 'd3-selection';\n\nimport { get } from 'lodash-es';\n\nexport class Modal extends Component {\n\ttype = 'modal';\n\n\t// flag for checking whether tooltip event listener is added or not\n\tisEventListenerAdded = false;\n\tmodal: any;\n\n\tconstructor(model: ChartModel, services: any, configs?: any) {\n\t\tsuper(model, services, configs);\n\n\t\tthis.init();\n\t}\n\n\thandleShowModal = () => {\n\t\tthis.modal.html(this.getModalHTML());\n\t\tthis.modal\n\t\t\t.select('div.bx--modal-footer button.bx--btn')\n\t\t\t.on('click', () => this.model.exportToCSV());\n\n\t\tconst modalInstance = CarbonModalComponent.create(this.modal.node());\n\t\tmodalInstance.show();\n\t};\n\n\taddEventListeners() {\n\t\t// listen to show-modal Custom Events to render the modal\n\t\tthis.services.events.addEventListener(\n\t\t\tEvents.Modal.SHOW,\n\t\t\tthis.handleShowModal\n\t\t);\n\t}\n\n\tremoveEventListeners() {\n\t\t// remove show-modal Custom Events\n\t\tthis.services.events.removeEventListener(\n\t\t\tEvents.Modal.SHOW,\n\t\t\tthis.handleShowModal\n\t\t);\n\t}\n\n\tgetModalHTML() {\n\t\tconst options = this.model.getOptions();\n\n\t\tconst chartprefix = Tools.getProperty(options, 'style', 'prefix');\n\n\t\tconst tableArray = this.model.getTabularDataArray();\n\n\t\treturn `\n\t\t<div class=\"bx--modal-container\">\n\t\t\t<div class=\"bx--modal-header\">\n\t\t\t\t<p class=\"bx--modal-header__label bx--type-delta\" id=\"modal-title\">Tabular representation</p>\n\t\t\t\t<p class=\"bx--modal-header__heading bx--type-beta\" id=\"modal-description\">${\n\t\t\t\t\toptions.title\n\t\t\t\t}</p>\n\t\t\t\t<button class=\"bx--modal-close\" type=\"button\" data-modal-close aria-label=\"close modal\" data-modal-primary-focus>\n\t\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" aria-label=\"Close\" width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" role=\"img\" class=\"bx--modal-close__icon\">\n\t\t\t\t\t\t<path d=\"M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z\"></path>\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class=\"bx--modal-content\"><table class=\"bx--data-table bx--data-table--no-border\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t${get(tableArray, 0)\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t(heading) => `<th scope=\"col\">\n\t\t\t\t\t\t\t\t<div class=\"bx--table-header-label\">${heading}</div>\n\t\t\t\t\t\t\t</th>`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join('')}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>${tableArray\n\t\t\t\t\t\t.slice(1)\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t(row) => `\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t${row.map((column) => `<td>${column}</td>`).join('')}\n\t\t\t\t\t\t\t</tr>`\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('')}\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=\"bx--modal-footer\">\n\t\t\t <div class=\"${settings.prefix}--${chartprefix}-modal-footer-spacer\"></div>\n\t\t\t <button class=\"bx--btn bx--btn--primary\" type=\"button\" data-modal-primary-focus>Download as CSV</button>\n\t\t\t</div>\n\t\t</div>`;\n\t}\n\n\trender() {\n\t\tconst options = this.model.getOptions();\n\t\tif (!this.isEventListenerAdded) {\n\t\t\t// Grab the tooltip element\n\t\t\tconst holder = select(this.services.domUtils.getHolder());\n\t\t\tconst chartprefix = Tools.getProperty(options, 'style', 'prefix');\n\t\t\tthis.modal = DOMUtils.appendOrSelect(\n\t\t\t\tholder,\n\t\t\t\t`div.${settings.prefix}--${chartprefix}--modal`\n\t\t\t);\n\n\t\t\tthis.addEventListeners();\n\t\t\tthis.isEventListenerAdded = true;\n\t\t\tthis.modal\n\t\t\t\t.attr('data-modal', true)\n\t\t\t\t.attr('class', 'bx--modal')\n\t\t\t\t.attr('role', 'dialog')\n\t\t\t\t.attr('aria-modal', true)\n\t\t\t\t.attr('aria-labelledby', 'modal-title')\n\t\t\t\t.attr('aria-describedby', 'modal-description')\n\t\t\t\t.attr('tabindex', -1);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\t// remove tooltip eventListener\n\t\tthis.removeEventListeners();\n\t\tthis.isEventListenerAdded = false;\n\t}\n}\n"]}
@@ -146,7 +146,7 @@ var StackedBar = /** @class */ (function (_super) {
146
146
  y1 += d[1] === 0 ? 2 : 1;
147
147
  }
148
148
  else {
149
- y1 -= d[1] === 0 ? 1 : 1;
149
+ y1 -= 1;
150
150
  }
151
151
  }
152
152
  else if (!barIsNegative) {
@@ -1 +1 @@
1
- {"version":3,"file":"bar-stacked.js","sourceRoot":"","sources":["bar-stacked.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,GACX,MAAM,kBAAkB,CAAC;AAE1B,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;IAAgC,8BAAG;IAAnC;QAAA,qEA2SC;QA1SA,UAAI,GAAG,aAAa,CAAC;QACrB,gBAAU,GAAG,WAAW,CAAC,GAAG,CAAC;QAqJ7B,wDAAwD;QACxD,yBAAmB,GAAG,UAAC,KAAkB;YAChC,IAAA,4CAAc,CAAkB;YAEhC,IAAA,uDAAW,CAAkC;YAErD,KAAI,CAAC,MAAM;iBACT,SAAS,CAAC,UAAU,CAAC;iBACrB,UAAU,CAAC,kBAAkB,CAAC;iBAC9B,IAAI,CAAC,UAAC,CAAC;gBACP,OAAA,KAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAC;oBACzC,UAAU,EAAE,CAAC;oBACb,IAAI,EAAE,kBAAkB;iBACxB,CAAC;YAHF,CAGE,CACF;iBACA,IAAI,CAAC,SAAS,EAAE,UAAC,CAAC;gBAClB,OAAA,CAAC,CAAC,WAAW,CAAC,KAAK,cAAc,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAA3D,CAA2D,CAC3D,CAAC;QACJ,CAAC,CAAC;QAEF,4BAA4B;QAC5B,0BAAoB,GAAG,UAAC,KAAkB;YACzC,KAAI,CAAC,MAAM;iBACT,SAAS,CAAC,UAAU,CAAC;iBACrB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ar } from './bar';\nimport {\n\tRoles,\n\tEvents,\n\tCartesianOrientations,\n\tColorClassNameTypes,\n\tRenderTypes,\n} from '../../interfaces';\n\n// D3 Imports\nimport { select } from 'd3-selection';\n\nexport class StackedBar extends Bar {\n\ttype = 'stacked-bar';\n\trenderType = RenderTypes.SVG;\n\n\tinit() {\n\t\tconst eventsFragment = this.services.events;\n\n\t\t// Highlight correct circle on legend item hovers\n\t\teventsFragment.addEventListener(\n\t\t\tEvents.Legend.ITEM_HOVER,\n\t\t\tthis.handleLegendOnHover\n\t\t);\n\n\t\t// Un-highlight circles on legend item mouseouts\n\t\teventsFragment.addEventListener(\n\t\t\tEvents.Legend.ITEM_MOUSEOUT,\n\t\t\tthis.handleLegendMouseOut\n\t\t);\n\t}\n\n\trender(animate: boolean) {\n\t\t// Grab container SVG\n\t\tconst svg = this.getComponentContainer({ withinChartClip: true });\n\n\t\t// Chart options mixed with the internal configurations\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Create the data and keys that'll be used by the stack layout\n\t\tconst stackData = this.model.getStackedData({\n\t\t\tgroups: this.configs.groups,\n\t\t\tdivergent: true,\n\t\t});\n\n\t\tconst activeDataGroupNames = this.model.getActiveDataGroupNames();\n\n\t\t// Update data on all bar groups\n\t\tconst barGroups = svg\n\t\t\t.selectAll('g.bars')\n\t\t\t.data(stackData, (d) => Tools.getProperty(d, 0, groupMapsTo));\n\n\t\t// Remove elements that need to be exited\n\t\t// We need exit at the top here to make sure that\n\t\t// Data filters are processed before entering new elements\n\t\t// Or updating existing ones\n\t\tbarGroups.exit().attr('opacity', 0).remove();\n\n\t\t// Add bar groups that need to be introduced\n\t\tbarGroups\n\t\t\t.enter()\n\t\t\t.append('g')\n\t\t\t.classed('bars', true)\n\t\t\t.attr('role', Roles.GROUP)\n\t\t\t.attr('data-name', 'bars');\n\n\t\t// Update data on all bars\n\t\tconst bars = svg\n\t\t\t.selectAll('g.bars')\n\t\t\t.selectAll('path.bar')\n\t\t\t.data(\n\t\t\t\t(d) => d,\n\t\t\t\t(d) => d.data.sharedStackKey\n\t\t\t);\n\n\t\t// Remove bars that need to be removed\n\t\tbars.exit().remove();\n\n\t\tbars.enter()\n\t\t\t.append('path')\n\t\t\t.merge(bars)\n\t\t\t.classed('bar', true)\n\t\t\t.transition()\n\t\t\t.call((t) =>\n\t\t\t\tthis.services.transitions.setupTransition({\n\t\t\t\t\ttransition: t,\n\t\t\t\t\tname: 'bar-update-enter',\n\t\t\t\t\tanimate,\n\t\t\t\t})\n\t\t\t)\n\t\t\t.attr('class', (d) =>\n\t\t\t\tthis.model.getColorClassName({\n\t\t\t\t\tclassNameTypes: [ColorClassNameTypes.FILL],\n\t\t\t\t\tdataGroupName: d[groupMapsTo],\n\t\t\t\t\toriginalClassName: 'bar',\n\t\t\t\t})\n\t\t\t)\n\t\t\t.style('fill', (d) => this.model.getFillColor(d[groupMapsTo]))\n\t\t\t.attr('d', (d, i) => {\n\t\t\t\tconst key = d.data.sharedStackKey;\n\n\t\t\t\t/*\n\t\t\t\t * Orientation support for horizontal/vertical bar charts\n\t\t\t\t * Determine coordinates needed for a vertical set of paths\n\t\t\t\t * to draw the bars needed, and pass those coordinates down to\n\t\t\t\t * generateSVGPathString() to decide whether it needs to flip them\n\t\t\t\t */\n\t\t\t\tconst barWidth = this.getBarWidth();\n\t\t\t\tconst x0 =\n\t\t\t\t\tthis.services.cartesianScales.getDomainValue(key, i) -\n\t\t\t\t\tbarWidth / 2;\n\t\t\t\tconst x1 = x0 + barWidth;\n\t\t\t\tlet y0 = this.services.cartesianScales.getRangeValue(d[0], i);\n\t\t\t\tlet y1 = this.services.cartesianScales.getRangeValue(d[1], i);\n\n\t\t\t\t// don't show if part of bar is out of zoom domain\n\t\t\t\tif (this.isOutsideZoomedDomain(x0, x1)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Add the divider gap\n\t\t\t\tif (\n\t\t\t\t\tMath.abs(y1 - y0) > 0 &&\n\t\t\t\t\tMath.abs(y1 - y0) > options.bars.dividerSize\n\t\t\t\t) {\n\t\t\t\t\tconst barIsNegative = d[0] < 0 && d[1] <= 0;\n\t\t\t\t\tif (barIsNegative && activeDataGroupNames.length > 1) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.services.cartesianScales.getOrientation() ===\n\t\t\t\t\t\t\tCartesianOrientations.VERTICAL\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ty1 += d[1] === 0 ? 2 : 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ty1 -= d[1] === 0 ? 1 : 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!barIsNegative) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.services.cartesianScales.getOrientation() ===\n\t\t\t\t\t\t\tCartesianOrientations.VERTICAL\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ty1 += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ty1 -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn Tools.generateSVGPathString(\n\t\t\t\t\t{ x0, x1, y0, y1 },\n\t\t\t\t\tthis.services.cartesianScales.getOrientation()\n\t\t\t\t);\n\t\t\t})\n\t\t\t.attr('opacity', 1)\n\t\t\t// a11y\n\t\t\t.attr('role', Roles.GRAPHICS_SYMBOL)\n\t\t\t.attr('aria-roledescription', 'bar')\n\t\t\t.attr('aria-label', (d) => d[1] - d[0]);\n\n\t\t// Add event listeners for the above elements\n\t\tthis.addEventListeners();\n\t}\n\n\t// Highlight elements that match the hovered legend item\n\thandleLegendOnHover = (event: CustomEvent) => {\n\t\tconst { hoveredElement } = event.detail;\n\n\t\tconst { groupMapsTo } = this.model.getOptions().data;\n\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.transition('legend-hover-bar')\n\t\t\t.call((t) =>\n\t\t\t\tthis.services.transitions.setupTransition({\n\t\t\t\t\ttransition: t,\n\t\t\t\t\tname: 'legend-hover-bar',\n\t\t\t\t})\n\t\t\t)\n\t\t\t.attr('opacity', (d) =>\n\t\t\t\td[groupMapsTo] !== hoveredElement.datum()['name'] ? 0.3 : 1\n\t\t\t);\n\t};\n\n\t// Un-highlight all elements\n\thandleLegendMouseOut = (event: CustomEvent) => {\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.transition('legend-mouseout-bar')\n\t\t\t.call((t) =>\n\t\t\t\tthis.services.transitions.setupTransition({\n\t\t\t\t\ttransition: t,\n\t\t\t\t\tname: 'legend-mouseout-bar',\n\t\t\t\t})\n\t\t\t)\n\t\t\t.attr('opacity', 1);\n\t};\n\n\taddEventListeners() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst self = this;\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.on('mouseover', function (event, datum) {\n\t\t\t\tconst hoveredElement = select(this);\n\t\t\t\thoveredElement.classed('hovered', true);\n\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: hoveredElement,\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\n\t\t\t\tconst displayData = self.model.getDisplayData(\n\t\t\t\t\tself.configs.groups\n\t\t\t\t);\n\n\t\t\t\tlet matchingDataPoint = displayData.find((d) => {\n\t\t\t\t\tconst domainIdentifier = self.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\td\n\t\t\t\t\t);\n\t\t\t\t\tconst rangeIdentifier = self.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\t\td\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\td[rangeIdentifier] === datum.data[datum[groupMapsTo]] &&\n\t\t\t\t\t\td[domainIdentifier].toString() ===\n\t\t\t\t\t\t\tdatum.data.sharedStackKey &&\n\t\t\t\t\t\td[groupMapsTo] === datum[groupMapsTo]\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tif (matchingDataPoint === undefined) {\n\t\t\t\t\t// use the primary range and domain ids\n\t\t\t\t\tconst domainIdentifier = self.services.cartesianScales.getDomainIdentifier();\n\t\t\t\t\tconst rangeIdentifier = self.services.cartesianScales.getRangeIdentifier();\n\t\t\t\t\tmatchingDataPoint = {\n\t\t\t\t\t\t[domainIdentifier]: datum.data.sharedStackKey,\n\t\t\t\t\t\t[rangeIdentifier]: datum.data[datum[groupMapsTo]],\n\t\t\t\t\t\t[groupMapsTo]: datum[groupMapsTo],\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Show tooltip\n\t\t\t\tself.services.events.dispatchEvent(Events.Tooltip.SHOW, {\n\t\t\t\t\tevent,\n\t\t\t\t\thoveredElement,\n\t\t\t\t\tdata: [matchingDataPoint],\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on('mousemove', function (event, datum) {\n\t\t\t\tconst hoveredElement = select(this);\n\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_MOUSEMOVE, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: hoveredElement,\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\n\t\t\t\tself.services.events.dispatchEvent(Events.Tooltip.MOVE, {\n\t\t\t\t\tevent,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on('click', function (event, datum) {\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: select(this),\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on('mouseout', function (event, datum) {\n\t\t\t\tconst hoveredElement = select(this);\n\t\t\t\thoveredElement.classed('hovered', false);\n\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: hoveredElement,\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\n\t\t\t\t// Hide tooltip\n\t\t\t\tself.services.events.dispatchEvent(Events.Tooltip.HIDE, {\n\t\t\t\t\thoveredElement,\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\tdestroy() {\n\t\t// Remove event listeners\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.on('mouseover', null)\n\t\t\t.on('mousemove', null)\n\t\t\t.on('mouseout', null);\n\n\t\t// Remove legend listeners\n\t\tconst eventsFragment = this.services.events;\n\t\teventsFragment.removeEventListener(\n\t\t\tEvents.Legend.ITEM_HOVER,\n\t\t\tthis.handleLegendOnHover\n\t\t);\n\t\teventsFragment.removeEventListener(\n\t\t\tEvents.Legend.ITEM_MOUSEOUT,\n\t\t\tthis.handleLegendMouseOut\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"bar-stacked.js","sourceRoot":"","sources":["bar-stacked.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EACN,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,GACX,MAAM,kBAAkB,CAAC;AAE1B,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;IAAgC,8BAAG;IAAnC;QAAA,qEA2SC;QA1SA,UAAI,GAAG,aAAa,CAAC;QACrB,gBAAU,GAAG,WAAW,CAAC,GAAG,CAAC;QAqJ7B,wDAAwD;QACxD,yBAAmB,GAAG,UAAC,KAAkB;YAChC,IAAA,4CAAc,CAAkB;YAEhC,IAAA,uDAAW,CAAkC;YAErD,KAAI,CAAC,MAAM;iBACT,SAAS,CAAC,UAAU,CAAC;iBACrB,UAAU,CAAC,kBAAkB,C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AAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEvB,0BAA0B;QAC1B,IAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC5C,cAAc,CAAC,mBAAmB,CACjC,MAAM,CAAC,MAAM,CAAC,UAAU,EACxB,IAAI,CAAC,mBAAmB,CACxB,CAAC;QACF,cAAc,CAAC,mBAAmB,CACjC,MAAM,CAAC,MAAM,CAAC,aAAa,EAC3B,IAAI,CAAC,oBAAoB,CACzB,CAAC;IACH,CAAC;IACF,iBAAC;AAAD,CAAC,AA3SD,CAAgC,GAAG,GA2SlC","sourcesContent":["// Internal Imports\nimport { Tools } from '../../tools';\nimport { Bar } from './bar';\nimport {\n\tRoles,\n\tEvents,\n\tCartesianOrientations,\n\tColorClassNameTypes,\n\tRenderTypes,\n} from '../../interfaces';\n\n// D3 Imports\nimport { select } from 'd3-selection';\n\nexport class StackedBar extends Bar {\n\ttype = 'stacked-bar';\n\trenderType = RenderTypes.SVG;\n\n\tinit() {\n\t\tconst eventsFragment = this.services.events;\n\n\t\t// Highlight correct circle on legend item hovers\n\t\teventsFragment.addEventListener(\n\t\t\tEvents.Legend.ITEM_HOVER,\n\t\t\tthis.handleLegendOnHover\n\t\t);\n\n\t\t// Un-highlight circles on legend item mouseouts\n\t\teventsFragment.addEventListener(\n\t\t\tEvents.Legend.ITEM_MOUSEOUT,\n\t\t\tthis.handleLegendMouseOut\n\t\t);\n\t}\n\n\trender(animate: boolean) {\n\t\t// Grab container SVG\n\t\tconst svg = this.getComponentContainer({ withinChartClip: true });\n\n\t\t// Chart options mixed with the internal configurations\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Create the data and keys that'll be used by the stack layout\n\t\tconst stackData = this.model.getStackedData({\n\t\t\tgroups: this.configs.groups,\n\t\t\tdivergent: true,\n\t\t});\n\n\t\tconst activeDataGroupNames = this.model.getActiveDataGroupNames();\n\n\t\t// Update data on all bar groups\n\t\tconst barGroups = svg\n\t\t\t.selectAll('g.bars')\n\t\t\t.data(stackData, (d) => Tools.getProperty(d, 0, groupMapsTo));\n\n\t\t// Remove elements that need to be exited\n\t\t// We need exit at the top here to make sure that\n\t\t// Data filters are processed before entering new elements\n\t\t// Or updating existing ones\n\t\tbarGroups.exit().attr('opacity', 0).remove();\n\n\t\t// Add bar groups that need to be introduced\n\t\tbarGroups\n\t\t\t.enter()\n\t\t\t.append('g')\n\t\t\t.classed('bars', true)\n\t\t\t.attr('role', Roles.GROUP)\n\t\t\t.attr('data-name', 'bars');\n\n\t\t// Update data on all bars\n\t\tconst bars = svg\n\t\t\t.selectAll('g.bars')\n\t\t\t.selectAll('path.bar')\n\t\t\t.data(\n\t\t\t\t(d) => d,\n\t\t\t\t(d) => d.data.sharedStackKey\n\t\t\t);\n\n\t\t// Remove bars that need to be removed\n\t\tbars.exit().remove();\n\n\t\tbars.enter()\n\t\t\t.append('path')\n\t\t\t.merge(bars)\n\t\t\t.classed('bar', true)\n\t\t\t.transition()\n\t\t\t.call((t) =>\n\t\t\t\tthis.services.transitions.setupTransition({\n\t\t\t\t\ttransition: t,\n\t\t\t\t\tname: 'bar-update-enter',\n\t\t\t\t\tanimate,\n\t\t\t\t})\n\t\t\t)\n\t\t\t.attr('class', (d) =>\n\t\t\t\tthis.model.getColorClassName({\n\t\t\t\t\tclassNameTypes: [ColorClassNameTypes.FILL],\n\t\t\t\t\tdataGroupName: d[groupMapsTo],\n\t\t\t\t\toriginalClassName: 'bar',\n\t\t\t\t})\n\t\t\t)\n\t\t\t.style('fill', (d) => this.model.getFillColor(d[groupMapsTo]))\n\t\t\t.attr('d', (d, i) => {\n\t\t\t\tconst key = d.data.sharedStackKey;\n\n\t\t\t\t/*\n\t\t\t\t * Orientation support for horizontal/vertical bar charts\n\t\t\t\t * Determine coordinates needed for a vertical set of paths\n\t\t\t\t * to draw the bars needed, and pass those coordinates down to\n\t\t\t\t * generateSVGPathString() to decide whether it needs to flip them\n\t\t\t\t */\n\t\t\t\tconst barWidth = this.getBarWidth();\n\t\t\t\tconst x0 =\n\t\t\t\t\tthis.services.cartesianScales.getDomainValue(key, i) -\n\t\t\t\t\tbarWidth / 2;\n\t\t\t\tconst x1 = x0 + barWidth;\n\t\t\t\tlet y0 = this.services.cartesianScales.getRangeValue(d[0], i);\n\t\t\t\tlet y1 = this.services.cartesianScales.getRangeValue(d[1], i);\n\n\t\t\t\t// don't show if part of bar is out of zoom domain\n\t\t\t\tif (this.isOutsideZoomedDomain(x0, x1)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Add the divider gap\n\t\t\t\tif (\n\t\t\t\t\tMath.abs(y1 - y0) > 0 &&\n\t\t\t\t\tMath.abs(y1 - y0) > options.bars.dividerSize\n\t\t\t\t) {\n\t\t\t\t\tconst barIsNegative = d[0] < 0 && d[1] <= 0;\n\t\t\t\t\tif (barIsNegative && activeDataGroupNames.length > 1) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.services.cartesianScales.getOrientation() ===\n\t\t\t\t\t\t\tCartesianOrientations.VERTICAL\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ty1 += d[1] === 0 ? 2 : 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ty1 -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!barIsNegative) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.services.cartesianScales.getOrientation() ===\n\t\t\t\t\t\t\tCartesianOrientations.VERTICAL\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ty1 += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ty1 -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn Tools.generateSVGPathString(\n\t\t\t\t\t{ x0, x1, y0, y1 },\n\t\t\t\t\tthis.services.cartesianScales.getOrientation()\n\t\t\t\t);\n\t\t\t})\n\t\t\t.attr('opacity', 1)\n\t\t\t// a11y\n\t\t\t.attr('role', Roles.GRAPHICS_SYMBOL)\n\t\t\t.attr('aria-roledescription', 'bar')\n\t\t\t.attr('aria-label', (d) => d[1] - d[0]);\n\n\t\t// Add event listeners for the above elements\n\t\tthis.addEventListeners();\n\t}\n\n\t// Highlight elements that match the hovered legend item\n\thandleLegendOnHover = (event: CustomEvent) => {\n\t\tconst { hoveredElement } = event.detail;\n\n\t\tconst { groupMapsTo } = this.model.getOptions().data;\n\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.transition('legend-hover-bar')\n\t\t\t.call((t) =>\n\t\t\t\tthis.services.transitions.setupTransition({\n\t\t\t\t\ttransition: t,\n\t\t\t\t\tname: 'legend-hover-bar',\n\t\t\t\t})\n\t\t\t)\n\t\t\t.attr('opacity', (d) =>\n\t\t\t\td[groupMapsTo] !== hoveredElement.datum()['name'] ? 0.3 : 1\n\t\t\t);\n\t};\n\n\t// Un-highlight all elements\n\thandleLegendMouseOut = (event: CustomEvent) => {\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.transition('legend-mouseout-bar')\n\t\t\t.call((t) =>\n\t\t\t\tthis.services.transitions.setupTransition({\n\t\t\t\t\ttransition: t,\n\t\t\t\t\tname: 'legend-mouseout-bar',\n\t\t\t\t})\n\t\t\t)\n\t\t\t.attr('opacity', 1);\n\t};\n\n\taddEventListeners() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst self = this;\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.on('mouseover', function (event, datum) {\n\t\t\t\tconst hoveredElement = select(this);\n\t\t\t\thoveredElement.classed('hovered', true);\n\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: hoveredElement,\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\n\t\t\t\tconst displayData = self.model.getDisplayData(\n\t\t\t\t\tself.configs.groups\n\t\t\t\t);\n\n\t\t\t\tlet matchingDataPoint = displayData.find((d) => {\n\t\t\t\t\tconst domainIdentifier = self.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\td\n\t\t\t\t\t);\n\t\t\t\t\tconst rangeIdentifier = self.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\t\td\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\td[rangeIdentifier] === datum.data[datum[groupMapsTo]] &&\n\t\t\t\t\t\td[domainIdentifier].toString() ===\n\t\t\t\t\t\t\tdatum.data.sharedStackKey &&\n\t\t\t\t\t\td[groupMapsTo] === datum[groupMapsTo]\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tif (matchingDataPoint === undefined) {\n\t\t\t\t\t// use the primary range and domain ids\n\t\t\t\t\tconst domainIdentifier = self.services.cartesianScales.getDomainIdentifier();\n\t\t\t\t\tconst rangeIdentifier = self.services.cartesianScales.getRangeIdentifier();\n\t\t\t\t\tmatchingDataPoint = {\n\t\t\t\t\t\t[domainIdentifier]: datum.data.sharedStackKey,\n\t\t\t\t\t\t[rangeIdentifier]: datum.data[datum[groupMapsTo]],\n\t\t\t\t\t\t[groupMapsTo]: datum[groupMapsTo],\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Show tooltip\n\t\t\t\tself.services.events.dispatchEvent(Events.Tooltip.SHOW, {\n\t\t\t\t\tevent,\n\t\t\t\t\thoveredElement,\n\t\t\t\t\tdata: [matchingDataPoint],\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on('mousemove', function (event, datum) {\n\t\t\t\tconst hoveredElement = select(this);\n\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_MOUSEMOVE, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: hoveredElement,\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\n\t\t\t\tself.services.events.dispatchEvent(Events.Tooltip.MOVE, {\n\t\t\t\t\tevent,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on('click', function (event, datum) {\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: select(this),\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.on('mouseout', function (event, datum) {\n\t\t\t\tconst hoveredElement = select(this);\n\t\t\t\thoveredElement.classed('hovered', false);\n\n\t\t\t\t// Dispatch mouse event\n\t\t\t\tself.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {\n\t\t\t\t\tevent,\n\t\t\t\t\telement: hoveredElement,\n\t\t\t\t\tdatum,\n\t\t\t\t});\n\n\t\t\t\t// Hide tooltip\n\t\t\t\tself.services.events.dispatchEvent(Events.Tooltip.HIDE, {\n\t\t\t\t\thoveredElement,\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\tdestroy() {\n\t\t// Remove event listeners\n\t\tthis.parent\n\t\t\t.selectAll('path.bar')\n\t\t\t.on('mouseover', null)\n\t\t\t.on('mousemove', null)\n\t\t\t.on('mouseout', null);\n\n\t\t// Remove legend listeners\n\t\tconst eventsFragment = this.services.events;\n\t\teventsFragment.removeEventListener(\n\t\t\tEvents.Legend.ITEM_HOVER,\n\t\t\tthis.handleLegendOnHover\n\t\t);\n\t\teventsFragment.removeEventListener(\n\t\t\tEvents.Legend.ITEM_MOUSEOUT,\n\t\t\tthis.handleLegendMouseOut\n\t\t);\n\t}\n}\n"]}