@carbon/charts 0.41.53 → 0.41.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -3
- package/axis-chart.js +4 -3
- package/axis-chart.js.map +1 -1
- package/build/demo/data/bar.d.ts +18 -0
- package/build/demo/data/bubble.d.ts +6 -0
- package/build/demo/data/line.d.ts +19 -0
- package/build/src/components/essentials/legend.d.ts +4 -1
- package/build/src/configuration-non-customizable.d.ts +36 -1
- package/build/src/interfaces/charts.d.ts +7 -2
- package/build/src/interfaces/components.d.ts +12 -0
- package/build/src/interfaces/enums.d.ts +11 -0
- package/build/src/tools.d.ts +7 -0
- package/bundle.js +1 -1
- package/charts/wordcloud.js.map +1 -1
- package/components/axes/grid.js.map +1 -1
- package/components/axes/zoom-bar.js +3 -2
- package/components/axes/zoom-bar.js.map +1 -1
- package/components/essentials/legend.d.ts +4 -1
- package/components/essentials/legend.js +263 -81
- package/components/essentials/legend.js.map +1 -1
- package/components/essentials/tooltip-axis.js +17 -9
- package/components/essentials/tooltip-axis.js.map +1 -1
- package/components/graphs/boxplot.js.map +1 -1
- package/components/graphs/scatter.js +8 -1
- package/components/graphs/scatter.js.map +1 -1
- package/components/graphs/wordcloud.js +4 -4
- package/components/graphs/wordcloud.js.map +1 -1
- package/components/index.js.map +1 -1
- package/components/layout/layout.js +0 -8
- package/components/layout/layout.js.map +1 -1
- package/configuration-non-customizable.d.ts +36 -1
- package/configuration-non-customizable.js +32 -1
- package/configuration-non-customizable.js.map +1 -1
- package/configuration.js +13 -3
- package/configuration.js.map +1 -1
- package/demo/data/area.js +1 -1
- package/demo/data/area.js.map +1 -1
- package/demo/data/bar.d.ts +18 -0
- package/demo/data/bar.js +36 -0
- package/demo/data/bar.js.map +1 -1
- package/demo/data/bubble.d.ts +6 -0
- package/demo/data/bubble.js +8 -0
- package/demo/data/bubble.js.map +1 -1
- package/demo/data/bundle.js +1 -1
- package/demo/data/index.js +10 -0
- package/demo/data/index.js.map +1 -1
- package/demo/data/line.d.ts +19 -0
- package/demo/data/line.js +21 -2
- package/demo/data/line.js.map +1 -1
- package/demo/styles.css +0 -3
- package/demo/styles.css.map +1 -1
- package/demo/styles.min.css +1 -1
- package/demo/styles.min.css.map +1 -1
- package/demo/tsconfig.tsbuildinfo +8 -8
- package/interfaces/charts.d.ts +7 -2
- package/interfaces/charts.js.map +1 -1
- package/interfaces/components.d.ts +12 -0
- package/interfaces/components.js.map +1 -1
- package/interfaces/enums.d.ts +11 -0
- package/interfaces/enums.js +12 -0
- package/interfaces/enums.js.map +1 -1
- package/interfaces/events.js.map +1 -1
- package/model-boxplot.js +1 -3
- package/model-boxplot.js.map +1 -1
- package/model.js +3 -1
- package/model.js.map +1 -1
- package/package.json +1 -1
- package/services/essentials/gradient-utils.js +1 -1
- package/services/essentials/gradient-utils.js.map +1 -1
- package/styles/_type.scss +2 -2
- package/tools.d.ts +7 -0
- package/tools.js +25 -2
- package/tools.js.map +1 -1
- package/tsconfig.tsbuildinfo +27 -27
package/interfaces/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,KAOX;AAPD,WAAY,KAAK;IAChB,4CAAmC,CAAA;IACnC,gCAAuB,CAAA;IACvB,sCAA6B,CAAA;IAC7B,iCAAiC;IACjC,yBAAyB;IACzB,oCAA2B,CAAA;AAC5B,CAAC,EAPW,KAAK,KAAL,KAAK,QAOhB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,KAEX;AAFD,WAAY,KAAK;IAChB,gCAAuB,CAAA;AACxB,CAAC,EAFW,KAAK,KAAL,KAAK,QAEhB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IAClB,4DAAiD,CAAA;IACjD,4DAAiD,CAAA;AAClD,CAAC,EAHW,OAAO,KAAP,OAAO,QA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CAAqB,CAAA;IACrB,gCAAqB,CAAA;IACrB,gCAAqB,CAAA;AACtB,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;AACxB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,MAKX;AALD,WAAY,MAAM;IACjB,4CAAkC,CAAA;IAClC,4CAAkC,CAAA;IAClC,kDAAwC,CAAA;IACxC,8CAAoC,CAAA;AACrC,CAAC,EALW,MAAM,KAAN,MAAM,QAKjB","sourcesContent":["/**\n * enum of all events related to the chart on the DOM\n */\nexport enum Chart {\n\tRENDER_FINISHED = 'render-finished',\n\tRESIZE = 'chart-resize',\n\tMOUSEOVER = 'chart-mouseover',\n\t// MOUSEMOVE = \"chart-mousemove\",\n\t// CLICK = \"chart-click\",\n\tMOUSEOUT = 'chart-mouseout',\n}\n\n/**\n * enum of all events related to the chart model\n */\nexport enum Model {\n\tUPDATE = 'model-update',\n}\n\n/**\n * enum of all toolbar events\n */\nexport enum Toolbar {\n\tSHOW_OVERFLOW_MENU = 'show-toolbar-overflow-menu',\n\tHIDE_OVERFLOW_MENU = 'hide-toolbar-overflow-menu',\n}\n\n/**\n * enum of all events related to the zoom-bar\n */\nexport enum ZoomBar {\n\tUPDATE = 'zoom-bar-update',\n\tSELECTION_START = 'zoom-bar-selection-start',\n\tSELECTION_IN_PROGRESS = 'zoom-bar-selection-in-progress',\n\tSELECTION_END = 'zoom-bar-selection-end',\n}\n\n/**\n * enum of all events related to the zoom domain\n */\nexport enum ZoomDomain {\n\tCHANGE = 'zoom-domain-change',\n}\n\n/**\n * enum of all axis-related events\n */\nexport enum Axis {\n\tLABEL_MOUSEOVER = 'axis-label-mouseover',\n\tLABEL_MOUSEMOVE = 'axis-label-mousemove',\n\tLABEL_CLICK = 'axis-label-click',\n\tLABEL_MOUSEOUT = 'axis-label-mouseout',\n}\n\n/**\n * enum of all area graph events\n */\nexport enum Area {\n\tAREA_MOUSEOVER = 'area-mouseover',\n\tAREA_MOUSEMOVE = 'area-mousemove',\n\tAREA_CLICK = 'area-click',\n\tAREA_MOUSEOUT = 'area-mouseout',\n}\n\n/**\n * enum of all wordcloud graph events\n */\nexport enum WordCloud {\n\tWORD_MOUSEOVER = 'wordcloud-word-mouseover',\n\tWORD_MOUSEMOVE = 'wordcloud-word-mousemove',\n\tWORD_CLICK = 'wordcloud-word-click',\n\tWORD_MOUSEOUT = 'wordcloud-word-mouseout',\n}\n\n/**\n * enum of all pie graph events\n */\nexport enum Pie {\n\tSLICE_MOUSEOVER = 'pie-slice-mouseover',\n\tSLICE_MOUSEMOVE = 'pie-slice-mousemove',\n\tSLICE_CLICK = 'pie-slice-click',\n\tSLICE_MOUSEOUT = 'pie-slice-mouseout',\n}\n\n/**\n * enum of all gauge graph events\n */\nexport enum Gauge {\n\tARC_MOUSEOVER = 'gauge-arc-mouseover',\n\tARC_MOUSEMOVE = 'gauge-arc-mousemove',\n\tARC_CLICK = 'gauge-arc-click',\n\tARC_MOUSEOUT = 'gauge-arc-mouseout',\n}\n\n/**\n * enum of all bar graph events\n */\nexport enum Bar {\n\tBAR_MOUSEOVER = 'bar-mouseover',\n\tBAR_MOUSEMOVE = 'bar-mousemove',\n\tBAR_CLICK = 'bar-click',\n\tBAR_MOUSEOUT = 'bar-mouseout',\n}\n\n/**\n * enum of all boxplot graph events\n */\nexport enum Boxplot {\n\tBOX_MOUSEOVER = 'box-mouseover',\n\tBOX_MOUSEMOVE = 'box-mousemove',\n\tBOX_CLICK = 'box-click',\n\tBOX_MOUSEOUT = 'box-mouseout',\n\tOUTLIER_MOUSEOVER = 'outlier-mouseover',\n\tOUTLIER_MOUSEMOVE = 'outlier-mousemove',\n\tOUTLIER_CLICK = 'outlier-click',\n\tOUTLIER_MOUSEOUT = 'outlier-mouseout',\n}\n\n/**\n * enum of all scatter graph events\n */\nexport enum Scatter {\n\tSCATTER_MOUSEOVER = 'scatter-mouseover',\n\tSCATTER_MOUSEMOVE = 'scatter-mousemove',\n\tSCATTER_CLICK = 'scatter-click',\n\tSCATTER_MOUSEOUT = 'scatter-mouseout',\n}\n\n/**\n * enum of all line graph events\n */\nexport enum Line {\n\tPOINT_MOUSEOVER = 'scatter-mouseover',\n\tPOINT_MOUSEMOVE = 'scatter-mousemove',\n\tPOINT_CLICK = 'scatter-click',\n\tPOINT_MOUSEOUT = 'scatter-mouseout',\n}\n\n/**\n * enum of all radar graph events\n */\nexport enum Radar {\n\tX_AXIS_MOUSEOVER = 'radar-x-axis-mouseover',\n\tX_AXIS_MOUSEMOVE = 'radar-x-axis-mousemove',\n\tX_AXIS_CLICK = 'radar-x-axis-click',\n\tX_AXIS_MOUSEOUT = 'radar-x-axis-mouseout',\n}\n\n/**\n * enum of all treemap graph events\n */\nexport enum Treemap {\n\tLEAF_MOUSEOVER = 'leaf-mouseover',\n\tLEAF_MOUSEMOVE = 'leaf-mousemove',\n\tLEAF_CLICK = 'leaf-click',\n\tLEAF_MOUSEOUT = 'leaf-mouseout',\n}\n\n/**\n * enum of all tooltip events\n */\nexport enum Tooltip {\n\tSHOW = 'show-tooltip',\n\tMOVE = 'move-tooltip',\n\tHIDE = 'hide-tooltip',\n}\n\n/**\n * enum of all threshold events\n */\nexport enum Threshold {\n\tSHOW = 'show-threshold',\n\tHIDE = 'hide-threshold',\n}\n\n/**\n * enum of all legend related events\n */\nexport enum Legend {\n\tITEM_HOVER = 'legend-item-onhover',\n\tITEM_CLICK = 'legend-item-onclick',\n\tITEM_MOUSEOUT = 'legend-item-onmouseout',\n\tITEMS_UPDATE = 'legend-items-update',\n}\n"]}
|
package/model-boxplot.js
CHANGED
|
@@ -108,9 +108,7 @@ var BoxplotChartModel = /** @class */ (function (_super) {
|
|
|
108
108
|
? pairingOption
|
|
109
109
|
: 1;
|
|
110
110
|
// Create color classes for graph, tooltip and stroke use
|
|
111
|
-
var colorPairing = this.allDataGroups.map(function (dataGroup, index) {
|
|
112
|
-
return numberOfColors + "-" + pairingOption + "-1";
|
|
113
|
-
});
|
|
111
|
+
var colorPairing = this.allDataGroups.map(function (dataGroup, index) { return numberOfColors + "-" + pairingOption + "-1"; });
|
|
114
112
|
// Create default color classnames
|
|
115
113
|
this.colorClassNames = scaleOrdinal()
|
|
116
114
|
.range(colorPairing)
|
package/model-boxplot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-boxplot.js","sourceRoot":"","sources":["model-boxplot.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;qEACqE;AACrE;IAAuC,qCAAmB;IACzD,2BAAY,QAAa;eACxB,kBAAM,QAAQ,CAAC;IAChB,CAAC;IAED,2CAAe,GAAf,UAAgB,CAAC;QAChB,OAAO;YACN,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC;YACvB,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;YACtB,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC;SACvB,CAAC;IACH,CAAC;IAED,0CAAc,GAAd;QACC,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC1B,IAAA,sCAAW,CAAkB;QAErC,IAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAE1C,qCAAqC;QACrC,IAAM,WAAW,GAAG,EAAE,CAAC;gCACJ,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B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,wBAAC;AAAD,CAAC,AA5GD,CAAuC,mBAAmB,GA4GzD","sourcesContent":["// Internal Imports\nimport { ChartModelCartesian } from './model-cartesian-charts';\nimport * as Configuration from './configuration';\nimport { Tools } from './tools';\n\n// D3 Imports\nimport { ascending, min, max, quantile } from 'd3-array';\nimport { scaleOrdinal } from 'd3-scale';\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 BoxplotChartModel extends ChartModelCartesian {\n\tconstructor(services: any) {\n\t\tsuper(services);\n\t}\n\n\tgetBoxQuartiles(d) {\n\t\treturn {\n\t\t\tq_25: quantile(d, 0.25),\n\t\t\tq_50: quantile(d, 0.5),\n\t\t\tq_75: quantile(d, 0.75),\n\t\t};\n\t}\n\n\tgetBoxplotData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst groupedData = this.getGroupedData();\n\n\t\t// Prepare the data for the box plots\n\t\tconst boxplotData = [];\n\t\tfor (const { name: group, data } of groupedData) {\n\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();\n\t\t\tconst values = data.map((d) => d[rangeIdentifier]).sort(ascending);\n\n\t\t\tconst record = {\n\t\t\t\t[groupMapsTo]: group,\n\t\t\t\tcounts: values,\n\t\t\t\tquartiles: this.getBoxQuartiles(values),\n\t\t\t\toutliers: null,\n\t\t\t\twhiskers: null,\n\t\t\t};\n\n\t\t\tconst q1 = record.quartiles.q_25;\n\t\t\tconst q3 = record.quartiles.q_75;\n\n\t\t\tconst iqr = (q3 - q1) * 1.5;\n\t\t\tconst irq1 = q1 - iqr;\n\t\t\tconst irq3 = q3 + iqr;\n\n\t\t\tconst outliers = [];\n\t\t\tconst normalValues = [];\n\n\t\t\tfor (const value of values) {\n\t\t\t\tif (value < irq1) {\n\t\t\t\t\toutliers.push(value);\n\t\t\t\t} else if (value > irq3) {\n\t\t\t\t\toutliers.push(value);\n\t\t\t\t} else {\n\t\t\t\t\tnormalValues.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trecord.outliers = outliers;\n\n\t\t\tconst minNormalValue = min(normalValues);\n\t\t\tconst maxNormalValue = max(normalValues);\n\t\t\trecord.whiskers = {\n\t\t\t\tmin: minNormalValue\n\t\t\t\t\t? minNormalValue\n\t\t\t\t\t: min([\n\t\t\t\t\t\t\trecord.quartiles.q_25,\n\t\t\t\t\t\t\trecord.quartiles.q_50,\n\t\t\t\t\t\t\trecord.quartiles.q_75,\n\t\t\t\t\t ]),\n\t\t\t\tmax: maxNormalValue\n\t\t\t\t\t? maxNormalValue\n\t\t\t\t\t: max([\n\t\t\t\t\t\t\trecord.quartiles.q_25,\n\t\t\t\t\t\t\trecord.quartiles.q_50,\n\t\t\t\t\t\t\trecord.quartiles.q_75,\n\t\t\t\t\t ]),\n\t\t\t};\n\n\t\t\tboxplotData.push(record);\n\t\t}\n\n\t\treturn boxplotData;\n\t}\n\n\tprotected setColorClassNames() {\n\t\t// monochrome\n\t\tconst numberOfColors = 1;\n\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\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\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) => `${numberOfColors}-${pairingOption}-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/model.js
CHANGED
|
@@ -268,8 +268,10 @@ var ChartModel = /** @class */ (function () {
|
|
|
268
268
|
* @param newOptions New options to be set
|
|
269
269
|
*/
|
|
270
270
|
ChartModel.prototype.setOptions = function (newOptions) {
|
|
271
|
+
var options = this.getOptions();
|
|
272
|
+
Tools.updateLegendAdditionalItems(options, newOptions);
|
|
271
273
|
this.set({
|
|
272
|
-
options: Tools.merge(
|
|
274
|
+
options: Tools.merge(options, newOptions),
|
|
273
275
|
});
|
|
274
276
|
};
|
|
275
277
|
/**
|
package/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["model.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAC;AAEvE,KAAK;AACL,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;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;QA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AgB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAEpE,qDAAqD;QACrD,aAAa;YACZ,aAAa,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,AAjsBD,IAisBC","sourcesContent":["// Internal Imports\nimport * as Configuration from './configuration';\nimport { Tools } from './tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from './interfaces';\n\n// D3\nimport { map } from 'd3-collection';\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack } from 'd3-shape';\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\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) => groups.includes(item.group));\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\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\tgetDataValuesGroupedByKeys(groups?) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst stackKeys = map(displayData, (datum) => {\n\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\tdatum\n\t\t\t);\n\n\t\t\treturn datum[domainIdentifier];\n\t\t}).keys();\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\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\treturn stackKeys.map((key) => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\tconst correspondingDatum = displayData.find((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum[domainIdentifier].toString() === key\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\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\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys(groups);\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\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, 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\tthis.set({\n\t\t\toptions: Tools.merge(this.getOptions(), newOptions),\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate(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\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 = map(\n\t\t\tdata,\n\t\t\t(datum) => datum[groupMapsTo]\n\t\t).keys();\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,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAC;AAEvE,KAAK;AACL,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;qEACqE;AACrE;IAoBC,oBAAY,QAAa;QAjBzB,uBAAuB;QACb,UAAK,GAAQ;YACtB,OAAO,EAAE,EAAE;SACX,CAAC;QASF,qCAAqC;QAC3B,eAAU,G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AS,CACT,CAAC;QAEF,sEAAsE;QACtE,IAAI,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACvC,mBAAmB,EACnB,kBAAkB,CAClB,CAAC;QACF,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACtE,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;SAC7C;QAED,IAAI,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAM,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC,cAAc,CAAC;QAE9D,mEAAmE;QACnE,IAAM,cAAc,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAEpE,qDAAqD;QACrD,aAAa;YACZ,aAAa,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,AApsBD,IAosBC","sourcesContent":["// Internal Imports\nimport * as Configuration from './configuration';\nimport { Tools } from './tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from './interfaces';\n\n// D3\nimport { map } from 'd3-collection';\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack } from 'd3-shape';\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\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) => groups.includes(item.group));\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\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\tgetDataValuesGroupedByKeys(groups?) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst stackKeys = map(displayData, (datum) => {\n\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\tdatum\n\t\t\t);\n\n\t\t\treturn datum[domainIdentifier];\n\t\t}).keys();\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\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\treturn stackKeys.map((key) => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\tconst correspondingDatum = displayData.find((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum[domainIdentifier].toString() === key\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\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\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys(groups);\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\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, 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\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 = map(\n\t\t\tdata,\n\t\t\t(datum) => datum[groupMapsTo]\n\t\t).keys();\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 +1 @@
|
|
|
1
|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3C,CAAC;IAEM,4BAAc,GAArB,UAAsB,MAAM;QAC3B,IAAM,WAAW,GAChB,CACC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACpB,OAAO,WAAW,CAAC;IACpB,CAAC;IAEM,sBAAQ,GAAf,UAAgB,MAAM,EAAE,KAAK;QAC5B,IAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,KAAK,GAAa;YACrB;gBACC,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,KAAK;aACd;YACD;gBACC,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,GAAG;aACZ;SACD,CAAC;QAEF,IAAI,UAAU,EAAE;YACf,KAAK,GAAG;gBACP;oBACC,MAAM,EAAE,IAAI;oBACZ,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,KAAK;iBACd;gBACD;oBACC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC;oBAC5C,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,GAAG;iBACZ;gBACD;oBACC,MAAM,EAAE,MAAM;oBACd,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,KAAK;iBACd;aACD,CAAC;SACF;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,oBAAC;AAAD,CAAC,AArED,CAAmC,OAAO,GAqEzC","sourcesContent":["// Internal Imports\nimport { Service } from '../service';\nimport { DOMUtils } from '../';\n\nexport class GradientUtils extends Service {\n\tstatic appendOrUpdateLinearGradient(configs) {\n\t\tlet lg = configs.svg.select(`defs linearGradient#${configs.id}`);\n\t\tif (lg.empty()) {\n\t\t\tlg = configs.svg\n\t\t\t\t.append('defs')\n\t\t\t\t.append('linearGradient')\n\t\t\t\t.attr('id', configs.id)\n\t\t\t\t.attr('x1', configs.x1)\n\t\t\t\t.attr('x2', configs.x2)\n\t\t\t\t.attr('y1', configs.y1)\n\t\t\t\t.attr('y2', configs.y2);\n\t\t}\n\n\t\tlg.selectAll('stop').remove();\n\t\tlg.selectAll(
|
|
1
|
+
{"version":3,"file":"gradient-utils.js","sourceRoot":"","sources":["gradient-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC;IAAmC,iCAAO;IAA1C;;IAqEA,CAAC;IApEO,0CAA4B,GAAnC,UAAoC,OAAO;QAC1C,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,yBAAuB,OAAO,CAAC,EAAI,CAAC,CAAC;QACjE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACf,EAAE,GAAG,OAAO,CAAC,GAAG;iBACd,MAAM,CAAC,MAAM,CAAC;iBACd,MAAM,CAAC,gBAAgB,CAAC;iBACxB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;iBACtB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;iBACtB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;iBACtB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;iBACtB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;SACzB;QAED,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QAC9B,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;aAClB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;aACnB,KAA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,OAAO,EAAE,GAAG;iBACZ;gBACD;oBACC,MAAM,EAAE,MAAM;oBACd,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,KAAK;iBACd;aACD,CAAC;SACF;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,oBAAC;AAAD,CAAC,AArED,CAAmC,OAAO,GAqEzC","sourcesContent":["// Internal Imports\nimport { Service } from '../service';\nimport { DOMUtils } from '../';\n\nexport class GradientUtils extends Service {\n\tstatic appendOrUpdateLinearGradient(configs) {\n\t\tlet lg = configs.svg.select(`defs linearGradient#${configs.id}`);\n\t\tif (lg.empty()) {\n\t\t\tlg = configs.svg\n\t\t\t\t.append('defs')\n\t\t\t\t.append('linearGradient')\n\t\t\t\t.attr('id', configs.id)\n\t\t\t\t.attr('x1', configs.x1)\n\t\t\t\t.attr('x2', configs.x2)\n\t\t\t\t.attr('y1', configs.y1)\n\t\t\t\t.attr('y2', configs.y2);\n\t\t}\n\n\t\tlg.selectAll('stop').remove();\n\t\tlg.selectAll('stop')\n\t\t\t.data(configs.stops)\n\t\t\t.enter()\n\t\t\t.append('stop')\n\t\t\t.attr('offset', (d) => d.offset)\n\t\t\t.style('stop-color', (d) => d.color)\n\t\t\t.style('stop-opacity', (d) => d.opacity);\n\t}\n\n\tstatic getOffsetRatio(domain) {\n\t\tconst offsetRatio =\n\t\t\t(\n\t\t\t\t(Math.abs(domain[1]) * 100) /\n\t\t\t\tMath.abs(domain[0] - domain[1])\n\t\t\t).toFixed(2) + '%';\n\t\treturn offsetRatio;\n\t}\n\n\tstatic getStops(domain, color) {\n\t\tconst need3Stops = domain[0] < 0 && domain[1] > 0;\n\t\tlet stops: object[] = [\n\t\t\t{\n\t\t\t\toffset: '0%',\n\t\t\t\tcolor: color,\n\t\t\t\topacity: '0.6',\n\t\t\t},\n\t\t\t{\n\t\t\t\toffset: '80%',\n\t\t\t\tcolor: color,\n\t\t\t\topacity: '0',\n\t\t\t},\n\t\t];\n\n\t\tif (need3Stops) {\n\t\t\tstops = [\n\t\t\t\t{\n\t\t\t\t\toffset: '0%',\n\t\t\t\t\tcolor: color,\n\t\t\t\t\topacity: '0.6',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toffset: GradientUtils.getOffsetRatio(domain),\n\t\t\t\t\tcolor: color,\n\t\t\t\t\topacity: '0',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toffset: '100%',\n\t\t\t\t\tcolor: color,\n\t\t\t\t\topacity: '0.6',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\treturn stops;\n\t}\n}\n"]}
|
package/styles/_type.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import './vendor/@carbon/type/scss/type';
|
|
2
|
-
@import
|
|
3
|
-
@import
|
|
2
|
+
@import './vendor/@carbon/type/scss/font-face/sans';
|
|
3
|
+
@import './vendor/@carbon/type/scss/font-face/sans-condensed';
|
|
4
4
|
@include carbon--font-face-sans();
|
|
5
5
|
@include carbon--font-face-sans-condensed();
|
|
6
6
|
|
package/tools.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare namespace Tools {
|
|
|
4
4
|
export const debounce: any;
|
|
5
5
|
export const clone: any;
|
|
6
6
|
export const merge: any;
|
|
7
|
+
export const unionBy: any;
|
|
7
8
|
export const removeArrayDuplicates: any;
|
|
8
9
|
export const clamp: any;
|
|
9
10
|
export const flatten: any;
|
|
@@ -95,6 +96,12 @@ export declare namespace Tools {
|
|
|
95
96
|
* @returns Truncated text
|
|
96
97
|
*/
|
|
97
98
|
export function truncateLabel(fullText: any, truncationType: any, numCharacter: any): any;
|
|
99
|
+
/**
|
|
100
|
+
* Update legend additional items
|
|
101
|
+
* @param {any} defaultOptions
|
|
102
|
+
* @param {any} providedOptions
|
|
103
|
+
*/
|
|
104
|
+
export function updateLegendAdditionalItems(defaultOptions: any, providedOptions: any): void;
|
|
98
105
|
/**************************************
|
|
99
106
|
* Object/array related checks *
|
|
100
107
|
*************************************/
|
package/tools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Internal imports
|
|
2
|
-
import { CartesianOrientations, ScaleTypes, TruncationTypes, } from './interfaces';
|
|
3
|
-
import { debounce as lodashDebounce, merge as lodashMerge, cloneDeep as lodashCloneDeep, uniq as lodashUnique, clamp as lodashClamp, flatten as lodashFlatten, camelCase as lodashCamelCase, isEmpty as lodashIsEmpty, isEqual as lodashIsEqual, flatMapDeep as lodashFlatMapDeep, kebabCase as lodashKebabCase, fromPairs as lodashFromPairs, some as lodashSome, } from 'lodash-es';
|
|
2
|
+
import { CartesianOrientations, ScaleTypes, TruncationTypes, LegendItemType, } from './interfaces';
|
|
3
|
+
import { debounce as lodashDebounce, merge as lodashMerge, cloneDeep as lodashCloneDeep, unionBy as lodashUnionBy, uniq as lodashUnique, clamp as lodashClamp, flatten as lodashFlatten, camelCase as lodashCamelCase, isEmpty as lodashIsEmpty, isEqual as lodashIsEqual, flatMapDeep as lodashFlatMapDeep, kebabCase as lodashKebabCase, fromPairs as lodashFromPairs, some as lodashSome, } from 'lodash-es';
|
|
4
4
|
import { mouse } from 'd3-selection';
|
|
5
5
|
// Functions
|
|
6
6
|
export var Tools;
|
|
@@ -9,6 +9,7 @@ export var Tools;
|
|
|
9
9
|
Tools.debounce = lodashDebounce;
|
|
10
10
|
Tools.clone = lodashCloneDeep;
|
|
11
11
|
Tools.merge = lodashMerge;
|
|
12
|
+
Tools.unionBy = lodashUnionBy;
|
|
12
13
|
Tools.removeArrayDuplicates = lodashUnique;
|
|
13
14
|
Tools.clamp = lodashClamp;
|
|
14
15
|
Tools.flatten = lodashFlatten;
|
|
@@ -77,6 +78,7 @@ export var Tools;
|
|
|
77
78
|
delete defaultOptions.axes[axisName];
|
|
78
79
|
}
|
|
79
80
|
}
|
|
81
|
+
updateLegendAdditionalItems(defaultOptions, providedOptions);
|
|
80
82
|
return Tools.merge(defaultOptions, providedOptions);
|
|
81
83
|
}
|
|
82
84
|
Tools.mergeDefaultChartOptions = mergeDefaultChartOptions;
|
|
@@ -216,6 +218,27 @@ export var Tools;
|
|
|
216
218
|
}
|
|
217
219
|
}
|
|
218
220
|
Tools.truncateLabel = truncateLabel;
|
|
221
|
+
/**
|
|
222
|
+
* Update legend additional items
|
|
223
|
+
* @param {any} defaultOptions
|
|
224
|
+
* @param {any} providedOptions
|
|
225
|
+
*/
|
|
226
|
+
function updateLegendAdditionalItems(defaultOptions, providedOptions) {
|
|
227
|
+
var defaultAdditionalItems = Tools.getProperty(defaultOptions, 'legend', 'additionalItems');
|
|
228
|
+
var userProvidedAdditionalItems = Tools.getProperty(providedOptions, 'legend', 'additionalItems');
|
|
229
|
+
// Retain default legend additional items
|
|
230
|
+
if (defaultAdditionalItems && userProvidedAdditionalItems) {
|
|
231
|
+
var providedTypes_1 = userProvidedAdditionalItems.map(function (item) { return item.type; });
|
|
232
|
+
// Remove same type default items if they are provided
|
|
233
|
+
defaultAdditionalItems = defaultAdditionalItems.filter(function (item) {
|
|
234
|
+
return !providedTypes_1.includes(item.type) &&
|
|
235
|
+
item.type === LegendItemType.RADIUS;
|
|
236
|
+
});
|
|
237
|
+
providedOptions.legend.additionalItems = Tools.unionBy(defaultAdditionalItems, userProvidedAdditionalItems, 'name');
|
|
238
|
+
defaultOptions.legend.additionalItems = [];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
Tools.updateLegendAdditionalItems = updateLegendAdditionalItems;
|
|
219
242
|
/**************************************
|
|
220
243
|
* Object/array related checks *
|
|
221
244
|
*************************************/
|
package/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["tools.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAEN,qBAAqB,EACrB,UAAU,EACV,eAAe,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,SAAS,IAAI,eAAe,EAC5B,IAAI,IAA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;IACpB,CAAC;IARe,0CAAoC,uCAQnD,CAAA;IAEY,oBAAc,GAAG,UAAC,CAAU,EAAE,CAAU;QACpD,OAAA,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;IAAvB,CAAuB,CAAC;AAC1B,CAAC,EAtYgB,KAAK,KAAL,KAAK,QAsYrB","sourcesContent":["// Internal imports\nimport {\n\tAxisChartOptions,\n\tCartesianOrientations,\n\tScaleTypes,\n\tTruncationTypes,\n} from './interfaces';\n\nimport {\n\tdebounce as lodashDebounce,\n\tmerge as lodashMerge,\n\tcloneDeep as lodashCloneDeep,\n\tuniq as lodashUnique,\n\tclamp as lodashClamp,\n\tflatten as lodashFlatten,\n\tcamelCase as lodashCamelCase,\n\tisEmpty as lodashIsEmpty,\n\tisEqual as lodashIsEqual,\n\tflatMapDeep as lodashFlatMapDeep,\n\tkebabCase as lodashKebabCase,\n\tfromPairs as lodashFromPairs,\n\tsome as lodashSome,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tCancelable,\n\tDebounceSettings,\n} from 'lodash-es';\n\nimport { mouse } from 'd3-selection';\nimport { Numeric } from 'd3';\n\n// Functions\nexport namespace Tools {\n\t// Export these functions from lodash\n\texport const debounce = lodashDebounce;\n\texport const clone = lodashCloneDeep;\n\texport const merge = lodashMerge;\n\texport const removeArrayDuplicates = lodashUnique;\n\texport const clamp = lodashClamp;\n\texport const flatten = lodashFlatten;\n\texport const camelCase = lodashCamelCase;\n\texport const isEmpty = lodashIsEmpty;\n\texport const isEqual = lodashIsEqual;\n\texport const flatMapDeep = lodashFlatMapDeep;\n\texport const kebabCase = lodashKebabCase;\n\texport const fromPairs = lodashFromPairs;\n\texport const some = lodashSome;\n\n\texport function debounceWithD3MousePosition(fn, delay, element) {\n\t\tvar timer = null;\n\t\treturn function () {\n\t\t\tconst context = this;\n\t\t\tconst args = arguments;\n\n\t\t\t//we get the D3 event here\n\t\t\tcontext.mousePosition = mouse(element);\n\n\t\t\tclearTimeout(timer);\n\n\t\t\ttimer = setTimeout(function () {\n\t\t\t\t// and use the reference here\n\t\t\t\tfn.apply(context, args);\n\t\t\t}, delay);\n\t\t};\n\t}\n\n\t/**\n\t * Returns default chart options merged with provided options,\n\t * with special cases for axes.\n\t * Axes object will not merge the not provided axes.\n\t *\n\t * @export\n\t * @param {AxisChartOptions} defaultOptions Configuration.options[chartType]\n\t * @param {AxisChartOptions} providedOptions user provided options\n\t * @returns merged options\n\t */\n\texport function mergeDefaultChartOptions(\n\t\tdefaultOptions: any,\n\t\tprovidedOptions: any\n\t) {\n\t\tdefaultOptions = Tools.clone(defaultOptions);\n\t\tconst providedAxesNames = Object.keys(providedOptions.axes || {});\n\n\t\tif (providedAxesNames.length === 0) {\n\t\t\tdelete defaultOptions.axes;\n\t\t}\n\n\t\t// Update deprecated options to work with the tabular data format\n\t\t// Similar to the functionality in model.transformToTabularData()\n\t\tfor (const axisName in defaultOptions.axes) {\n\t\t\tif (providedAxesNames.includes(axisName)) {\n\t\t\t\tconst providedAxisOptions = providedOptions.axes[axisName];\n\n\t\t\t\tif (\n\t\t\t\t\tprovidedAxisOptions['primary'] ||\n\t\t\t\t\tprovidedAxisOptions['secondary']\n\t\t\t\t) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'`primary` & `secondary` are no longer needed for axis configurations. Read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format'\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst identifier = providedAxisOptions['mapsTo'];\n\t\t\t\tif (identifier === undefined || identifier === null) {\n\t\t\t\t\tconst scaleType = providedAxisOptions['scaleType'];\n\n\t\t\t\t\tif (scaleType === undefined || scaleType === null) {\n\t\t\t\t\t\tprovidedAxisOptions['mapsTo'] = 'value';\n\t\t\t\t\t} else if (scaleType === ScaleTypes.TIME) {\n\t\t\t\t\t\tprovidedAxisOptions['mapsTo'] = 'date';\n\t\t\t\t\t} else if (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tprovidedAxisOptions['mapsTo'] = 'key';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete defaultOptions.axes[axisName];\n\t\t\t}\n\t\t}\n\n\t\treturn Tools.merge(defaultOptions, providedOptions);\n\t}\n\n\t/**************************************\n\t * DOM-related operations *\n\t *************************************/\n\n\t/**\n\t * Get width & height of an element\n\t *\n\t * @export\n\t * @param {any} el element to get dimensions from\n\t * @returns an object containing the width and height of el\n\t */\n\texport function getDimensions(el) {\n\t\treturn {\n\t\t\twidth: parseFloat(\n\t\t\t\tel.style.width.replace('px', '') || el.offsetWidth\n\t\t\t),\n\t\t\theight: parseFloat(\n\t\t\t\tel.style.height.replace('px', '') || el.offsetHeight\n\t\t\t),\n\t\t};\n\t}\n\n\t/**\n\t * Gets elements's x and y translations from transform attribute or returns null\n\t *\n\t * @param {HTMLElement} element\n\t * @returns an object containing the translated x and y values or null\n\t */\n\texport function getTranslationValues(elementRef: HTMLElement) {\n\t\tif (!elementRef) {\n\t\t\treturn;\n\t\t}\n\n\t\t// regex to ONLY get values for translate (instead of all rotate, translate, skew, etc)\n\t\tconst translateRegex = /translate\\([0-9]+\\.?[0-9]*,[0-9]+\\.?[0-9]*\\)/;\n\n\t\tconst transformStr = elementRef\n\t\t\t.getAttribute('transform')\n\t\t\t.match(translateRegex);\n\t\tif (!transformStr) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// check for the match\n\t\tif (transformStr[0]) {\n\t\t\tconst transforms = transformStr[0]\n\t\t\t\t.replace(/translate\\(/, '')\n\t\t\t\t.replace(/\\)/, '')\n\t\t\t\t.split(',');\n\n\t\t\treturn {\n\t\t\t\ttx: transforms[0],\n\t\t\t\tty: transforms[1],\n\t\t\t};\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**************************************\n\t * Formatting & calculations *\n\t *************************************/\n\n\t/**\n\t * Gets x and y coordinates from HTML transform attribute\n\t *\n\t * @export\n\t * @param {any} string the transform attribute string ie. transform(x,y)\n\t * @returns Returns an object with x and y offsets of the transform\n\t */\n\texport function getTranformOffsets(string) {\n\t\tconst regExp = /\\(([^)]+)\\)/;\n\t\tconst match = regExp.exec(string)[1];\n\t\tconst xyString = match.split(',');\n\n\t\treturn {\n\t\t\tx: parseFloat(xyString[0]),\n\t\t\ty: parseFloat(xyString[1]),\n\t\t};\n\t}\n\n\t/**\n\t * Returns string value for height/width using pixels if there isn't a specified unit of measure\n\t *\n\t * @param value string or number value to be checked for unit of measure\n\t */\n\texport function formatWidthHeightValues(value) {\n\t\tconst stringValue = value.toString();\n\n\t\t// If the value provided contains any letters\n\t\t// Return it the same way\n\t\tif (stringValue.match(/[a-z]/i)) {\n\t\t\treturn stringValue;\n\t\t}\n\n\t\treturn stringValue + 'px';\n\t}\n\n\t/**\n\t * Capitalizes first letter of a string\n\t *\n\t * @export\n\t * @param {any} string the input string to perform first letter capitalization with\n\t * @returns The transformed string after first letter is capitalized\n\t */\n\texport function capitalizeFirstLetter(string) {\n\t\treturn string[0].toUpperCase() + string.slice(1);\n\t}\n\n\t/**\n\t * Get the percentage of a datapoint compared to the entire dataset.\n\t * @export\n\t * @param {any} item\n\t * @param {any} fullData\n\t * @returns The percentage in the form of a number (1 significant digit if necessary)\n\t */\n\texport function convertValueToPercentage(item, fullData) {\n\t\tconst percentage =\n\t\t\t(item / fullData.reduce((accum, val) => accum + val.value, 0)) *\n\t\t\t100;\n\t\t// if the value has any significant figures, keep 1\n\t\treturn percentage % 1 !== 0\n\t\t\t? parseFloat(percentage.toFixed(1))\n\t\t\t: percentage;\n\t}\n\n\t/**\n\t * Truncate the labels\n\t * @export\n\t * @param {any} fullText\n\t * @param {any} truncationType\n\t * @param {any} numCharacter\n\t * @returns Truncated text\n\t */\n\texport function truncateLabel(fullText, truncationType, numCharacter) {\n\t\tif (numCharacter > fullText.length) {\n\t\t\treturn fullText;\n\t\t}\n\t\tif (truncationType === TruncationTypes.MID_LINE) {\n\t\t\treturn (\n\t\t\t\tfullText.substr(0, numCharacter / 2) +\n\t\t\t\t'...' +\n\t\t\t\tfullText.substr(-numCharacter / 2)\n\t\t\t);\n\t\t} else if (truncationType === TruncationTypes.FRONT_LINE) {\n\t\t\treturn '...' + fullText.substr(-numCharacter);\n\t\t} else if (truncationType === TruncationTypes.END_LINE) {\n\t\t\treturn fullText.substr(0, numCharacter) + '...';\n\t\t}\n\t}\n\n\t/**************************************\n\t * Object/array related checks *\n\t *************************************/\n\n\t/**\n\t * Compares two arrays to return the difference between two arrays' items.\n\t *\n\t * @export\n\t * @param {any[]} oldArray the array to check for missing items\n\t * @param {any[]} newArray the array to check for newly added items\n\t * @returns An object containing items missing (existing in oldArray but not newArray)\n\t * and items added (existing in newArray but not in oldArray). Object is of the form { missing: [], added: [] }\n\t */\n\texport function arrayDifferences(oldArray: any[], newArray: any[]) {\n\t\tconst difference = {\n\t\t\tmissing: [],\n\t\t\tadded: [],\n\t\t};\n\n\t\toldArray.forEach((element) => {\n\t\t\tif (newArray.indexOf(element) === -1) {\n\t\t\t\tdifference.missing.push(element);\n\t\t\t}\n\t\t});\n\n\t\tnewArray.forEach((element) => {\n\t\t\tif (oldArray.indexOf(element) === -1) {\n\t\t\t\tdifference.added.push(element);\n\t\t\t}\n\t\t});\n\n\t\treturn difference;\n\t}\n\n\t/**\n\t * Gets the duplicated keys from an array of data\n\t *\n\t * @export\n\t * @param {*} data - array of data\n\t * @returns A list of the duplicated keys in data\n\t */\n\texport function getDuplicateValues(arr: any) {\n\t\tconst values = [];\n\t\tconst duplicateValues = [];\n\n\t\tarr.forEach((value) => {\n\t\t\tif (\n\t\t\t\tvalues.indexOf(value) !== -1 &&\n\t\t\t\tduplicateValues.indexOf(value) === -1\n\t\t\t) {\n\t\t\t\tduplicateValues.push(value);\n\t\t\t}\n\n\t\t\tvalues.push(value);\n\t\t});\n\n\t\treturn duplicateValues;\n\t}\n\n\t// ================================================================================\n\t// D3 Extensions\n\t// ================================================================================\n\n\t/**\n\t * In D3, moves an element to the front of the canvas\n\t *\n\t * @export\n\t * @param {any} element input element to moved in front\n\t * @returns The function to be used by D3 to push element to the top of the canvas\n\t */\n\texport function moveToFront(element) {\n\t\treturn element.each(function () {\n\t\t\tthis.parentNode.appendChild(this);\n\t\t});\n\t}\n\n\t// ================================================================================\n\t// Style Helpers\n\t// ================================================================================\n\n\t/**\n\t * Gets a speicified property from within an object.\n\t *\n\t * @param object the object containing the property to retrieve\n\t * @param propPath nested properties used to extract the final property from within the object\n\t * (i.e \"style\", \"color\" would retrieve the color property from within an object that has \"color\" nested within \"style\")\n\t */\n\texport const getProperty = (object, ...propPath) => {\n\t\tlet position = object;\n\t\tif (position) {\n\t\t\tfor (const prop of propPath) {\n\t\t\t\tif (position[prop] !== null && position[prop] !== undefined) {\n\t\t\t\t\tposition = position[prop];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn position;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tinterface SVGPathCoordinates {\n\t\tx0: number;\n\t\tx1: number;\n\t\ty0: number;\n\t\ty1: number;\n\t}\n\n\texport const flipSVGCoordinatesBasedOnOrientation = (\n\t\tverticalCoordinates: SVGPathCoordinates,\n\t\torientation?: CartesianOrientations\n\t) => {\n\t\tif (orientation === CartesianOrientations.HORIZONTAL) {\n\t\t\treturn {\n\t\t\t\ty0: verticalCoordinates.x0,\n\t\t\t\ty1: verticalCoordinates.x1,\n\t\t\t\tx0: verticalCoordinates.y0,\n\t\t\t\tx1: verticalCoordinates.y1,\n\t\t\t};\n\t\t}\n\n\t\treturn verticalCoordinates;\n\t};\n\n\texport const generateSVGPathString = (\n\t\tverticalCoordinates: SVGPathCoordinates,\n\t\torientation?: CartesianOrientations\n\t) => {\n\t\tconst { x0, x1, y0, y1 } = flipSVGCoordinatesBasedOnOrientation(\n\t\t\tverticalCoordinates,\n\t\t\torientation\n\t\t);\n\n\t\treturn `M${x0},${y0}L${x0},${y1}L${x1},${y1}L${x1},${y0}L${x0},${y0}`;\n\t};\n\n\texport function flipDomainAndRangeBasedOnOrientation<D, R>(\n\t\tdomain: D,\n\t\trange: R,\n\t\torientation?: CartesianOrientations\n\t): [D, R] | [R, D] {\n\t\treturn orientation === CartesianOrientations.VERTICAL\n\t\t\t? [domain, range]\n\t\t\t: [range, domain];\n\t}\n\n\texport const compareNumeric = (a: Numeric, b: Numeric) =>\n\t\tNumber(a) === Number(b);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["tools.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAEN,qBAAqB,EACrB,UAAU,EACV,eAAe,EACf,cAAc,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,SAAS,IAAI,eAAe,EAC5B,OAAO,IAAI,aAAa,EACxB,IAAI,IAAI,YAAY,EACpB,KAAK,IAAI,WAAW,EACpB,OAAO,IAAI,aAAa,EACxB,SAAS,IAAI,eAAe,EAC5B,OAAO,IAAI,aAAa,EACxB,OAAO,IAAI,aAAa,EACxB,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,SAAS,IAAI,eAAe,EAC5B,IAAI,IAAI,UAAU,GAIlB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,YAAY;AACZ,MAAM,KAAW,KAAK,CAobrB;AApbD,WAAiB,KAAK;IACrB,qCAAqC;IACxB,cAAQ,GAAG,cAAc,CAAC;IAC1B,WAAK,GAAG,eAAe,CAAC;IACxB,WAAK,GAAG,WAAW,CAAC;IACpB,aAAO,GAAG,aAAa,CAAC;IACxB,2BAAqB,GAAG,YAAY,CAAC;IACrC,WAAK,GAAG,WAAW,CAAC;IACpB,aAAO,GAAG,aAAa,CAAC;IACxB,eAAS,GAAG,eAAe,CAAC;IAC5B,aAAO,GAAG,aAAa,CAAC;IACxB,aA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,EAAE,SAAI,EAAE,SAAI,EAAI,CAAC;IACvE,CAAC,CAAC;IAEF,SAAgB,oCAAoC,CACnD,MAAS,EACT,KAAQ,EACR,WAAmC;QAEnC,OAAO,WAAW,KAAK,qBAAqB,CAAC,QAAQ;YACpD,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpB,CAAC;IARe,0CAAoC,uCAQnD,CAAA;IAEY,oBAAc,GAAG,UAAC,CAAU,EAAE,CAAU;QACpD,OAAA,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;IAAvB,CAAuB,CAAC;AAC1B,CAAC,EApbgB,KAAK,KAAL,KAAK,QAobrB","sourcesContent":["// Internal imports\nimport {\n\tAxisChartOptions,\n\tCartesianOrientations,\n\tScaleTypes,\n\tTruncationTypes,\n\tLegendItemType,\n} from './interfaces';\n\nimport {\n\tdebounce as lodashDebounce,\n\tmerge as lodashMerge,\n\tcloneDeep as lodashCloneDeep,\n\tunionBy as lodashUnionBy,\n\tuniq as lodashUnique,\n\tclamp as lodashClamp,\n\tflatten as lodashFlatten,\n\tcamelCase as lodashCamelCase,\n\tisEmpty as lodashIsEmpty,\n\tisEqual as lodashIsEqual,\n\tflatMapDeep as lodashFlatMapDeep,\n\tkebabCase as lodashKebabCase,\n\tfromPairs as lodashFromPairs,\n\tsome as lodashSome,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tCancelable,\n\tDebounceSettings,\n} from 'lodash-es';\n\nimport { mouse } from 'd3-selection';\nimport { Numeric } from 'd3';\n\n// Functions\nexport namespace Tools {\n\t// Export these functions from lodash\n\texport const debounce = lodashDebounce;\n\texport const clone = lodashCloneDeep;\n\texport const merge = lodashMerge;\n\texport const unionBy = lodashUnionBy;\n\texport const removeArrayDuplicates = lodashUnique;\n\texport const clamp = lodashClamp;\n\texport const flatten = lodashFlatten;\n\texport const camelCase = lodashCamelCase;\n\texport const isEmpty = lodashIsEmpty;\n\texport const isEqual = lodashIsEqual;\n\texport const flatMapDeep = lodashFlatMapDeep;\n\texport const kebabCase = lodashKebabCase;\n\texport const fromPairs = lodashFromPairs;\n\texport const some = lodashSome;\n\n\texport function debounceWithD3MousePosition(fn, delay, element) {\n\t\tvar timer = null;\n\t\treturn function () {\n\t\t\tconst context = this;\n\t\t\tconst args = arguments;\n\n\t\t\t//we get the D3 event here\n\t\t\tcontext.mousePosition = mouse(element);\n\n\t\t\tclearTimeout(timer);\n\n\t\t\ttimer = setTimeout(function () {\n\t\t\t\t// and use the reference here\n\t\t\t\tfn.apply(context, args);\n\t\t\t}, delay);\n\t\t};\n\t}\n\n\t/**\n\t * Returns default chart options merged with provided options,\n\t * with special cases for axes.\n\t * Axes object will not merge the not provided axes.\n\t *\n\t * @export\n\t * @param {AxisChartOptions} defaultOptions Configuration.options[chartType]\n\t * @param {AxisChartOptions} providedOptions user provided options\n\t * @returns merged options\n\t */\n\texport function mergeDefaultChartOptions(\n\t\tdefaultOptions: any,\n\t\tprovidedOptions: any\n\t) {\n\t\tdefaultOptions = Tools.clone(defaultOptions);\n\t\tconst providedAxesNames = Object.keys(providedOptions.axes || {});\n\n\t\tif (providedAxesNames.length === 0) {\n\t\t\tdelete defaultOptions.axes;\n\t\t}\n\n\t\t// Update deprecated options to work with the tabular data format\n\t\t// Similar to the functionality in model.transformToTabularData()\n\t\tfor (const axisName in defaultOptions.axes) {\n\t\t\tif (providedAxesNames.includes(axisName)) {\n\t\t\t\tconst providedAxisOptions = providedOptions.axes[axisName];\n\n\t\t\t\tif (\n\t\t\t\t\tprovidedAxisOptions['primary'] ||\n\t\t\t\t\tprovidedAxisOptions['secondary']\n\t\t\t\t) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'`primary` & `secondary` are no longer needed for axis configurations. Read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format'\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst identifier = providedAxisOptions['mapsTo'];\n\t\t\t\tif (identifier === undefined || identifier === null) {\n\t\t\t\t\tconst scaleType = providedAxisOptions['scaleType'];\n\n\t\t\t\t\tif (scaleType === undefined || scaleType === null) {\n\t\t\t\t\t\tprovidedAxisOptions['mapsTo'] = 'value';\n\t\t\t\t\t} else if (scaleType === ScaleTypes.TIME) {\n\t\t\t\t\t\tprovidedAxisOptions['mapsTo'] = 'date';\n\t\t\t\t\t} else if (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tprovidedAxisOptions['mapsTo'] = 'key';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete defaultOptions.axes[axisName];\n\t\t\t}\n\t\t}\n\n\t\tupdateLegendAdditionalItems(defaultOptions, providedOptions);\n\n\t\treturn Tools.merge(defaultOptions, providedOptions);\n\t}\n\n\t/**************************************\n\t * DOM-related operations *\n\t *************************************/\n\n\t/**\n\t * Get width & height of an element\n\t *\n\t * @export\n\t * @param {any} el element to get dimensions from\n\t * @returns an object containing the width and height of el\n\t */\n\texport function getDimensions(el) {\n\t\treturn {\n\t\t\twidth: parseFloat(\n\t\t\t\tel.style.width.replace('px', '') || el.offsetWidth\n\t\t\t),\n\t\t\theight: parseFloat(\n\t\t\t\tel.style.height.replace('px', '') || el.offsetHeight\n\t\t\t),\n\t\t};\n\t}\n\n\t/**\n\t * Gets elements's x and y translations from transform attribute or returns null\n\t *\n\t * @param {HTMLElement} element\n\t * @returns an object containing the translated x and y values or null\n\t */\n\texport function getTranslationValues(elementRef: HTMLElement) {\n\t\tif (!elementRef) {\n\t\t\treturn;\n\t\t}\n\n\t\t// regex to ONLY get values for translate (instead of all rotate, translate, skew, etc)\n\t\tconst translateRegex = /translate\\([0-9]+\\.?[0-9]*,[0-9]+\\.?[0-9]*\\)/;\n\n\t\tconst transformStr = elementRef\n\t\t\t.getAttribute('transform')\n\t\t\t.match(translateRegex);\n\t\tif (!transformStr) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// check for the match\n\t\tif (transformStr[0]) {\n\t\t\tconst transforms = transformStr[0]\n\t\t\t\t.replace(/translate\\(/, '')\n\t\t\t\t.replace(/\\)/, '')\n\t\t\t\t.split(',');\n\n\t\t\treturn {\n\t\t\t\ttx: transforms[0],\n\t\t\t\tty: transforms[1],\n\t\t\t};\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**************************************\n\t * Formatting & calculations *\n\t *************************************/\n\n\t/**\n\t * Gets x and y coordinates from HTML transform attribute\n\t *\n\t * @export\n\t * @param {any} string the transform attribute string ie. transform(x,y)\n\t * @returns Returns an object with x and y offsets of the transform\n\t */\n\texport function getTranformOffsets(string) {\n\t\tconst regExp = /\\(([^)]+)\\)/;\n\t\tconst match = regExp.exec(string)[1];\n\t\tconst xyString = match.split(',');\n\n\t\treturn {\n\t\t\tx: parseFloat(xyString[0]),\n\t\t\ty: parseFloat(xyString[1]),\n\t\t};\n\t}\n\n\t/**\n\t * Returns string value for height/width using pixels if there isn't a specified unit of measure\n\t *\n\t * @param value string or number value to be checked for unit of measure\n\t */\n\texport function formatWidthHeightValues(value) {\n\t\tconst stringValue = value.toString();\n\n\t\t// If the value provided contains any letters\n\t\t// Return it the same way\n\t\tif (stringValue.match(/[a-z]/i)) {\n\t\t\treturn stringValue;\n\t\t}\n\n\t\treturn stringValue + 'px';\n\t}\n\n\t/**\n\t * Capitalizes first letter of a string\n\t *\n\t * @export\n\t * @param {any} string the input string to perform first letter capitalization with\n\t * @returns The transformed string after first letter is capitalized\n\t */\n\texport function capitalizeFirstLetter(string) {\n\t\treturn string[0].toUpperCase() + string.slice(1);\n\t}\n\n\t/**\n\t * Get the percentage of a datapoint compared to the entire dataset.\n\t * @export\n\t * @param {any} item\n\t * @param {any} fullData\n\t * @returns The percentage in the form of a number (1 significant digit if necessary)\n\t */\n\texport function convertValueToPercentage(item, fullData) {\n\t\tconst percentage =\n\t\t\t(item / fullData.reduce((accum, val) => accum + val.value, 0)) *\n\t\t\t100;\n\t\t// if the value has any significant figures, keep 1\n\t\treturn percentage % 1 !== 0\n\t\t\t? parseFloat(percentage.toFixed(1))\n\t\t\t: percentage;\n\t}\n\n\t/**\n\t * Truncate the labels\n\t * @export\n\t * @param {any} fullText\n\t * @param {any} truncationType\n\t * @param {any} numCharacter\n\t * @returns Truncated text\n\t */\n\texport function truncateLabel(fullText, truncationType, numCharacter) {\n\t\tif (numCharacter > fullText.length) {\n\t\t\treturn fullText;\n\t\t}\n\t\tif (truncationType === TruncationTypes.MID_LINE) {\n\t\t\treturn (\n\t\t\t\tfullText.substr(0, numCharacter / 2) +\n\t\t\t\t'...' +\n\t\t\t\tfullText.substr(-numCharacter / 2)\n\t\t\t);\n\t\t} else if (truncationType === TruncationTypes.FRONT_LINE) {\n\t\t\treturn '...' + fullText.substr(-numCharacter);\n\t\t} else if (truncationType === TruncationTypes.END_LINE) {\n\t\t\treturn fullText.substr(0, numCharacter) + '...';\n\t\t}\n\t}\n\n\t/**\n\t * Update legend additional items\n\t * @param {any} defaultOptions\n\t * @param {any} providedOptions\n\t */\n\texport function updateLegendAdditionalItems(\n\t\tdefaultOptions,\n\t\tprovidedOptions\n\t) {\n\t\tlet defaultAdditionalItems = Tools.getProperty(\n\t\t\tdefaultOptions,\n\t\t\t'legend',\n\t\t\t'additionalItems'\n\t\t);\n\t\tconst userProvidedAdditionalItems = Tools.getProperty(\n\t\t\tprovidedOptions,\n\t\t\t'legend',\n\t\t\t'additionalItems'\n\t\t);\n\n\t\t// Retain default legend additional items\n\t\tif (defaultAdditionalItems && userProvidedAdditionalItems) {\n\t\t\tconst providedTypes = userProvidedAdditionalItems.map(\n\t\t\t\t(item) => item.type\n\t\t\t);\n\n\t\t\t// Remove same type default items if they are provided\n\t\t\tdefaultAdditionalItems = defaultAdditionalItems.filter(\n\t\t\t\t(item) =>\n\t\t\t\t\t!providedTypes.includes(item.type) &&\n\t\t\t\t\titem.type === LegendItemType.RADIUS\n\t\t\t);\n\n\t\t\tprovidedOptions.legend.additionalItems = Tools.unionBy(\n\t\t\t\tdefaultAdditionalItems,\n\t\t\t\tuserProvidedAdditionalItems,\n\t\t\t\t'name'\n\t\t\t);\n\n\t\t\tdefaultOptions.legend.additionalItems = [];\n\t\t}\n\t}\n\n\t/**************************************\n\t * Object/array related checks *\n\t *************************************/\n\n\t/**\n\t * Compares two arrays to return the difference between two arrays' items.\n\t *\n\t * @export\n\t * @param {any[]} oldArray the array to check for missing items\n\t * @param {any[]} newArray the array to check for newly added items\n\t * @returns An object containing items missing (existing in oldArray but not newArray)\n\t * and items added (existing in newArray but not in oldArray). Object is of the form { missing: [], added: [] }\n\t */\n\texport function arrayDifferences(oldArray: any[], newArray: any[]) {\n\t\tconst difference = {\n\t\t\tmissing: [],\n\t\t\tadded: [],\n\t\t};\n\n\t\toldArray.forEach((element) => {\n\t\t\tif (newArray.indexOf(element) === -1) {\n\t\t\t\tdifference.missing.push(element);\n\t\t\t}\n\t\t});\n\n\t\tnewArray.forEach((element) => {\n\t\t\tif (oldArray.indexOf(element) === -1) {\n\t\t\t\tdifference.added.push(element);\n\t\t\t}\n\t\t});\n\n\t\treturn difference;\n\t}\n\n\t/**\n\t * Gets the duplicated keys from an array of data\n\t *\n\t * @export\n\t * @param {*} data - array of data\n\t * @returns A list of the duplicated keys in data\n\t */\n\texport function getDuplicateValues(arr: any) {\n\t\tconst values = [];\n\t\tconst duplicateValues = [];\n\n\t\tarr.forEach((value) => {\n\t\t\tif (\n\t\t\t\tvalues.indexOf(value) !== -1 &&\n\t\t\t\tduplicateValues.indexOf(value) === -1\n\t\t\t) {\n\t\t\t\tduplicateValues.push(value);\n\t\t\t}\n\n\t\t\tvalues.push(value);\n\t\t});\n\n\t\treturn duplicateValues;\n\t}\n\n\t// ================================================================================\n\t// D3 Extensions\n\t// ================================================================================\n\n\t/**\n\t * In D3, moves an element to the front of the canvas\n\t *\n\t * @export\n\t * @param {any} element input element to moved in front\n\t * @returns The function to be used by D3 to push element to the top of the canvas\n\t */\n\texport function moveToFront(element) {\n\t\treturn element.each(function () {\n\t\t\tthis.parentNode.appendChild(this);\n\t\t});\n\t}\n\n\t// ================================================================================\n\t// Style Helpers\n\t// ================================================================================\n\n\t/**\n\t * Gets a speicified property from within an object.\n\t *\n\t * @param object the object containing the property to retrieve\n\t * @param propPath nested properties used to extract the final property from within the object\n\t * (i.e \"style\", \"color\" would retrieve the color property from within an object that has \"color\" nested within \"style\")\n\t */\n\texport const getProperty = (object, ...propPath) => {\n\t\tlet position = object;\n\t\tif (position) {\n\t\t\tfor (const prop of propPath) {\n\t\t\t\tif (position[prop] !== null && position[prop] !== undefined) {\n\t\t\t\t\tposition = position[prop];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn position;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tinterface SVGPathCoordinates {\n\t\tx0: number;\n\t\tx1: number;\n\t\ty0: number;\n\t\ty1: number;\n\t}\n\n\texport const flipSVGCoordinatesBasedOnOrientation = (\n\t\tverticalCoordinates: SVGPathCoordinates,\n\t\torientation?: CartesianOrientations\n\t) => {\n\t\tif (orientation === CartesianOrientations.HORIZONTAL) {\n\t\t\treturn {\n\t\t\t\ty0: verticalCoordinates.x0,\n\t\t\t\ty1: verticalCoordinates.x1,\n\t\t\t\tx0: verticalCoordinates.y0,\n\t\t\t\tx1: verticalCoordinates.y1,\n\t\t\t};\n\t\t}\n\n\t\treturn verticalCoordinates;\n\t};\n\n\texport const generateSVGPathString = (\n\t\tverticalCoordinates: SVGPathCoordinates,\n\t\torientation?: CartesianOrientations\n\t) => {\n\t\tconst { x0, x1, y0, y1 } = flipSVGCoordinatesBasedOnOrientation(\n\t\t\tverticalCoordinates,\n\t\t\torientation\n\t\t);\n\n\t\treturn `M${x0},${y0}L${x0},${y1}L${x1},${y1}L${x1},${y0}L${x0},${y0}`;\n\t};\n\n\texport function flipDomainAndRangeBasedOnOrientation<D, R>(\n\t\tdomain: D,\n\t\trange: R,\n\t\torientation?: CartesianOrientations\n\t): [D, R] | [R, D] {\n\t\treturn orientation === CartesianOrientations.VERTICAL\n\t\t\t? [domain, range]\n\t\t\t: [range, domain];\n\t}\n\n\texport const compareNumeric = (a: Numeric, b: Numeric) =>\n\t\tNumber(a) === Number(b);\n}\n"]}
|