@carbon/charts 1.6.3 → 1.6.5

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.
@@ -148,6 +148,10 @@ export interface ToolbarControl {
148
148
  * the toolbar control type
149
149
  */
150
150
  type: ToolbarControlTypes;
151
+ /**
152
+ * used as aria-label for toolbar control
153
+ */
154
+ title?: string;
151
155
  /**
152
156
  * the text to display (if this control is displayed in overflow menu)
153
157
  * type value will be displayed if text is not available
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["components.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tLayoutGrowth,\n\tLegendPositions,\n\tAlignments,\n\tToolbarControlTypes,\n\tZoomBarTypes,\n\tColorLegendType,\n} from './enums';\nimport { Component } from '../components/component';\nimport { TruncationOptions } from './truncation';\n\n/**\n * customize the overlay contents\n */\nexport interface LayoutComponentChild {\n\tid: string;\n\t/**\n\t * the component that'll be rendered inside layout child\n\t */\n\tcomponents: Component[];\n\t/**\n\t * size of the layout child\n\t */\n\tsize?: number;\n\t/**\n\t * how the layout child will grow or shrink\n\t */\n\tgrowth: LayoutGrowth;\n}\n\n/**\n * customize the legend component\n */\nexport interface LegendOptions {\n\tenabled?: boolean;\n\tposition?: LegendPositions;\n\t/**\n\t * the clickability of legend items\n\t */\n\tclickable?: boolean;\n\ttruncation?: TruncationOptions;\n\talignment?: Alignments;\n\torder?: string[];\n\t/**\n\t * customized legend items\n\t */\n\tadditionalItems?: LegendItem[];\n}\n\n/**\n * customize the legend item\n */\nexport interface LegendItem {\n\ttype: string;\n\tname: string;\n\tfill?: string;\n\tstroke?: string;\n}\n\nexport interface TooltipOptions {\n\t/**\n\t * enable or disable tooltip\n\t */\n\tenabled?: boolean;\n\t/**\n\t * a function to format the tooltip values\n\t */\n\tvalueFormatter?: Function;\n\t/**\n\t * custom function for returning tooltip HTML\n\t * passed an array or object with the data, and then the default tooltip markup\n\t */\n\tcustomHTML?: Function;\n\t/**\n\t * customizes the `Group` label shown inside tooltips\n\t */\n\tgroupLabel?: string;\n\t/**\n\t * show total of items\n\t */\n\tshowTotal?: boolean;\n\t/**\n\t * customizes the `Total` label shown inside tooltips\n\t */\n\ttotalLabel?: string;\n\ttruncation?: TruncationOptions;\n}\n\n/**\n * Threshold options\n */\nexport interface ThresholdOptions {\n\t/**\n\t * threshold value\n\t */\n\tvalue: number | Date;\n\t/**\n\t * a function to format the threshold values\n\t */\n\tvalueFormatter?: Function;\n\t/**\n\t * hex threshold line color\n\t */\n\tfillColor: string;\n\t/**\n\t * threshold label\n\t */\n\tlabel: string;\n}\n\nexport interface GridOptions {\n\ty?: {\n\t\tenabled?: boolean;\n\t\tnumberOfTicks?: number;\n\t\talignWithAxisTicks?: boolean;\n\t};\n\tx?: {\n\t\tenabled?: boolean;\n\t\tnumberOfTicks?: number;\n\t\talignWithAxisTicks?: boolean;\n\t};\n}\n\n/**\n * Ruler options\n */\nexport interface RulerOptions {\n\tenabled?: boolean;\n}\n\nexport interface BarOptions {\n\twidth?: number;\n\tmaxWidth?: number;\n\t/*\n\t * can be used to manually modify spacing between bars\n\t * @default 0.25\n\t */\n\tspacingFactor?: number;\n}\n\nexport interface StackedBarOptions extends BarOptions {\n\tdividerSize?: number;\n}\n\n/**\n * customize the Toolbar component\n */\nexport interface ToolbarOptions {\n\t/**\n\t * is the toolbar visible or not\n\t */\n\tenabled?: boolean;\n\t/**\n\t * the maximum toolbar controls to be displayed as icons\n\t * controls more than this number will appear in the overflow menu\n\t * minimum is 1. (all toolbar controls are in overflow menu)\n\t */\n\tnumberOfIcons?: number;\n\t/**\n\t * toolbar controls which will be displayed following the array order\n\t */\n\tcontrols?: ToolbarControl[];\n}\n\n/**\n * options for each toolbar control\n */\nexport interface ToolbarControl {\n\t/**\n\t * the toolbar control type\n\t */\n\ttype: ToolbarControlTypes;\n\t/**\n\t * the text to display (if this control is displayed in overflow menu)\n\t * type value will be displayed if text is not available\n\t */\n\ttext?: string;\n\t/**\n\t * custom id for button\n\t */\n\tid?: String;\n\t/**\n\t * SVG HTML element\n\t */\n\ticonSVG?: {\n\t\tcontent?: string;\n\t\theight?: string;\n\t\twidth?: string;\n\t};\n\tshouldBeDisabled?: Function;\n\t/**\n\t * function to execute on button click\n\t * alternatively, users can choose to not pass in a function and can\n\t * listen for events to execute asynchronously\n\t */\n\tclickFunction?: Function;\n}\n\n/**\n * customize the ZoomBars in a chart\n */\nexport interface ZoomBarsOptions {\n\t/**\n\t * a variable to handle default zoom in ratio (0 ~ 1.0)\n\t * ex: shift click zoom in ratio\n\t */\n\tzoomRatio?: number;\n\t/**\n\t * a variable to define the minimum zoom ratio (0 ~ 1.0)\n\t * If ( zoom domain / max domain ) < minZoomRatio, zoom-in functions will be disabled\n\t */\n\tminZoomRatio?: number;\n\t/**\n\t * currently only the top position is supported\n\t */\n\ttop?: ZoomBarOptions;\n\t/**\n\t * whether keep updating range axis in real time while zoom domain is changing\n\t */\n\tupdateRangeAxis?: boolean;\n}\n\n/**\n * customize the ZoomBar component\n */\nexport interface ZoomBarOptions {\n\t/**\n\t * is the zoom-bar visible or not\n\t */\n\tenabled?: boolean;\n\t/**\n\t * is the zoom-bar in loading state\n\t */\n\tloading?: boolean;\n\t/**\n\t * is the zoom-bar in locked state\n\t */\n\tlocked?: boolean;\n\t/**\n\t * whether the zoom bar is showing a slider view or a graph view etc.\n\t */\n\ttype?: ZoomBarTypes;\n\t/**\n\t * an two element array which represents the initial zoom domain\n\t */\n\tinitialZoomDomain?: Object[];\n\t/**\n\t * options related to zoom bar data\n\t */\n\tdata?: Object[];\n}\n"]}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["components.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tLayoutGrowth,\n\tLegendPositions,\n\tAlignments,\n\tToolbarControlTypes,\n\tZoomBarTypes,\n} from './enums';\nimport { Component } from '../components/component';\nimport { TruncationOptions } from './truncation';\n\n/**\n * customize the overlay contents\n */\nexport interface LayoutComponentChild {\n\tid: string;\n\t/**\n\t * the component that'll be rendered inside layout child\n\t */\n\tcomponents: Component[];\n\t/**\n\t * size of the layout child\n\t */\n\tsize?: number;\n\t/**\n\t * how the layout child will grow or shrink\n\t */\n\tgrowth: LayoutGrowth;\n}\n\n/**\n * customize the legend component\n */\nexport interface LegendOptions {\n\tenabled?: boolean;\n\tposition?: LegendPositions;\n\t/**\n\t * the clickability of legend items\n\t */\n\tclickable?: boolean;\n\ttruncation?: TruncationOptions;\n\talignment?: Alignments;\n\torder?: string[];\n\t/**\n\t * customized legend items\n\t */\n\tadditionalItems?: LegendItem[];\n}\n\n/**\n * customize the legend item\n */\nexport interface LegendItem {\n\ttype: string;\n\tname: string;\n\tfill?: string;\n\tstroke?: string;\n}\n\nexport interface TooltipOptions {\n\t/**\n\t * enable or disable tooltip\n\t */\n\tenabled?: boolean;\n\t/**\n\t * a function to format the tooltip values\n\t */\n\tvalueFormatter?: Function;\n\t/**\n\t * custom function for returning tooltip HTML\n\t * passed an array or object with the data, and then the default tooltip markup\n\t */\n\tcustomHTML?: Function;\n\t/**\n\t * customizes the `Group` label shown inside tooltips\n\t */\n\tgroupLabel?: string;\n\t/**\n\t * show total of items\n\t */\n\tshowTotal?: boolean;\n\t/**\n\t * customizes the `Total` label shown inside tooltips\n\t */\n\ttotalLabel?: string;\n\ttruncation?: TruncationOptions;\n}\n\n/**\n * Threshold options\n */\nexport interface ThresholdOptions {\n\t/**\n\t * threshold value\n\t */\n\tvalue: number | Date;\n\t/**\n\t * a function to format the threshold values\n\t */\n\tvalueFormatter?: Function;\n\t/**\n\t * hex threshold line color\n\t */\n\tfillColor: string;\n\t/**\n\t * threshold label\n\t */\n\tlabel: string;\n}\n\nexport interface GridOptions {\n\ty?: {\n\t\tenabled?: boolean;\n\t\tnumberOfTicks?: number;\n\t\talignWithAxisTicks?: boolean;\n\t};\n\tx?: {\n\t\tenabled?: boolean;\n\t\tnumberOfTicks?: number;\n\t\talignWithAxisTicks?: boolean;\n\t};\n}\n\n/**\n * Ruler options\n */\nexport interface RulerOptions {\n\tenabled?: boolean;\n}\n\nexport interface BarOptions {\n\twidth?: number;\n\tmaxWidth?: number;\n\t/*\n\t * can be used to manually modify spacing between bars\n\t * @default 0.25\n\t */\n\tspacingFactor?: number;\n}\n\nexport interface StackedBarOptions extends BarOptions {\n\tdividerSize?: number;\n}\n\n/**\n * customize the Toolbar component\n */\nexport interface ToolbarOptions {\n\t/**\n\t * is the toolbar visible or not\n\t */\n\tenabled?: boolean;\n\t/**\n\t * the maximum toolbar controls to be displayed as icons\n\t * controls more than this number will appear in the overflow menu\n\t * minimum is 1. (all toolbar controls are in overflow menu)\n\t */\n\tnumberOfIcons?: number;\n\t/**\n\t * toolbar controls which will be displayed following the array order\n\t */\n\tcontrols?: ToolbarControl[];\n}\n\n/**\n * options for each toolbar control\n */\nexport interface ToolbarControl {\n\t/**\n\t * the toolbar control type\n\t */\n\ttype: ToolbarControlTypes;\n\t/**\n\t * used as aria-label for toolbar control\n\t */\n\ttitle?: string;\n\t/**\n\t * the text to display (if this control is displayed in overflow menu)\n\t * type value will be displayed if text is not available\n\t */\n\ttext?: string;\n\t/**\n\t * custom id for button\n\t */\n\tid?: String;\n\t/**\n\t * SVG HTML element\n\t */\n\ticonSVG?: {\n\t\tcontent?: string;\n\t\theight?: string;\n\t\twidth?: string;\n\t};\n\tshouldBeDisabled?: Function;\n\t/**\n\t * function to execute on button click\n\t * alternatively, users can choose to not pass in a function and can\n\t * listen for events to execute asynchronously\n\t */\n\tclickFunction?: Function;\n}\n\n/**\n * customize the ZoomBars in a chart\n */\nexport interface ZoomBarsOptions {\n\t/**\n\t * a variable to handle default zoom in ratio (0 ~ 1.0)\n\t * ex: shift click zoom in ratio\n\t */\n\tzoomRatio?: number;\n\t/**\n\t * a variable to define the minimum zoom ratio (0 ~ 1.0)\n\t * If ( zoom domain / max domain ) < minZoomRatio, zoom-in functions will be disabled\n\t */\n\tminZoomRatio?: number;\n\t/**\n\t * currently only the top position is supported\n\t */\n\ttop?: ZoomBarOptions;\n\t/**\n\t * whether keep updating range axis in real time while zoom domain is changing\n\t */\n\tupdateRangeAxis?: boolean;\n}\n\n/**\n * customize the ZoomBar component\n */\nexport interface ZoomBarOptions {\n\t/**\n\t * is the zoom-bar visible or not\n\t */\n\tenabled?: boolean;\n\t/**\n\t * is the zoom-bar in loading state\n\t */\n\tloading?: boolean;\n\t/**\n\t * is the zoom-bar in locked state\n\t */\n\tlocked?: boolean;\n\t/**\n\t * whether the zoom bar is showing a slider view or a graph view etc.\n\t */\n\ttype?: ZoomBarTypes;\n\t/**\n\t * an two element array which represents the initial zoom domain\n\t */\n\tinitialZoomDomain?: Object[];\n\t/**\n\t * options related to zoom bar data\n\t */\n\tdata?: Object[];\n}\n"]}
package/model/model.js CHANGED
@@ -18,7 +18,7 @@ import { Events, ScaleTypes } from '../interfaces';
18
18
  import { scaleOrdinal } from 'd3-scale';
19
19
  import { stack, stackOffsetDiverging } from 'd3-shape';
20
20
  import { histogram } from 'd3-array';
21
- import { formatDateTillMilliSeconds } from "../services/time-series";
21
+ import { formatDateTillMilliSeconds } from '../services/time-series';
22
22
  /** The charting model layer which includes mainly the chart data and options,
23
23
  * as well as some misc. information to be shared among components */
24
24
  var ChartModel = /** @class */ (function () {
@@ -579,7 +579,7 @@ var ChartModel = /** @class */ (function () {
579
579
  };
580
580
  ChartModel.prototype.exportToCSV = function () {
581
581
  var data = this.getTabularDataArray().map(function (row) {
582
- return row.map(function (column) { return "\"" + column + "\""; });
582
+ return row.map(function (column) { return "\"" + (column === '&ndash;' ? '–' : column) + "\""; });
583
583
  });
584
584
  var csvString = '', csvData = '';
585
585
  data.forEach(function (d, i) {
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["model.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,mCAAmC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,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,iBAAC;AAAD,CAAC,AA92BD,IA82BC","sourcesContent":["// Internal Imports\nimport * as Configuration from '../configuration';\nimport { histogram as histogramConfigs } from '../configuration-non-customizable';\n\nimport { Tools } from '../tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from '../interfaces';\n\n// D3\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack, stackOffsetDiverging } from 'd3-shape';\nimport { histogram } from 'd3-array';\nimport { formatDateTillMilliSeconds } from \"../services/time-series\";\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\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\tprotected colorClassNames: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetAllDataFromDomain(groups?) {\n\t\tif (!this.getData()) {\n\t\t\treturn null;\n\t\t}\n\t\tconst options = this.getOptions();\n\t\t// Remove datasets that have been disabled\n\t\tlet allData = this.getData();\n\t\tconst dataGroups = this.getDataGroups();\n\t\tconst { groupMapsTo } = Tools.getProperty(options, 'data');\n\t\tconst axesOptions = Tools.getProperty(options, 'axes');\n\n\t\t// filter out the groups that are irrelevant to the component\n\t\tif (groups) {\n\t\t\tallData = allData.filter((item) =>\n\t\t\t\tgroups.includes(item[groupMapsTo])\n\t\t\t);\n\t\t}\n\n\t\tif (axesOptions) {\n\t\t\tObject.keys(axesOptions).forEach((axis) => {\n\t\t\t\tconst mapsTo = axesOptions[axis].mapsTo;\n\t\t\t\tconst scaleType = axesOptions[axis].scaleType;\n\t\t\t\t// make sure linear/log values are numbers\n\t\t\t\tif (\n\t\t\t\t\tscaleType === ScaleTypes.LINEAR ||\n\t\t\t\t\tscaleType === ScaleTypes.LOG\n\t\t\t\t) {\n\t\t\t\t\tallData = allData.map((datum) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...datum,\n\t\t\t\t\t\t\t[mapsTo]:\n\t\t\t\t\t\t\t\tdatum[mapsTo] === null\n\t\t\t\t\t\t\t\t\t? datum[mapsTo]\n\t\t\t\t\t\t\t\t\t: Number(datum[mapsTo]),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Check for custom domain\n\t\t\t\tif (mapsTo && axesOptions[axis].domain) {\n\t\t\t\t\tif (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tallData = allData.filter((datum) =>\n\t\t\t\t\t\t\taxesOptions[axis].domain.includes(datum[mapsTo])\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [start, end] = axesOptions[axis].domain;\n\t\t\t\t\t\t// Filter out data outside domain if that datapoint is using that axis (has mapsTo property)\n\t\t\t\t\t\tallData = allData.filter(\n\t\t\t\t\t\t\t(datum) =>\n\t\t\t\t\t\t\t\t!(mapsTo in datum) ||\n\t\t\t\t\t\t\t\t(datum[mapsTo] >= start && datum[mapsTo] <= end)\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\treturn allData.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(group) => group.name === datum[groupMapsTo]\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart\n\t * @param groups the included datasets for the particular chart\n\t */\n\tgetDisplayData(groups?) {\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(groups);\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst allDataFromDomain = this.getAllDataFromDomain(groups);\n\n\t\treturn allDataFromDomain.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(dataGroup) =>\n\t\t\t\t\tdataGroup.name === datum[groupMapsTo] &&\n\t\t\t\t\tdataGroup.status === ACTIVE\n\t\t\t);\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(groups?) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'data',\n\t\t\t'loading'\n\t\t);\n\n\t\t// No data should be displayed while data is still loading\n\t\tif (isDataLoading) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// if its a combo chart, the specific chart will pass the model the groups it needs\n\t\tif (groups) {\n\t\t\treturn this.get('dataGroups').filter((dataGroup) =>\n\t\t\t\tgroups.includes(dataGroup.name)\n\t\t\t);\n\t\t}\n\t\treturn this.get('dataGroups');\n\t}\n\n\tgetActiveDataGroups(groups?) {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups(groups).filter(\n\t\t\t(dataGroup) => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames(groups?) {\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\treturn dataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames(groups?) {\n\t\tconst activeDataGroups = this.getActiveDataGroups(groups);\n\t\treturn activeDataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tprivate aggregateBinDataByGroup(bin) {\n\t\treturn Tools.groupBy(bin, 'group');\n\t}\n\n\tgetBinConfigurations() {\n\t\t// Manipulate data and options for Histogram\n\t\tconst data = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\n\t\tconst mainXPos = this.services.cartesianScales.getMainXAxisPosition();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\n\t\tconst axisOptions = options.axes[mainXPos];\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst { bins: axisBins = histogramConfigs.defaultBins } = axisOptions;\n\t\tconst areBinsDefined = Array.isArray(axisBins);\n\n\t\t// Get Histogram bins\n\t\tconst bins = histogram()\n\t\t\t.value((d) => d[domainIdentifier])\n\t\t\t.thresholds(axisBins)(data);\n\n\t\tif (!areBinsDefined) {\n\t\t\t// If bins are not defined by user\n\t\t\tconst binsWidth = bins[0].x1 - bins[0].x0;\n\t\t\t// Set last bin width as the others\n\t\t\tbins[bins.length - 1].x1 = +bins[bins.length - 1].x0 + binsWidth;\n\t\t} else {\n\t\t\t// Set last bin end as the last user defined one\n\t\t\tbins[bins.length - 1].x1 = axisBins[axisBins.length - 1];\n\t\t}\n\n\t\tconst binsDomain = areBinsDefined\n\t\t\t? [axisBins[0], axisBins[axisBins.length - 1]]\n\t\t\t: [bins[0].x0, bins[bins.length - 1].x1];\n\n\t\t// Get all groups\n\t\tconst groupsKeys = Array.from(new Set(data.map((d) => d[groupMapsTo])));\n\n\t\tconst histogramData = [];\n\n\t\t// Group data by bin\n\t\tbins.forEach((bin) => {\n\t\t\tconst key = `${bin.x0}-${bin.x1}`;\n\t\t\tconst aggregateDataByGroup = this.aggregateBinDataByGroup(bin);\n\n\t\t\tgroupsKeys.forEach((group: string) => {\n\t\t\t\t// For each dataset put a bin with value 0 if not exist\n\t\t\t\t// (Scale X won't change when changing showed datasets)\n\t\t\t\thistogramData.push({\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: aggregateDataByGroup[group] || 0,\n\t\t\t\t\tbin: bin.x0,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn {\n\t\t\tbins,\n\t\t\tbinsDomain,\n\t\t};\n\t}\n\n\tgetBinnedStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getActiveDataGroupNames();\n\n\t\tconst { bins } = this.getBinConfigurations();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tbins,\n\t\t});\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\tgetGroupedData(groups?) {\n\t\tconst displayData = this.getDisplayData(groups);\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\tgetStackKeys(\n\t\t{ bins = null, groups = null } = { bins: null, groups: null }\n\t) {\n\t\tconst options = this.getOptions();\n\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tlet stackKeys;\n\t\tif (bins) {\n\t\t\tstackKeys = bins.map((bin) => `${bin.x0}-${bin.x1}`);\n\t\t} else {\n\t\t\tstackKeys = Tools.removeArrayDuplicates(\n\t\t\t\tdisplayData.map((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\t// Use time value as key for Date object to avoid multiple data in the same second\n\t\t\t\t\tif (datum[domainIdentifier] instanceof Date) {\n\t\t\t\t\t\treturn formatDateTillMilliSeconds(datum[domainIdentifier]);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn datum[domainIdentifier] &&\n\t\t\t\t\t\ttypeof datum[domainIdentifier].toString === 'function'\n\t\t\t\t\t\t? datum[domainIdentifier].toString()\n\t\t\t\t\t\t: datum[domainIdentifier];\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst axisPosition = this.services.cartesianScales.domainAxisPosition;\n\t\tconst scaleType = options.axes[axisPosition].scaleType;\n\n\t\t// Sort keys\n\t\tif (scaleType === ScaleTypes.TIME) {\n\t\t\tstackKeys.sort((a: any, b: any) => {\n\t\t\t\tconst dateA: any = new Date(a);\n\t\t\t\tconst dateB: any = new Date(b);\n\n\t\t\t\treturn dateA - dateB;\n\t\t\t});\n\t\t} else if (\n\t\t\tscaleType === ScaleTypes.LOG ||\n\t\t\tscaleType === ScaleTypes.LINEAR\n\t\t) {\n\t\t\tstackKeys.sort((a: any, b: any) => a - b);\n\t\t}\n\n\t\treturn stackKeys;\n\t}\n\n\tgetDataValuesGroupedByKeys({ bins = null, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\tconst stackKeys = this.getStackKeys({ bins, groups });\n\t\tif (bins) {\n\t\t\treturn stackKeys.map((key) => {\n\t\t\t\tconst [binStart, binEnd] = key.split('-');\n\n\t\t\t\tconst correspondingValues = { x0: binStart, x1: binEnd };\n\t\t\t\tconst correspondingBin = bins.find(\n\t\t\t\t\t(bin) => bin.x0.toString() === binStart.toString()\n\t\t\t\t);\n\n\t\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\t\tcorrespondingValues[\n\t\t\t\t\t\tdataGroupName\n\t\t\t\t\t] = correspondingBin.filter(\n\t\t\t\t\t\t(binItem) => binItem[groupMapsTo] === dataGroupName\n\t\t\t\t\t).length;\n\t\t\t\t});\n\n\t\t\t\treturn correspondingValues;\n\t\t\t}) as any;\n\t\t}\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\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum.hasOwnProperty(domainIdentifier) &&\n\t\t\t\t\t\t(datum[domainIdentifier] instanceof Date\n\t\t\t\t\t\t\t? formatDateTillMilliSeconds(datum[domainIdentifier]) === key\n\t\t\t\t\t \t: datum[domainIdentifier].toString() === key)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\tcorrespondingValues\n\t\t\t\t);\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\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null, divergent = false }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Get only active data groups so non-active data groups are not rendered\n\t\t// on legend item click\n\t\tconst dataGroupNames = this.getActiveDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tgroups,\n\t\t});\n\n\t\tif (percentage) {\n\t\t\tconst maxByKey = Tools.fromPairs(\n\t\t\t\tdataValuesGroupedByKeys.map((d: any) => [d.sharedStackKey, 0])\n\t\t\t);\n\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tmaxByKey[d.sharedStackKey] += d[name];\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// cycle through data values to get percentage\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tif (maxByKey[d.sharedStackKey]) {\n\t\t\t\t\t\td[name] = (d[name] / maxByKey[d.sharedStackKey]) * 100;\n\t\t\t\t\t} else {\n\t\t\t\t\t\td[name] = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst stackToUse = divergent\n\t\t\t? stack().offset(stackOffsetDiverging)\n\t\t\t: stack();\n\n\t\treturn stackToUse\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, configs?: any) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\t\tconst newConfig = Object.assign(\n\t\t\t{ skipUpdate: false, animate: true }, // default configs\n\t\t\tconfigs\n\t\t);\n\t\tif (!newConfig.skipUpdate) {\n\t\t\tthis.update(newConfig.animate);\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\tconst options = this.getOptions();\n\t\tTools.updateLegendAdditionalItems(options, newOptions);\n\n\t\tthis.set({\n\t\t\toptions: Tools.merge(options, 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(animate = true) {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setCustomColorScale();\n\t\tthis.setColorClassNames();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE, { animate });\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\t(group) => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\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\t(group) => 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// Updates selected groups\n\t\tconst updatedActiveItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\t\tconst options = this.getOptions();\n\n\t\tconst hasUpdatedDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\n\t\t// If there are deactivated items, map the item name into selected groups\n\t\tif (hasUpdatedDeactivatedItems) {\n\t\t\toptions.data.selectedGroups = updatedActiveItems.map(\n\t\t\t\t(activeItem) => activeItem.name\n\t\t\t);\n\t\t} else {\n\t\t\t// If every item is active, clear array\n\t\t\toptions.data.selectedGroups = [];\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 = Tools.getProperty(this.colorScale, group);\n\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 = Tools.getProperty(this.colorScale, group);\n\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\tisUserProvidedColorScaleValid() {\n\t\tconst userProvidedScale = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'scale'\n\t\t);\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tif (\n\t\t\tuserProvidedScale == null ||\n\t\t\tObject.keys(userProvidedScale).length == 0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn dataGroups.some((dataGroup) =>\n\t\t\tObject.keys(userProvidedScale).includes(dataGroup.name)\n\t\t);\n\t}\n\n\tgetColorClassName(configs: {\n\t\tclassNameTypes: ColorClassNameTypes[];\n\t\tdataGroupName?: string;\n\t\toriginalClassName?: string;\n\t}) {\n\t\tconst colorPairingTag = this.colorClassNames(configs.dataGroupName);\n\t\tlet className = configs.originalClassName;\n\t\tconfigs.classNameTypes.forEach(\n\t\t\t(type) =>\n\t\t\t\t(className = configs.originalClassName\n\t\t\t\t\t? `${className} ${type}-${colorPairingTag}`\n\t\t\t\t\t: `${type}-${colorPairingTag}`)\n\t\t);\n\n\t\treturn className;\n\t}\n\n\t/**\n\t * For charts that might hold an associated status for their dataset\n\t */\n\tgetStatus() {\n\t\treturn null;\n\t}\n\n\tgetAllDataGroupsNames() {\n\t\treturn this.allDataGroups;\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/docs-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\tgetTabularDataArray() {\n\t\treturn [];\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tthis.services.files.downloadCSV(csvString, 'myChart.csv');\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\tdata = this.getTabularData(data);\n\n\t\treturn 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, DISABLED } = Configuration.legend.items.status;\n\t\tconst options = this.getOptions();\n\n\t\tconst uniqueDataGroups = Tools.removeArrayDuplicates(\n\t\t\tdata.map((datum) => datum[groupMapsTo])\n\t\t);\n\n\t\t// check if selectedGroups can be applied to chart with current data groups\n\t\tif (options.data.selectedGroups.length) {\n\t\t\tconst hasAllSelectedGroups = options.data.selectedGroups.every(\n\t\t\t\t(groupName) => uniqueDataGroups.includes(groupName)\n\t\t\t);\n\t\t\tif (!hasAllSelectedGroups) {\n\t\t\t\toptions.data.selectedGroups = [];\n\t\t\t}\n\t\t}\n\n\t\t// Get group status based on items in selected groups\n\t\tconst getStatus = (groupName) =>\n\t\t\t!options.data.selectedGroups.length ||\n\t\t\toptions.data.selectedGroups.includes(groupName)\n\t\t\t\t? ACTIVE\n\t\t\t\t: DISABLED;\n\n\t\treturn uniqueDataGroups.map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tstatus: getStatus(groupName),\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setCustomColorScale() {\n\t\tif (!this.isUserProvidedColorScaleValid()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, 'color', 'scale');\n\n\t\tObject.keys(userProvidedScale).forEach((dataGroup) => {\n\t\t\tif (!this.allDataGroups.includes(dataGroup)) {\n\t\t\t\tconsole.warn(`\"${dataGroup}\" does not exist in data groups.`);\n\t\t\t}\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 */\n\t\tconst providedDataGroups = this.allDataGroups.filter(\n\t\t\t(dataGroup) => userProvidedScale[dataGroup]\n\t\t);\n\n\t\tprovidedDataGroups.forEach(\n\t\t\t(dataGroup) =>\n\t\t\t\t(this.colorScale[dataGroup] = userProvidedScale[dataGroup])\n\t\t);\n\t}\n\n\t/*\n\t * Color palette\n\t */\n\tprotected setColorClassNames() {\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\n\t\t// Check if user has defined numberOfVariants (differ from given data)\n\t\tlet numberOfVariants = Tools.getProperty(\n\t\t\tcolorPairingOptions,\n\t\t\t'numberOfVariants'\n\t\t);\n\t\tif (!numberOfVariants || numberOfVariants < this.allDataGroups.length) {\n\t\t\tnumberOfVariants = this.allDataGroups.length;\n\t\t}\n\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// If number of dataGroups is greater than 5, user 14-color palette\n\t\tconst numberOfColors = numberOfVariants > 5 ? 14 : numberOfVariants;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) =>\n\t\t\t\t`${numberOfColors}-${pairingOption}-${(index % 14) + 1}`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["model.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MAAM,eAAe,CAAC;AAExE,KAAK;AACL,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE;qEACqE;AACrE;IAoBC,oBAAY,QAAa;QAjBzB,uBAAuB;QACb,UAAK,GAAQ;YACtB,OAAO,EAAE,EAAE;SACX,CAAC;QASF,qCAAqC;QAC3B,eAAU,GAAQ,EAAE,CAAC;QAErB,oBAAe,GAAQ,EAAE,CAAC;QAGnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED,yCAAoB,GAApB,UAAqB,MAAO;QAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE;YACpB,OAAO,IAAI,CAAC;SACZ;QACD,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,0CAA0C;QAC1C,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,C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IAAI,kBAAkB,CAAI,cAAc,WAAQ,CAAC;gBAC7D,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,CAAC,CAAC;QAEN,yDAAyD;QACzD,IAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAC1C,UAAC,SAAS,EAAE,KAAK;YAChB,OAAG,cAAc,SAAI,aAAa,UAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAE;QAAxD,CAAwD,CACzD,CAAC;QAEF,kCAAkC;QAClC,IAAI,CAAC,eAAe,GAAG,YAAY,EAAE;aACnC,KAAK,CAAC,YAAY,CAAC;aACnB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,iBAAC;AAAD,CAAC,AAl3BD,IAk3BC","sourcesContent":["// Internal Imports\nimport * as Configuration from '../configuration';\nimport { histogram as histogramConfigs } from '../configuration-non-customizable';\n\nimport { Tools } from '../tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from '../interfaces';\n\n// D3\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack, stackOffsetDiverging } from 'd3-shape';\nimport { histogram } from 'd3-array';\nimport { formatDateTillMilliSeconds } from '../services/time-series';\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\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\tprotected colorClassNames: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetAllDataFromDomain(groups?) {\n\t\tif (!this.getData()) {\n\t\t\treturn null;\n\t\t}\n\t\tconst options = this.getOptions();\n\t\t// Remove datasets that have been disabled\n\t\tlet allData = this.getData();\n\t\tconst dataGroups = this.getDataGroups();\n\t\tconst { groupMapsTo } = Tools.getProperty(options, 'data');\n\t\tconst axesOptions = Tools.getProperty(options, 'axes');\n\n\t\t// filter out the groups that are irrelevant to the component\n\t\tif (groups) {\n\t\t\tallData = allData.filter((item) =>\n\t\t\t\tgroups.includes(item[groupMapsTo])\n\t\t\t);\n\t\t}\n\n\t\tif (axesOptions) {\n\t\t\tObject.keys(axesOptions).forEach((axis) => {\n\t\t\t\tconst mapsTo = axesOptions[axis].mapsTo;\n\t\t\t\tconst scaleType = axesOptions[axis].scaleType;\n\t\t\t\t// make sure linear/log values are numbers\n\t\t\t\tif (\n\t\t\t\t\tscaleType === ScaleTypes.LINEAR ||\n\t\t\t\t\tscaleType === ScaleTypes.LOG\n\t\t\t\t) {\n\t\t\t\t\tallData = allData.map((datum) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...datum,\n\t\t\t\t\t\t\t[mapsTo]:\n\t\t\t\t\t\t\t\tdatum[mapsTo] === null\n\t\t\t\t\t\t\t\t\t? datum[mapsTo]\n\t\t\t\t\t\t\t\t\t: Number(datum[mapsTo]),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Check for custom domain\n\t\t\t\tif (mapsTo && axesOptions[axis].domain) {\n\t\t\t\t\tif (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tallData = allData.filter((datum) =>\n\t\t\t\t\t\t\taxesOptions[axis].domain.includes(datum[mapsTo])\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [start, end] = axesOptions[axis].domain;\n\t\t\t\t\t\t// Filter out data outside domain if that datapoint is using that axis (has mapsTo property)\n\t\t\t\t\t\tallData = allData.filter(\n\t\t\t\t\t\t\t(datum) =>\n\t\t\t\t\t\t\t\t!(mapsTo in datum) ||\n\t\t\t\t\t\t\t\t(datum[mapsTo] >= start && datum[mapsTo] <= end)\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\treturn allData.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(group) => group.name === datum[groupMapsTo]\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart\n\t * @param groups the included datasets for the particular chart\n\t */\n\tgetDisplayData(groups?) {\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(groups);\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst allDataFromDomain = this.getAllDataFromDomain(groups);\n\n\t\treturn allDataFromDomain.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(dataGroup) =>\n\t\t\t\t\tdataGroup.name === datum[groupMapsTo] &&\n\t\t\t\t\tdataGroup.status === ACTIVE\n\t\t\t);\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(groups?) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'data',\n\t\t\t'loading'\n\t\t);\n\n\t\t// No data should be displayed while data is still loading\n\t\tif (isDataLoading) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// if its a combo chart, the specific chart will pass the model the groups it needs\n\t\tif (groups) {\n\t\t\treturn this.get('dataGroups').filter((dataGroup) =>\n\t\t\t\tgroups.includes(dataGroup.name)\n\t\t\t);\n\t\t}\n\t\treturn this.get('dataGroups');\n\t}\n\n\tgetActiveDataGroups(groups?) {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups(groups).filter(\n\t\t\t(dataGroup) => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames(groups?) {\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\treturn dataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames(groups?) {\n\t\tconst activeDataGroups = this.getActiveDataGroups(groups);\n\t\treturn activeDataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tprivate aggregateBinDataByGroup(bin) {\n\t\treturn Tools.groupBy(bin, 'group');\n\t}\n\n\tgetBinConfigurations() {\n\t\t// Manipulate data and options for Histogram\n\t\tconst data = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\n\t\tconst mainXPos = this.services.cartesianScales.getMainXAxisPosition();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\n\t\tconst axisOptions = options.axes[mainXPos];\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst { bins: axisBins = histogramConfigs.defaultBins } = axisOptions;\n\t\tconst areBinsDefined = Array.isArray(axisBins);\n\n\t\t// Get Histogram bins\n\t\tconst bins = histogram()\n\t\t\t.value((d) => d[domainIdentifier])\n\t\t\t.thresholds(axisBins)(data);\n\n\t\tif (!areBinsDefined) {\n\t\t\t// If bins are not defined by user\n\t\t\tconst binsWidth = bins[0].x1 - bins[0].x0;\n\t\t\t// Set last bin width as the others\n\t\t\tbins[bins.length - 1].x1 = +bins[bins.length - 1].x0 + binsWidth;\n\t\t} else {\n\t\t\t// Set last bin end as the last user defined one\n\t\t\tbins[bins.length - 1].x1 = axisBins[axisBins.length - 1];\n\t\t}\n\n\t\tconst binsDomain = areBinsDefined\n\t\t\t? [axisBins[0], axisBins[axisBins.length - 1]]\n\t\t\t: [bins[0].x0, bins[bins.length - 1].x1];\n\n\t\t// Get all groups\n\t\tconst groupsKeys = Array.from(new Set(data.map((d) => d[groupMapsTo])));\n\n\t\tconst histogramData = [];\n\n\t\t// Group data by bin\n\t\tbins.forEach((bin) => {\n\t\t\tconst key = `${bin.x0}-${bin.x1}`;\n\t\t\tconst aggregateDataByGroup = this.aggregateBinDataByGroup(bin);\n\n\t\t\tgroupsKeys.forEach((group: string) => {\n\t\t\t\t// For each dataset put a bin with value 0 if not exist\n\t\t\t\t// (Scale X won't change when changing showed datasets)\n\t\t\t\thistogramData.push({\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: aggregateDataByGroup[group] || 0,\n\t\t\t\t\tbin: bin.x0,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn {\n\t\t\tbins,\n\t\t\tbinsDomain,\n\t\t};\n\t}\n\n\tgetBinnedStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getActiveDataGroupNames();\n\n\t\tconst { bins } = this.getBinConfigurations();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tbins,\n\t\t});\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\tgetGroupedData(groups?) {\n\t\tconst displayData = this.getDisplayData(groups);\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\tgetStackKeys(\n\t\t{ bins = null, groups = null } = { bins: null, groups: null }\n\t) {\n\t\tconst options = this.getOptions();\n\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tlet stackKeys;\n\t\tif (bins) {\n\t\t\tstackKeys = bins.map((bin) => `${bin.x0}-${bin.x1}`);\n\t\t} else {\n\t\t\tstackKeys = Tools.removeArrayDuplicates(\n\t\t\t\tdisplayData.map((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\t// Use time value as key for Date object to avoid multiple data in the same second\n\t\t\t\t\tif (datum[domainIdentifier] instanceof Date) {\n\t\t\t\t\t\treturn formatDateTillMilliSeconds(\n\t\t\t\t\t\t\tdatum[domainIdentifier]\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn datum[domainIdentifier] &&\n\t\t\t\t\t\ttypeof datum[domainIdentifier].toString === 'function'\n\t\t\t\t\t\t? datum[domainIdentifier].toString()\n\t\t\t\t\t\t: datum[domainIdentifier];\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst axisPosition = this.services.cartesianScales.domainAxisPosition;\n\t\tconst scaleType = options.axes[axisPosition].scaleType;\n\n\t\t// Sort keys\n\t\tif (scaleType === ScaleTypes.TIME) {\n\t\t\tstackKeys.sort((a: any, b: any) => {\n\t\t\t\tconst dateA: any = new Date(a);\n\t\t\t\tconst dateB: any = new Date(b);\n\n\t\t\t\treturn dateA - dateB;\n\t\t\t});\n\t\t} else if (\n\t\t\tscaleType === ScaleTypes.LOG ||\n\t\t\tscaleType === ScaleTypes.LINEAR\n\t\t) {\n\t\t\tstackKeys.sort((a: any, b: any) => a - b);\n\t\t}\n\n\t\treturn stackKeys;\n\t}\n\n\tgetDataValuesGroupedByKeys({ bins = null, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\tconst stackKeys = this.getStackKeys({ bins, groups });\n\t\tif (bins) {\n\t\t\treturn stackKeys.map((key) => {\n\t\t\t\tconst [binStart, binEnd] = key.split('-');\n\n\t\t\t\tconst correspondingValues = { x0: binStart, x1: binEnd };\n\t\t\t\tconst correspondingBin = bins.find(\n\t\t\t\t\t(bin) => bin.x0.toString() === binStart.toString()\n\t\t\t\t);\n\n\t\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\t\tcorrespondingValues[\n\t\t\t\t\t\tdataGroupName\n\t\t\t\t\t] = correspondingBin.filter(\n\t\t\t\t\t\t(binItem) => binItem[groupMapsTo] === dataGroupName\n\t\t\t\t\t).length;\n\t\t\t\t});\n\n\t\t\t\treturn correspondingValues;\n\t\t\t}) as any;\n\t\t}\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\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum.hasOwnProperty(domainIdentifier) &&\n\t\t\t\t\t\t(datum[domainIdentifier] instanceof Date\n\t\t\t\t\t\t\t? formatDateTillMilliSeconds(\n\t\t\t\t\t\t\t\t\tdatum[domainIdentifier]\n\t\t\t\t\t\t\t ) === key\n\t\t\t\t\t\t\t: datum[domainIdentifier].toString() === key)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\tcorrespondingValues\n\t\t\t\t);\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\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null, divergent = false }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Get only active data groups so non-active data groups are not rendered\n\t\t// on legend item click\n\t\tconst dataGroupNames = this.getActiveDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tgroups,\n\t\t});\n\n\t\tif (percentage) {\n\t\t\tconst maxByKey = Tools.fromPairs(\n\t\t\t\tdataValuesGroupedByKeys.map((d: any) => [d.sharedStackKey, 0])\n\t\t\t);\n\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tmaxByKey[d.sharedStackKey] += d[name];\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// cycle through data values to get percentage\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tif (maxByKey[d.sharedStackKey]) {\n\t\t\t\t\t\td[name] = (d[name] / maxByKey[d.sharedStackKey]) * 100;\n\t\t\t\t\t} else {\n\t\t\t\t\t\td[name] = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst stackToUse = divergent\n\t\t\t? stack().offset(stackOffsetDiverging)\n\t\t\t: stack();\n\n\t\treturn stackToUse\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, configs?: any) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\t\tconst newConfig = Object.assign(\n\t\t\t{ skipUpdate: false, animate: true }, // default configs\n\t\t\tconfigs\n\t\t);\n\t\tif (!newConfig.skipUpdate) {\n\t\t\tthis.update(newConfig.animate);\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\tconst options = this.getOptions();\n\t\tTools.updateLegendAdditionalItems(options, newOptions);\n\n\t\tthis.set({\n\t\t\toptions: Tools.merge(options, 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(animate = true) {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setCustomColorScale();\n\t\tthis.setColorClassNames();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE, { animate });\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\t(group) => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\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\t(group) => 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// Updates selected groups\n\t\tconst updatedActiveItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\t\tconst options = this.getOptions();\n\n\t\tconst hasUpdatedDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\n\t\t// If there are deactivated items, map the item name into selected groups\n\t\tif (hasUpdatedDeactivatedItems) {\n\t\t\toptions.data.selectedGroups = updatedActiveItems.map(\n\t\t\t\t(activeItem) => activeItem.name\n\t\t\t);\n\t\t} else {\n\t\t\t// If every item is active, clear array\n\t\t\toptions.data.selectedGroups = [];\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 = Tools.getProperty(this.colorScale, group);\n\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 = Tools.getProperty(this.colorScale, group);\n\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\tisUserProvidedColorScaleValid() {\n\t\tconst userProvidedScale = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'scale'\n\t\t);\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tif (\n\t\t\tuserProvidedScale == null ||\n\t\t\tObject.keys(userProvidedScale).length == 0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn dataGroups.some((dataGroup) =>\n\t\t\tObject.keys(userProvidedScale).includes(dataGroup.name)\n\t\t);\n\t}\n\n\tgetColorClassName(configs: {\n\t\tclassNameTypes: ColorClassNameTypes[];\n\t\tdataGroupName?: string;\n\t\toriginalClassName?: string;\n\t}) {\n\t\tconst colorPairingTag = this.colorClassNames(configs.dataGroupName);\n\t\tlet className = configs.originalClassName;\n\t\tconfigs.classNameTypes.forEach(\n\t\t\t(type) =>\n\t\t\t\t(className = configs.originalClassName\n\t\t\t\t\t? `${className} ${type}-${colorPairingTag}`\n\t\t\t\t\t: `${type}-${colorPairingTag}`)\n\t\t);\n\n\t\treturn className;\n\t}\n\n\t/**\n\t * For charts that might hold an associated status for their dataset\n\t */\n\tgetStatus() {\n\t\treturn null;\n\t}\n\n\tgetAllDataGroupsNames() {\n\t\treturn this.allDataGroups;\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/docs-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\tgetTabularDataArray() {\n\t\treturn [];\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column === '&ndash;' ? '–' : column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tthis.services.files.downloadCSV(csvString, 'myChart.csv');\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\tdata = this.getTabularData(data);\n\n\t\treturn 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, DISABLED } = Configuration.legend.items.status;\n\t\tconst options = this.getOptions();\n\n\t\tconst uniqueDataGroups = Tools.removeArrayDuplicates(\n\t\t\tdata.map((datum) => datum[groupMapsTo])\n\t\t);\n\n\t\t// check if selectedGroups can be applied to chart with current data groups\n\t\tif (options.data.selectedGroups.length) {\n\t\t\tconst hasAllSelectedGroups = options.data.selectedGroups.every(\n\t\t\t\t(groupName) => uniqueDataGroups.includes(groupName)\n\t\t\t);\n\t\t\tif (!hasAllSelectedGroups) {\n\t\t\t\toptions.data.selectedGroups = [];\n\t\t\t}\n\t\t}\n\n\t\t// Get group status based on items in selected groups\n\t\tconst getStatus = (groupName) =>\n\t\t\t!options.data.selectedGroups.length ||\n\t\t\toptions.data.selectedGroups.includes(groupName)\n\t\t\t\t? ACTIVE\n\t\t\t\t: DISABLED;\n\n\t\treturn uniqueDataGroups.map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tstatus: getStatus(groupName),\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setCustomColorScale() {\n\t\tif (!this.isUserProvidedColorScaleValid()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, 'color', 'scale');\n\n\t\tObject.keys(userProvidedScale).forEach((dataGroup) => {\n\t\t\tif (!this.allDataGroups.includes(dataGroup)) {\n\t\t\t\tconsole.warn(`\"${dataGroup}\" does not exist in data groups.`);\n\t\t\t}\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 */\n\t\tconst providedDataGroups = this.allDataGroups.filter(\n\t\t\t(dataGroup) => userProvidedScale[dataGroup]\n\t\t);\n\n\t\tprovidedDataGroups.forEach(\n\t\t\t(dataGroup) =>\n\t\t\t\t(this.colorScale[dataGroup] = userProvidedScale[dataGroup])\n\t\t);\n\t}\n\n\t/*\n\t * Color palette\n\t */\n\tprotected setColorClassNames() {\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\n\t\t// Check if user has defined numberOfVariants (differ from given data)\n\t\tlet numberOfVariants = Tools.getProperty(\n\t\t\tcolorPairingOptions,\n\t\t\t'numberOfVariants'\n\t\t);\n\t\tif (!numberOfVariants || numberOfVariants < this.allDataGroups.length) {\n\t\t\tnumberOfVariants = this.allDataGroups.length;\n\t\t}\n\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// If number of dataGroups is greater than 5, user 14-color palette\n\t\tconst numberOfColors = numberOfVariants > 5 ? 14 : numberOfVariants;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) =>\n\t\t\t\t`${numberOfColors}-${pairingOption}-${(index % 14) + 1}`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\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": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "Carbon charting components",
5
5
  "main": "./bundle.js",
6
6
  "module": "./index.js",
@@ -178,7 +178,7 @@
178
178
  "signature": "3f506ad894cc38419ebd522ad1806e2e51e707385f0424b163c9e5358bfe0ffc"
179
179
  },
180
180
  "../src/model/model.ts": {
181
- "version": "fc75f4c705677188d8ef480f258f5700e525c159914df598eb2ad81cdaf3a08c",
181
+ "version": "ebf6c5e12d8ec9905a96090ed7fadda47f8f0841829d7043779a4c11714db0e0",
182
182
  "signature": "3e2b2f4b36025e8c93075b6076632ee74a9ef5ebd2969c3fec3d0d123030dfbb"
183
183
  },
184
184
  "../src/services/service.ts": {
@@ -250,8 +250,8 @@
250
250
  "signature": "e13ca1760c1d894f0cbb054be895f12207ff8a8708be12a18944832c02dd7ab2"
251
251
  },
252
252
  "../src/interfaces/components.ts": {
253
- "version": "b4112fc9b7a3097ddcf53dccbf035a241d750725da80b6f08cd6a8234ac98910",
254
- "signature": "841228db24352df234b121168742ee73b9657d195d84f99b336322a692f61905"
253
+ "version": "7e431130da795143b05b379ebee986b61770b113185e8169cdcc5809ddf0c681",
254
+ "signature": "9a889a1597b2156fa3a97068f0bde47023a1cb559a702685ed68f83ad38e8a8d"
255
255
  },
256
256
  "../../../node_modules/@types/d3-axis/index.d.ts": {
257
257
  "version": "b3393902df89f63a8da74a8003ee951164b2556608d256c248d6d79510becbb2",