@carbon/charts 1.3.1 → 1.5.0
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 +33 -0
- package/build/demo/data/bar.d.ts +18 -0
- package/build/src/interfaces/charts.d.ts +5 -1
- package/build/src/interfaces/enums.d.ts +1 -1
- package/build/src/services/time-series.d.ts +415 -0
- package/bundle.js +1 -1
- package/components/essentials/tooltip.js +7 -0
- package/components/essentials/tooltip.js.map +1 -1
- package/configuration.js +2 -1
- package/configuration.js.map +1 -1
- package/demo/data/bar.d.ts +18 -0
- package/demo/data/bar.js +35 -0
- package/demo/data/bar.js.map +1 -1
- package/demo/data/bundle.js +1 -1
- package/demo/data/index.js +5 -0
- package/demo/data/index.js.map +1 -1
- package/demo/styles.css +1 -1675
- 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 +4 -4
- package/demo/utils.js +14 -5
- package/demo/utils.js.map +1 -1
- package/interfaces/charts.d.ts +5 -1
- package/interfaces/charts.js.map +1 -1
- package/interfaces/enums.d.ts +1 -1
- package/interfaces/enums.js +1 -1
- package/interfaces/enums.js.map +1 -1
- package/model/model.js +8 -1
- package/model/model.js.map +1 -1
- package/package.json +1 -2
- package/services/essentials/dom-to-image.d.ts +120 -0
- package/services/essentials/dom-to-image.js +720 -0
- package/services/essentials/dom-to-image.js.map +1 -0
- package/services/essentials/dom-utils.js +6 -4
- package/services/essentials/dom-utils.js.map +1 -1
- package/services/time-series.d.ts +1 -0
- package/services/time-series.js +13 -0
- package/services/time-series.js.map +1 -1
- package/tsconfig.tsbuildinfo +90 -75
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"signature": "04ee40ba0aafdd5f63fd3c6333754badb44fa9620700b4a5a1b3b3b8b26c2cd9"
|
|
127
127
|
},
|
|
128
128
|
"../../demo/utils.ts": {
|
|
129
|
-
"version": "
|
|
129
|
+
"version": "723cdfdef075c8cb53fc6b4b3ec8fc24058b67f3039a892b58f3c7e41912bc6c",
|
|
130
130
|
"signature": "4fe7f477469cf1883226ae5bcbdbbb8d0b5508efdbf4ea909e2f7dc4393483b2"
|
|
131
131
|
},
|
|
132
132
|
"../../demo/data/CHART_TYPES.ts": {
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"signature": "37dce3c308ecb1ef88ddf7c9f9346d64c2b09a36eb7dcd4fe9d9736f5608107f"
|
|
151
151
|
},
|
|
152
152
|
"../../demo/data/bar.ts": {
|
|
153
|
-
"version": "
|
|
154
|
-
"signature": "
|
|
153
|
+
"version": "6e980628688e5dc7f03c041709f1a140f95d59143c030d069aafbe242686af11",
|
|
154
|
+
"signature": "669520899f11d4213848cb1f32dafca697a743f5800db01dcc6161d4c132c927"
|
|
155
155
|
},
|
|
156
156
|
"../../demo/data/boxplot.ts": {
|
|
157
157
|
"version": "829b5bce144ea2f835021047e37ab51f821a90432e23f75932e92caecdef8e6e",
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
"signature": "d673d937720b7b8f8161e266762631615606bcd7214281ceb62ba79b15b38690"
|
|
259
259
|
},
|
|
260
260
|
"../../demo/data/index.ts": {
|
|
261
|
-
"version": "
|
|
261
|
+
"version": "18b87dcb4c1c15a553604268d05f1bf0d0310d236b205df35bcb4e73ae13a775",
|
|
262
262
|
"signature": "93e8dcbf2620736f44129f6520093bfb9b49d5c831e973dcc66e1b071015f5c1"
|
|
263
263
|
},
|
|
264
264
|
"../../node_modules/@types/node/globals.d.ts": {
|
package/demo/utils.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
2
13
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
3
14
|
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
@@ -69,7 +80,7 @@ var generateColorPalettePickerHTML = function (container, chart, configs) {
|
|
|
69
80
|
export var addControls = function (container, demoGroup, chart, configs) {
|
|
70
81
|
if (configs === void 0) { configs = { colorPairingOptions: null }; }
|
|
71
82
|
var _a, _b;
|
|
72
|
-
generateThemePickerHTML(container,
|
|
83
|
+
generateThemePickerHTML(container, chart);
|
|
73
84
|
if (((_b = (_a = demoGroup) === null || _a === void 0 ? void 0 : _a.configs) === null || _b === void 0 ? void 0 : _b.excludeColorPaletteControl) !== true) {
|
|
74
85
|
generateColorPalettePickerHTML(container, chart, configs);
|
|
75
86
|
}
|
|
@@ -88,10 +99,8 @@ export var addRadioButtonEventListeners = function (container, chart, configs) {
|
|
|
88
99
|
radioButton.addEventListener('click', function (e) {
|
|
89
100
|
var theme = e.target.value;
|
|
90
101
|
document.documentElement.setAttribute('data-carbon-theme', theme);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
.setAttribute('data-carbon-theme', theme);
|
|
94
|
-
chart.update();
|
|
102
|
+
// Set selected theme to options
|
|
103
|
+
chart.model.setOptions(__assign(__assign({}, chart.model.getOptions()), { theme: theme }));
|
|
95
104
|
});
|
|
96
105
|
});
|
|
97
106
|
};
|
package/demo/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAM,uBAAuB,GAAG,UAAC,SAAS,EAAE,OAAO;IAClD,IAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAA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,CAAC,IAAM,wBAAwB,GAAG,UAAC,SAAS,EAAE,IAAI,EAAE,KAAK;IAC9D,+BAA+B;IAC/B,IAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,IAAI,EAAE;QACT,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAC,CAAM;YACtC,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,IAAM,iBAAiB,GACtB,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;YAC5C,KAAK,CAAC,KAAK,CAAC,OAAO,CAClB,kBAAkB,CAAC,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC,CAC/C,CAAC;YACF,KAAK,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;KACH;AACF,CAAC,CAAC","sourcesContent":["const generateThemePickerHTML = (container, configs) => {\n\tconst div = document.createElement('div');\n\tdiv.id = 'theme-picker';\n\tdiv.innerHTML = `\n<fieldset class=\"cds--fieldset marginTop-45\">\n\t<legend class=\"cds--label\">Active theme</legend>\n\n\t<div class=\"cds--form-item\">\n\t\t<div class=\"cds--radio-button-group\">\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__white\" class=\"cds--radio-button\" type=\"radio\" value=\"white\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__white\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">White</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__g10\" class=\"cds--radio-button\" type=\"radio\" value=\"g10\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__g10\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">G10</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__g90\" class=\"cds--radio-button\" type=\"radio\" value=\"g90\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__g90\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">G90</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__g100\" class=\"cds--radio-button\" type=\"radio\" value=\"g100\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__g100\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">G100</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</fieldset>`;\n\n\tconst currentTheme = document.documentElement.getAttribute(\n\t\t'data-carbon-theme'\n\t);\n\tif (currentTheme) {\n\t\tdiv.querySelector(`input#theme__${currentTheme}`).setAttribute(\n\t\t\t'checked',\n\t\t\t'true'\n\t\t);\n\t} else {\n\t\tdiv.querySelector(`input#theme__white`).setAttribute('checked', 'true');\n\t}\n\n\tcontainer.querySelector('#charting-controls').appendChild(div);\n};\n\nconst generateColorPalettePickerHTML = (\n\tcontainer,\n\tchart,\n\tconfigs = { colorPairingOptions: null }\n) => {\n\tconst { colorPairingOptions } = configs;\n\n\tconst chartOptions = chart.model.getOptions();\n\tconst { numberOfVariants: variants, option } = chartOptions.color.pairing;\n\n\tconst numberOfChartDataGroups = chart.model.getAllDataGroupsNames().length;\n\tconst numberOfVariants = variants || numberOfChartDataGroups;\n\n\tlet onlyCategoricalPaletteIsApplicable = false;\n\tif (numberOfChartDataGroups > 5) {\n\t\tonlyCategoricalPaletteIsApplicable = true;\n\t}\n\n\tconst selectedColorPalette = `${numberOfVariants}-${option}`;\n\n\tconst div = document.createElement('div');\n\tdiv.id = 'color-palette-picker';\n\tdiv.innerHTML = `\n<div class=\"cds--form-item\">\n\t<div\n\tclass=\"cds--select\">\n\t<label for=\"color-palette-select\" class=\"cds--label\">Active color palette</label>\n\t\t<div class=\"cds--select-input__wrapper\">\n\t\t<select id=\"color-palette-select\" class=\"cds--select-input\">\n\t\t\t<option class=\"cds--select-option\" value=\"\" disabled selected hidden>\n\t\t\tChoose an option\n\t\t\t</option>\n\t\t\t${Object.keys(colorPairingOptions)\n\t\t\t\t.map((colorGroup) => {\n\t\t\t\t\tconst optionsCount = colorPairingOptions[colorGroup];\n\t\t\t\t\tlet optionsHTML = `<optgroup class=\"cds--select-optgroup\" label=\"${colorGroup} groups\">`;\n\n\t\t\t\t\tconst numberOfVariants = parseInt(colorGroup);\n\n\t\t\t\t\tif (numberOfVariants !== 14) {\n\t\t\t\t\t\tfor (let i = 1; i <= optionsCount; i++) {\n\t\t\t\t\t\t\toptionsHTML += `\n\t\t\t\t\t\t<option class=\"cds--select-option\" ${\n\t\t\t\t\t\t\tonlyCategoricalPaletteIsApplicable ||\n\t\t\t\t\t\t\tnumberOfVariants < numberOfChartDataGroups\n\t\t\t\t\t\t\t\t? 'disabled'\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t} value=\"${colorGroup}-option-${i}\" ${\n\t\t\t\t\t\t\t\tselectedColorPalette ===\n\t\t\t\t\t\t\t\t`${numberOfVariants}-${i}`\n\t\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t${numberOfVariants}-color groups, option ${i}\n\t\t\t\t\t\t</option>`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\toptionsHTML += `<option class=\"cds--select-option\" value=\"14-color-option-1\" ${\n\t\t\t\t\t\t\tselectedColorPalette === `14-1` ||\n\t\t\t\t\t\t\tonlyCategoricalPaletteIsApplicable\n\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}>\n\t\t\t\t\t\tCategorical palette\n\t\t\t\t\t</option>`;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn optionsHTML;\n\t\t\t\t})\n\t\t\t\t.join('')}\n\t\t</select>\n\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform;\" xmlns=\"http://www.w3.org/2000/svg\" class=\"cds--select__arrow\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z\"></path></svg>\n\t\t</div>\n\t</div>\n\t</div>\n</div>`;\n\n\tdiv.querySelector('#color-palette-select').addEventListener(\n\t\t'change',\n\t\t(e: any) => {\n\t\t\tconst { value } = e.target;\n\t\t\tconst [numberOfVariants, pairingOption] = value.split(\n\t\t\t\t'-color-option-'\n\t\t\t);\n\n\t\t\tchartOptions.color.pairing.numberOfVariants = numberOfVariants;\n\t\t\tchartOptions.color.pairing.option = pairingOption;\n\t\t\tchart.model.setOptions(chartOptions);\n\t\t}\n\t);\n\n\tcontainer.querySelector('#charting-controls').appendChild(div);\n};\n\nexport const addControls = (\n\tcontainer,\n\tdemoGroup,\n\tchart,\n\tconfigs = { colorPairingOptions: null }\n) => {\n\tgenerateThemePickerHTML(container, configs);\n\n\tif (demoGroup?.configs?.excludeColorPaletteControl !== true) {\n\t\tgenerateColorPalettePickerHTML(container, chart, configs);\n\t}\n\n\taddRadioButtonEventListeners(container, chart, configs);\n};\n\nexport const addRadioButtonEventListeners = (container, chart, configs) => {\n\t// Add event listeners for radio buttons\n\tconst radioButtons = container.querySelectorAll(\n\t\t'div#theme-picker input.cds--radio-button'\n\t);\n\n\tconst currentTheme = document.documentElement.getAttribute(\n\t\t'data-carbon-theme'\n\t);\n\tif (currentTheme) {\n\t\tchart.services.domUtils\n\t\t\t.getHolder()\n\t\t\t.setAttribute('data-carbon-theme', currentTheme);\n\t}\n\n\tradioButtons.forEach((radioButton) => {\n\t\tradioButton.addEventListener('click', (e: any) => {\n\t\t\tconst theme = e.target.value;\n\n\t\t\tdocument.documentElement.setAttribute('data-carbon-theme', theme);\n\t\t\tchart.services.domUtils\n\t\t\t\t.getHolder()\n\t\t\t\t.setAttribute('data-carbon-theme', theme);\n\n\t\t\tchart.update();\n\t\t});\n\t});\n};\n\nexport const addOtherVersions = (\n\tcontainer,\n\tdemoGroup,\n\tdemo,\n\tconfigs = { currentVersion: 'vanilla' }\n) => {\n\tconst { currentVersion } = configs;\n\n\tconst demoGroupClassification = (demoGroup.type || '').replace(\n\t\t'-chart',\n\t\t''\n\t);\n\n\tconst div = document.createElement('div');\n\tdiv.setAttribute('class', 'cds--row resource-card-group');\n\n\tlet htmlContent = '';\n\tconst otherVersions = [\n\t\t...(currentVersion !== 'vanilla'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'vanilla',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'react'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'React',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/react/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'angular'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Angular',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/angular/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'vue'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Vue',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/vue/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'svelte'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Svelte',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/svelte/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\totherVersions.forEach((otherVersion) => {\n\t\thtmlContent += `<div class=\"cds--no-gutter-sm cds--col-md-6 cds--col-lg-6\">\n\t\t<div class=\"cds--resource-card\">\n\t\t <div class=\"cds--aspect-ratio cds--aspect-ratio--2x1\">\n\t\t\t<div class=\"cds--aspect-ratio--object\">\n\t\t\t <a href=\"${otherVersion.link}\" class=\"cds--tile cds--tile--clickable\">\n\t\t\t\t<h5 class=\"cds--resource-card__subtitle\">${otherVersion.name}</h5>\n\t\t\t\t<div class=\"cds--resource-card__icon--img\"></div>\n\t\t\t\t<div class=\"cds--resource-card__icon--action\">\n\t\t\t\t <svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" aria-label=\"Open resource\" width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" role=\"img\">\n\t\t\t\t\t<path d=\"M26,28H6a2.0027,2.0027,0,0,1-2-2V6A2.0027,2.0027,0,0,1,6,4H16V6H6V26H26V16h2V26A2.0027,2.0027,0,0,1,26,28Z\"></path>\n\t\t\t\t\t<path d=\"M20 2L20 4 26.586 4 18 12.586 19.414 14 28 5.414 28 12 30 12 30 2 20 2z\"></path>\n\t\t\t\t </svg>\n\t\t\t\t</div>\n\t\t\t </a>\n\t\t\t</div>\n\t\t </div>\n\t\t</div>\n\t </div>`;\n\t});\n\n\tdiv.innerHTML = htmlContent;\n\tcontainer.querySelector('#other-versions').appendChild(div);\n};\n\n/**\n * Generates random data going backwards from now once a minute\n * @param {number} quantity number of data points to create\n * @param {number} min min range of integer value\n * @param {number} max max range of integer value\n * @returns {array} randomly generated array of objects with a date and value field\n */\nexport const generateRandomData = (quantity, min, max) => {\n\tconst now = Date.now();\n\treturn Array(quantity)\n\t\t.fill(0)\n\t\t.map((value, index) => {\n\t\t\treturn {\n\t\t\t\tgroup: 'group',\n\t\t\t\tvalue: Math.floor(Math.random() * (max - min + 1) + min),\n\t\t\t\tdate: new Date(now.valueOf() + (index - quantity) * 60000), // go forward a minute for every value\n\t\t\t};\n\t\t});\n};\n/**\n * Adds a generate demo data form to the story\n */\nexport const generateHighScaleDemoDataForm = () =>\n\t`<form id=\"demo-data\"><label for=\"demo-data-name\">Records to generate: </label><input type=\"number\" id=\"demo-data-number\" name=\"number\" required\n\t size=\"5\" value=\"100\"><input type=\"submit\"></label></form>`;\nexport const addDemoDataFormListeners = (container, demo, chart) => {\n\t// Add event listeners for form\n\tconst form = container.querySelector('form#demo-data');\n\tif (form) {\n\t\tform.addEventListener('submit', (e: any) => {\n\t\t\te.stopPropagation();\n\t\t\te.preventDefault();\n\t\t\tconst recordsToGenerate =\n\t\t\t\tparseInt(e.currentTarget[0].value) || 2000;\n\t\t\tchart.model.setData(\n\t\t\t\tgenerateRandomData(recordsToGenerate, 100, 500)\n\t\t\t);\n\t\t\tchart.update();\n\t\t});\n\t}\n};\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAM,uBAAuB,GAAG,UAAC,SAAS,EAAE,OAAO;IAClD,IAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,GAAG,cAAc,CA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,EAAE,KAAK;IAC9D,+BAA+B;IAC/B,IAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,IAAI,EAAE;QACT,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAC,CAAM;YACtC,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,IAAM,iBAAiB,GACtB,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;YAC5C,KAAK,CAAC,KAAK,CAAC,OAAO,CAClB,kBAAkB,CAAC,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC,CAC/C,CAAC;YACF,KAAK,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;KACH;AACF,CAAC,CAAC","sourcesContent":["const generateThemePickerHTML = (container, configs) => {\n\tconst div = document.createElement('div');\n\tdiv.id = 'theme-picker';\n\tdiv.innerHTML = `\n<fieldset class=\"cds--fieldset marginTop-45\">\n\t<legend class=\"cds--label\">Active theme</legend>\n\n\t<div class=\"cds--form-item\">\n\t\t<div class=\"cds--radio-button-group\">\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__white\" class=\"cds--radio-button\" type=\"radio\" value=\"white\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__white\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">White</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__g10\" class=\"cds--radio-button\" type=\"radio\" value=\"g10\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__g10\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">G10</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__g90\" class=\"cds--radio-button\" type=\"radio\" value=\"g90\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__g90\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">G90</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\n\t\t\t<div class=\"cds--radio-button-wrapper\">\n\t\t\t\t<input id=\"theme__g100\" class=\"cds--radio-button\" type=\"radio\" value=\"g100\" name=\"radio-button\" tabindex=\"0\">\n\t\t\t\t<label for=\"theme__g100\" class=\"cds--radio-button__label\">\n\t\t\t\t<span class=\"cds--radio-button__appearance\"></span>\n\t\t\t\t<span class=\"cds--radio-button__label-text\">G100</span>\n\t\t\t\t</label>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</fieldset>`;\n\n\tconst currentTheme = document.documentElement.getAttribute(\n\t\t'data-carbon-theme'\n\t);\n\tif (currentTheme) {\n\t\tdiv.querySelector(`input#theme__${currentTheme}`).setAttribute(\n\t\t\t'checked',\n\t\t\t'true'\n\t\t);\n\t} else {\n\t\tdiv.querySelector(`input#theme__white`).setAttribute('checked', 'true');\n\t}\n\n\tcontainer.querySelector('#charting-controls').appendChild(div);\n};\n\nconst generateColorPalettePickerHTML = (\n\tcontainer,\n\tchart,\n\tconfigs = { colorPairingOptions: null }\n) => {\n\tconst { colorPairingOptions } = configs;\n\n\tconst chartOptions = chart.model.getOptions();\n\tconst { numberOfVariants: variants, option } = chartOptions.color.pairing;\n\n\tconst numberOfChartDataGroups = chart.model.getAllDataGroupsNames().length;\n\tconst numberOfVariants = variants || numberOfChartDataGroups;\n\n\tlet onlyCategoricalPaletteIsApplicable = false;\n\tif (numberOfChartDataGroups > 5) {\n\t\tonlyCategoricalPaletteIsApplicable = true;\n\t}\n\n\tconst selectedColorPalette = `${numberOfVariants}-${option}`;\n\n\tconst div = document.createElement('div');\n\tdiv.id = 'color-palette-picker';\n\tdiv.innerHTML = `\n<div class=\"cds--form-item\">\n\t<div\n\tclass=\"cds--select\">\n\t<label for=\"color-palette-select\" class=\"cds--label\">Active color palette</label>\n\t\t<div class=\"cds--select-input__wrapper\">\n\t\t<select id=\"color-palette-select\" class=\"cds--select-input\">\n\t\t\t<option class=\"cds--select-option\" value=\"\" disabled selected hidden>\n\t\t\tChoose an option\n\t\t\t</option>\n\t\t\t${Object.keys(colorPairingOptions)\n\t\t\t\t.map((colorGroup) => {\n\t\t\t\t\tconst optionsCount = colorPairingOptions[colorGroup];\n\t\t\t\t\tlet optionsHTML = `<optgroup class=\"cds--select-optgroup\" label=\"${colorGroup} groups\">`;\n\n\t\t\t\t\tconst numberOfVariants = parseInt(colorGroup);\n\n\t\t\t\t\tif (numberOfVariants !== 14) {\n\t\t\t\t\t\tfor (let i = 1; i <= optionsCount; i++) {\n\t\t\t\t\t\t\toptionsHTML += `\n\t\t\t\t\t\t<option class=\"cds--select-option\" ${\n\t\t\t\t\t\t\tonlyCategoricalPaletteIsApplicable ||\n\t\t\t\t\t\t\tnumberOfVariants < numberOfChartDataGroups\n\t\t\t\t\t\t\t\t? 'disabled'\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t} value=\"${colorGroup}-option-${i}\" ${\n\t\t\t\t\t\t\t\tselectedColorPalette ===\n\t\t\t\t\t\t\t\t`${numberOfVariants}-${i}`\n\t\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t\t${numberOfVariants}-color groups, option ${i}\n\t\t\t\t\t\t</option>`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\toptionsHTML += `<option class=\"cds--select-option\" value=\"14-color-option-1\" ${\n\t\t\t\t\t\t\tselectedColorPalette === `14-1` ||\n\t\t\t\t\t\t\tonlyCategoricalPaletteIsApplicable\n\t\t\t\t\t\t\t\t? 'selected'\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}>\n\t\t\t\t\t\tCategorical palette\n\t\t\t\t\t</option>`;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn optionsHTML;\n\t\t\t\t})\n\t\t\t\t.join('')}\n\t\t</select>\n\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform;\" xmlns=\"http://www.w3.org/2000/svg\" class=\"cds--select__arrow\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M8 11L3 6 3.7 5.3 8 9.6 12.3 5.3 13 6z\"></path></svg>\n\t\t</div>\n\t</div>\n\t</div>\n</div>`;\n\n\tdiv.querySelector('#color-palette-select').addEventListener(\n\t\t'change',\n\t\t(e: any) => {\n\t\t\tconst { value } = e.target;\n\t\t\tconst [numberOfVariants, pairingOption] = value.split(\n\t\t\t\t'-color-option-'\n\t\t\t);\n\n\t\t\tchartOptions.color.pairing.numberOfVariants = numberOfVariants;\n\t\t\tchartOptions.color.pairing.option = pairingOption;\n\t\t\tchart.model.setOptions(chartOptions);\n\t\t}\n\t);\n\n\tcontainer.querySelector('#charting-controls').appendChild(div);\n};\n\nexport const addControls = (\n\tcontainer,\n\tdemoGroup,\n\tchart,\n\tconfigs = { colorPairingOptions: null }\n) => {\n\tgenerateThemePickerHTML(container, chart);\n\n\tif (demoGroup?.configs?.excludeColorPaletteControl !== true) {\n\t\tgenerateColorPalettePickerHTML(container, chart, configs);\n\t}\n\n\taddRadioButtonEventListeners(container, chart, configs);\n};\n\nexport const addRadioButtonEventListeners = (container, chart, configs) => {\n\t// Add event listeners for radio buttons\n\tconst radioButtons = container.querySelectorAll(\n\t\t'div#theme-picker input.cds--radio-button'\n\t);\n\n\tconst currentTheme = document.documentElement.getAttribute(\n\t\t'data-carbon-theme'\n\t);\n\tif (currentTheme) {\n\t\tchart.services.domUtils\n\t\t\t.getHolder()\n\t\t\t.setAttribute('data-carbon-theme', currentTheme);\n\t}\n\n\tradioButtons.forEach((radioButton) => {\n\t\tradioButton.addEventListener('click', (e: any) => {\n\t\t\tconst theme = e.target.value;\n\n\t\t\tdocument.documentElement.setAttribute('data-carbon-theme', theme);\n\t\t\t// Set selected theme to options\n\t\t\tchart.model.setOptions({ ...chart.model.getOptions(), theme });\n\t\t});\n\t});\n};\n\nexport const addOtherVersions = (\n\tcontainer,\n\tdemoGroup,\n\tdemo,\n\tconfigs = { currentVersion: 'vanilla' }\n) => {\n\tconst { currentVersion } = configs;\n\n\tconst demoGroupClassification = (demoGroup.type || '').replace(\n\t\t'-chart',\n\t\t''\n\t);\n\n\tconst div = document.createElement('div');\n\tdiv.setAttribute('class', 'cds--row resource-card-group');\n\n\tlet htmlContent = '';\n\tconst otherVersions = [\n\t\t...(currentVersion !== 'vanilla'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'vanilla',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'react'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'React',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/react/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'angular'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Angular',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/angular/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'vue'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Vue',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/vue/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t\t...(currentVersion !== 'svelte'\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Svelte',\n\t\t\t\t\t\tlink: `https://carbon-design-system.github.io/carbon-charts/svelte/?path=/story/${demoGroupClassification}-charts-${demo.id}`,\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\totherVersions.forEach((otherVersion) => {\n\t\thtmlContent += `<div class=\"cds--no-gutter-sm cds--col-md-6 cds--col-lg-6\">\n\t\t<div class=\"cds--resource-card\">\n\t\t <div class=\"cds--aspect-ratio cds--aspect-ratio--2x1\">\n\t\t\t<div class=\"cds--aspect-ratio--object\">\n\t\t\t <a href=\"${otherVersion.link}\" class=\"cds--tile cds--tile--clickable\">\n\t\t\t\t<h5 class=\"cds--resource-card__subtitle\">${otherVersion.name}</h5>\n\t\t\t\t<div class=\"cds--resource-card__icon--img\"></div>\n\t\t\t\t<div class=\"cds--resource-card__icon--action\">\n\t\t\t\t <svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" aria-label=\"Open resource\" width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" role=\"img\">\n\t\t\t\t\t<path d=\"M26,28H6a2.0027,2.0027,0,0,1-2-2V6A2.0027,2.0027,0,0,1,6,4H16V6H6V26H26V16h2V26A2.0027,2.0027,0,0,1,26,28Z\"></path>\n\t\t\t\t\t<path d=\"M20 2L20 4 26.586 4 18 12.586 19.414 14 28 5.414 28 12 30 12 30 2 20 2z\"></path>\n\t\t\t\t </svg>\n\t\t\t\t</div>\n\t\t\t </a>\n\t\t\t</div>\n\t\t </div>\n\t\t</div>\n\t </div>`;\n\t});\n\n\tdiv.innerHTML = htmlContent;\n\tcontainer.querySelector('#other-versions').appendChild(div);\n};\n\n/**\n * Generates random data going backwards from now once a minute\n * @param {number} quantity number of data points to create\n * @param {number} min min range of integer value\n * @param {number} max max range of integer value\n * @returns {array} randomly generated array of objects with a date and value field\n */\nexport const generateRandomData = (quantity, min, max) => {\n\tconst now = Date.now();\n\treturn Array(quantity)\n\t\t.fill(0)\n\t\t.map((value, index) => {\n\t\t\treturn {\n\t\t\t\tgroup: 'group',\n\t\t\t\tvalue: Math.floor(Math.random() * (max - min + 1) + min),\n\t\t\t\tdate: new Date(now.valueOf() + (index - quantity) * 60000), // go forward a minute for every value\n\t\t\t};\n\t\t});\n};\n/**\n * Adds a generate demo data form to the story\n */\nexport const generateHighScaleDemoDataForm = () =>\n\t`<form id=\"demo-data\"><label for=\"demo-data-name\">Records to generate: </label><input type=\"number\" id=\"demo-data-number\" name=\"number\" required\n\t size=\"5\" value=\"100\"><input type=\"submit\"></label></form>`;\nexport const addDemoDataFormListeners = (container, demo, chart) => {\n\t// Add event listeners for form\n\tconst form = container.querySelector('form#demo-data');\n\tif (form) {\n\t\tform.addEventListener('submit', (e: any) => {\n\t\t\te.stopPropagation();\n\t\t\te.preventDefault();\n\t\t\tconst recordsToGenerate =\n\t\t\t\tparseInt(e.currentTarget[0].value) || 2000;\n\t\t\tchart.model.setData(\n\t\t\t\tgenerateRandomData(recordsToGenerate, 100, 500)\n\t\t\t);\n\t\t\tchart.update();\n\t\t});\n\t}\n};\n"]}
|
package/interfaces/charts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GaugeTypes, Statuses, ArrowDirections, Alignments, ChartTypes, TreeTypes, DividerStatus, ColorLegendType } from './enums';
|
|
1
|
+
import { GaugeTypes, Statuses, ArrowDirections, Alignments, ChartTypes, TreeTypes, DividerStatus, ColorLegendType, ChartTheme } from './enums';
|
|
2
2
|
import { LegendOptions, TooltipOptions, GridOptions, AxesOptions, ZoomBarsOptions } from './index';
|
|
3
3
|
import { BarOptions, StackedBarOptions, ToolbarOptions } from './components';
|
|
4
4
|
import { AxisOptions, BinnedAxisOptions, TimeScaleOptions } from './axis-scales';
|
|
@@ -26,6 +26,10 @@ export interface BaseChartOptions {
|
|
|
26
26
|
* Optionally specify a height for the chart
|
|
27
27
|
*/
|
|
28
28
|
height?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optionally specify a theme for the chart
|
|
31
|
+
*/
|
|
32
|
+
theme?: ChartTheme;
|
|
29
33
|
/**
|
|
30
34
|
* tooltip configuration
|
|
31
35
|
*/
|
package/interfaces/charts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.js","sourceRoot":"","sources":["charts.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tGaugeTypes,\n\tStatuses,\n\tArrowDirections,\n\tAlignments,\n\tChartTypes,\n\tTreeTypes,\n\tDividerStatus,\n\tColorLegendType,\n} from './enums';\nimport {\n\tLegendOptions,\n\tTooltipOptions,\n\tGridOptions,\n\tAxesOptions,\n\tZoomBarsOptions,\n} from './index';\nimport { BarOptions, StackedBarOptions, ToolbarOptions } from './components';\nimport {\n\tAxisOptions,\n\tBinnedAxisOptions,\n\tTimeScaleOptions,\n} from './axis-scales';\n\n/**\n * Base chart options common to any chart\n */\nexport interface BaseChartOptions {\n\t/**\n\t * Optionally specify a title for the chart\n\t */\n\ttitle?: string;\n\t/**\n\t * boolean to disable animations (enabled by default)\n\t */\n\tanimations?: boolean;\n\t/**\n\t * boolean to prevent the container from resizing\n\t */\n\tresizable?: boolean;\n\t/**\n\t * Optionally specify a width for the chart\n\t */\n\twidth?: string;\n\t/**\n\t * Optionally specify a height for the chart\n\t */\n\theight?: string;\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: TooltipOptions;\n\t/**\n\t * legend configuration\n\t */\n\tlegend?: LegendOptions;\n\t/**\n\t * toolbar configurations\n\t */\n\ttoolbar?: ToolbarOptions;\n\t/**\n\t * Optional function to determine whether is filled based on datasetLabel, label, and/or data\n\t */\n\tgetIsFilled?: (\n\t\tdatasetLabel: any,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultFilled?: boolean\n\t) => boolean;\n\t/**\n\t * Optional function to generate the fill color based on datasetLabel, label, and/or data\n\t */\n\tgetFillColor?: (\n\t\tgroup: string,\n\t\tlabel?: string,\n\t\tdata?: any,\n\t\tdefaultFillColor?: string\n\t) => string;\n\t/**\n\t * Optional function to generate the stroke color based on datasetLabel, label, and/or data\n\t * (note) - not all chart types support the stroke color (e.g. wordcloud)\n\t */\n\tgetStrokeColor?: (\n\t\tgroup: string,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultStrokeColor?: string\n\t) => string;\n\t/**\n\t * stylesheet options\n\t */\n\tstyle?: {\n\t\t/**\n\t\t * optional prefixing string for css classes (defaults to 'cc')\n\t\t */\n\t\tprefix?: string;\n\t};\n\t/**\n\t * options related to charting data\n\t */\n\tdata?: {\n\t\t/**\n\t\t * identifier for data groups\n\t\t */\n\t\tgroupMapsTo?: string;\n\t\t/**\n\t\t * used to simulate data loading in skeleton way\n\t\t */\n\t\tloading?: boolean;\n\t\t/**\n\t\t * options related to pre-selected data groups\n\t\t * Remains empty if every legend item is active or dataset doesn't have the data groups.\n\t\t */\n\t\tselectedGroups?: string[];\n\t};\n\t/**\n\t * options related to color scales\n\t */\n\tcolor?: {\n\t\t/**\n\t\t * e.g. { 'Dataset 1': 'blue' }\n\t\t */\n\t\tscale?: object;\n\t\t/**\n\t\t * use a carbon dataviz preset color palette\n\t\t * put the index (selection of which variant)\n\t\t */\n\t\tpairing?: {\n\t\t\t/**\n\t\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t\t */\n\t\t\tnumberOfVariants?: number;\n\t\t\t/**\n\t\t\t * the option number of the color paring\n\t\t\t */\n\t\t\toption?: number;\n\t\t};\n\t\t/*\n\t\t * options related to gradient\n\t\t * e.g. { enabled: true }\n\t\t */\n\t\tgradient?: {\n\t\t\tenabled?: boolean;\n\t\t\t/**\n\t\t\t * hex color array\n\t\t\t * e.g. ['#fff', '#000', ...]\n\t\t\t */\n\t\t\tcolors?: Array<String>;\n\t\t};\n\t};\n}\n\n/**\n * Options common to any chart with an axis\n */\nexport interface AxisChartOptions extends BaseChartOptions {\n\taxes?: AxesOptions<AxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * Options common to binned charts with an axis\n */\nexport interface BinnedAxisChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<BinnedAxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * options specific to boxplot charts\n */\nexport interface BoxplotChartOptions extends AxisChartOptions {}\n\n/**\n * options specific to bar charts\n */\nexport interface BarChartOptions extends AxisChartOptions {\n\tbars?: BarOptions;\n}\n\n/**\n * options specific to stacked bar charts\n */\nexport interface StackedBarChartOptions extends BarChartOptions {\n\tbars?: StackedBarOptions;\n}\n\n/**\n * options specific to scatter charts\n */\nexport interface ScatterChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the points\n\t */\n\tpoints?: {\n\t\t/**\n\t\t * sets the radius of the point\n\t\t */\n\t\tradius: number;\n\t\tfillOpacity?: number;\n\t\tfilled?: boolean;\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to lollipop charts\n */\nexport interface LollipopChartOptions extends ScatterChartOptions {}\n\n/**\n * options specific to bubble charts\n */\nexport interface BubbleChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bubbles\n\t */\n\tbubble?: {\n\t\t/**\n\t\t * the key to lookup in charting data for the bubble radius value\n\t\t */\n\t\tradiusMapsTo?: string;\n\t\t/**\n\t\t * options for what the bubble radius value maps to\n\t\t */\n\t\tradiusLabel?: string;\n\t\t/**\n\t\t * A function that would determine the range of the bubble radius to use\n\t\t * Returns an array with the 1st value being the min and the 2nd value being the max radius\n\t\t */\n\t\tradiusRange?: Function;\n\t\t/**\n\t\t * Opacity of the fills used within each circle\n\t\t */\n\t\tfillOpacity?: number;\n\t\t/**\n\t\t * enabled scatter dot or not\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to bullet charts\n */\nexport interface BulletChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bullets\n\t */\n\tbullet?: {\n\t\tperformanceAreaTitles?: string[];\n\t};\n}\n\n/**\n * options specific to histogram charts\n */\nexport interface HistogramChartOptions extends AxisChartOptions {\n\t/**\n\t * options related to bins\n\t */\n\tbins?: {\n\t\trangeLabel?: string;\n\t};\n}\n\n/**\n * options specific to line charts\n */\nexport interface LineChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n}\n\n/**\n * options specific to area charts\n */\nexport interface AreaChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n\t/**\n\t * options to bound the area of the chart\n\t */\n\tbounds?: {\n\t\tupperBoundMapsTo?: string;\n\t\tlowerBoundMapsTo?: string;\n\t};\n}\n\n/**\n * options specific to area charts\n */\nexport interface StackedAreaChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n}\n\n/**\n * options specific to world cloud charts\n */\nexport interface WordCloudChartTooltipOptions extends TooltipOptions {\n\t/** the label that shows up by the highlighted word in the tooltip */\n\twordLabel?: string;\n\t/** the label that shows up by the value of the highlighted word in the tooltip */\n\tvalueLabel?: string;\n}\n\nexport interface WorldCloudChartOptions extends BaseChartOptions {\n\twordCloud?: {\n\t\t/** what key in your charting data will the font sizes map to? */\n\t\tfontSizeMapsTo?: string;\n\t\t/** a function (chartSize, data) => {} that'll decide the range of font sizes, e.g. [10, 80] */\n\t\tfontSizeRange?: Function;\n\t\t/** what key in your charting data will the words map to? */\n\t\twordMapsTo?: string;\n\t};\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: WordCloudChartTooltipOptions;\n}\n\n/**\n * options specific to pie charts\n */\nexport interface PieChartOptions extends BaseChartOptions {\n\tpie?: {\n\t\tlabels?: {\n\t\t\tformatter?: Function;\n\t\t\tenabled?: Boolean;\n\t\t};\n\t\talignment?: Alignments;\n\t\t/**\n\t\t * identifier for value key in your charting data\n\t\t * defaults to value\n\t\t */\n\t\tvalueMapsTo?: string;\n\t\tsortFunction?: (a: any, b: any) => number;\n\t};\n}\n\n/**\n * options specific to gauge charts\n */\nexport interface GaugeChartOptions extends BaseChartOptions {\n\tgauge?: {\n\t\tarcWidth?: number;\n\t\tdeltaArrow?: {\n\t\t\tdirection?: ArrowDirections;\n\t\t\tsize?: Function;\n\t\t\tenabled: Boolean;\n\t\t};\n\t\tshowPercentageSymbol?: Boolean;\n\t\tstatus?: Statuses;\n\t\tdeltaFontSize?: Function;\n\t\tnumberSpacing?: number;\n\t\tnumberFormatter?: Function;\n\t\tvalueFontSize?: Function;\n\t\ttype?: GaugeTypes;\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to donut charts\n */\nexport interface DonutChartOptions extends PieChartOptions {\n\tdonut?: {\n\t\tcenter?: {\n\t\t\tlabel?: string;\n\t\t\tnumber?: number;\n\t\t\tnumberFontSize?: Function;\n\t\t\ttitleFontSize?: Function;\n\t\t\ttitleYPosition?: Function;\n\t\t\tnumberFormatter?: Function;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\nexport interface MeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tshowLabels?: boolean;\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t\tpeak?: number;\n\t\tstatus?: {\n\t\t\tranges: Array<{\n\t\t\t\trange: [number, number];\n\t\t\t\tstatus: Statuses;\n\t\t\t}>;\n\t\t};\n\t\theight?: number;\n\t\ttitle?: {\n\t\t\tpercentageIndicator?: {\n\t\t\t\t/**\n\t\t\t\t * rendering of the percentage value relative to the dataset within title\n\t\t\t\t */\n\t\t\t\tenabled?: boolean;\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface ProportionalMeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t};\n}\n\n/**\n * options specific to radar charts\n */\nexport interface RadarChartOptions extends BaseChartOptions {\n\tradar?: {\n\t\taxes: {\n\t\t\tangle: string;\n\t\t\tvalue: string;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to combo charts\n */\nexport interface ComboChartOptions extends AxisChartOptions {\n\tcomboChartTypes: Array<{\n\t\ttype: ChartTypes | any;\n\t\toptions?: object;\n\t\tcorrespondingDatasets: Array<string>;\n\t}>;\n}\n\n/*\n * options specific to treemap charts\n */\nexport interface TreemapChartOptions extends BaseChartOptions {}\n\n/*\n * options specific to tree charts\n */\nexport interface TreeChartOptions extends BaseChartOptions {\n\ttree?: {\n\t\ttype?: TreeTypes;\n\t\trootTitle?: string;\n\t};\n}\n\n/*\n * options specific to circle pack charts\n */\nexport interface CirclePackChartOptions extends BaseChartOptions {\n\tcirclePack?: {\n\t\tcircles: {\n\t\t\tfillOpacity: number;\n\t\t};\n\t\t// depth of nodes to display\n\t\thierachyLevel: number;\n\t\tpadding?: {\n\t\t\touter?: number;\n\t\t\tinner?: number;\n\t\t};\n\t};\n}\n\n/**\n * options specific to Alluvial charts\n */\nexport interface AlluvialChartOptions extends BaseChartOptions {\n\talluvial: {\n\t\tunits?: string;\n\t\t/**\n\t\t * List of nodes to draw\n\t\t */\n\t\tnodes: Array<{\n\t\t\tname: string;\n\t\t\tcategory?: string;\n\t\t}>;\n\t\t/**\n\t\t * Node alignment (Default is center)\n\t\t */\n\t\tnodeAlignment?: Alignments;\n\t\t/**\n\t\t * Set the node padding\n\t\t */\n\t\tnodePadding?: number;\n\t\t/**\n\t\t * Enable single color usage for lines\n\t\t */\n\t\tmonochrome?: boolean;\n\t};\n}\n\n/**\n * options specific to Heatmap charts\n */\nexport interface HeatmapChartOptions extends BaseChartOptions {\n\theatmap: {\n\t\t/**\n\t\t * Divider width state - will default to auto\n\t\t * No cell divider for cell dimensions less than 16\n\t\t */\n\t\tdivider?: {\n\t\t\tstate?: DividerStatus;\n\t\t};\n\t\t/**\n\t\t * customize color legend\n\t\t * enabled by default on select charts\n\t\t */\n\t\tcolorLegend?: {\n\t\t\t/**\n\t\t\t * Text to display beside or on top of the legend\n\t\t\t * Position is determined by text length\n\t\t\t */\n\t\t\ttitle?: string;\n\t\t\ttype: ColorLegendType;\n\t\t};\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"charts.js","sourceRoot":"","sources":["charts.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tGaugeTypes,\n\tStatuses,\n\tArrowDirections,\n\tAlignments,\n\tChartTypes,\n\tTreeTypes,\n\tDividerStatus,\n\tColorLegendType,\n\tChartTheme,\n} from './enums';\nimport {\n\tLegendOptions,\n\tTooltipOptions,\n\tGridOptions,\n\tAxesOptions,\n\tZoomBarsOptions,\n} from './index';\nimport { BarOptions, StackedBarOptions, ToolbarOptions } from './components';\nimport {\n\tAxisOptions,\n\tBinnedAxisOptions,\n\tTimeScaleOptions,\n} from './axis-scales';\n\n/**\n * Base chart options common to any chart\n */\nexport interface BaseChartOptions {\n\t/**\n\t * Optionally specify a title for the chart\n\t */\n\ttitle?: string;\n\t/**\n\t * boolean to disable animations (enabled by default)\n\t */\n\tanimations?: boolean;\n\t/**\n\t * boolean to prevent the container from resizing\n\t */\n\tresizable?: boolean;\n\t/**\n\t * Optionally specify a width for the chart\n\t */\n\twidth?: string;\n\t/**\n\t * Optionally specify a height for the chart\n\t */\n\theight?: string;\n\t/**\n\t * Optionally specify a theme for the chart\n\t */\n\ttheme?: ChartTheme;\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: TooltipOptions;\n\t/**\n\t * legend configuration\n\t */\n\tlegend?: LegendOptions;\n\t/**\n\t * toolbar configurations\n\t */\n\ttoolbar?: ToolbarOptions;\n\t/**\n\t * Optional function to determine whether is filled based on datasetLabel, label, and/or data\n\t */\n\tgetIsFilled?: (\n\t\tdatasetLabel: any,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultFilled?: boolean\n\t) => boolean;\n\t/**\n\t * Optional function to generate the fill color based on datasetLabel, label, and/or data\n\t */\n\tgetFillColor?: (\n\t\tgroup: string,\n\t\tlabel?: string,\n\t\tdata?: any,\n\t\tdefaultFillColor?: string\n\t) => string;\n\t/**\n\t * Optional function to generate the stroke color based on datasetLabel, label, and/or data\n\t * (note) - not all chart types support the stroke color (e.g. wordcloud)\n\t */\n\tgetStrokeColor?: (\n\t\tgroup: string,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultStrokeColor?: string\n\t) => string;\n\t/**\n\t * stylesheet options\n\t */\n\tstyle?: {\n\t\t/**\n\t\t * optional prefixing string for css classes (defaults to 'cc')\n\t\t */\n\t\tprefix?: string;\n\t};\n\t/**\n\t * options related to charting data\n\t */\n\tdata?: {\n\t\t/**\n\t\t * identifier for data groups\n\t\t */\n\t\tgroupMapsTo?: string;\n\t\t/**\n\t\t * used to simulate data loading in skeleton way\n\t\t */\n\t\tloading?: boolean;\n\t\t/**\n\t\t * options related to pre-selected data groups\n\t\t * Remains empty if every legend item is active or dataset doesn't have the data groups.\n\t\t */\n\t\tselectedGroups?: string[];\n\t};\n\t/**\n\t * options related to color scales\n\t */\n\tcolor?: {\n\t\t/**\n\t\t * e.g. { 'Dataset 1': 'blue' }\n\t\t */\n\t\tscale?: object;\n\t\t/**\n\t\t * use a carbon dataviz preset color palette\n\t\t * put the index (selection of which variant)\n\t\t */\n\t\tpairing?: {\n\t\t\t/**\n\t\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t\t */\n\t\t\tnumberOfVariants?: number;\n\t\t\t/**\n\t\t\t * the option number of the color paring\n\t\t\t */\n\t\t\toption?: number;\n\t\t};\n\t\t/*\n\t\t * options related to gradient\n\t\t * e.g. { enabled: true }\n\t\t */\n\t\tgradient?: {\n\t\t\tenabled?: boolean;\n\t\t\t/**\n\t\t\t * hex color array\n\t\t\t * e.g. ['#fff', '#000', ...]\n\t\t\t */\n\t\t\tcolors?: Array<String>;\n\t\t};\n\t};\n}\n\n/**\n * Options common to any chart with an axis\n */\nexport interface AxisChartOptions extends BaseChartOptions {\n\taxes?: AxesOptions<AxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * Options common to binned charts with an axis\n */\nexport interface BinnedAxisChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<BinnedAxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * options specific to boxplot charts\n */\nexport interface BoxplotChartOptions extends AxisChartOptions {}\n\n/**\n * options specific to bar charts\n */\nexport interface BarChartOptions extends AxisChartOptions {\n\tbars?: BarOptions;\n}\n\n/**\n * options specific to stacked bar charts\n */\nexport interface StackedBarChartOptions extends BarChartOptions {\n\tbars?: StackedBarOptions;\n}\n\n/**\n * options specific to scatter charts\n */\nexport interface ScatterChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the points\n\t */\n\tpoints?: {\n\t\t/**\n\t\t * sets the radius of the point\n\t\t */\n\t\tradius: number;\n\t\tfillOpacity?: number;\n\t\tfilled?: boolean;\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to lollipop charts\n */\nexport interface LollipopChartOptions extends ScatterChartOptions {}\n\n/**\n * options specific to bubble charts\n */\nexport interface BubbleChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bubbles\n\t */\n\tbubble?: {\n\t\t/**\n\t\t * the key to lookup in charting data for the bubble radius value\n\t\t */\n\t\tradiusMapsTo?: string;\n\t\t/**\n\t\t * options for what the bubble radius value maps to\n\t\t */\n\t\tradiusLabel?: string;\n\t\t/**\n\t\t * A function that would determine the range of the bubble radius to use\n\t\t * Returns an array with the 1st value being the min and the 2nd value being the max radius\n\t\t */\n\t\tradiusRange?: Function;\n\t\t/**\n\t\t * Opacity of the fills used within each circle\n\t\t */\n\t\tfillOpacity?: number;\n\t\t/**\n\t\t * enabled scatter dot or not\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to bullet charts\n */\nexport interface BulletChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bullets\n\t */\n\tbullet?: {\n\t\tperformanceAreaTitles?: string[];\n\t};\n}\n\n/**\n * options specific to histogram charts\n */\nexport interface HistogramChartOptions extends AxisChartOptions {\n\t/**\n\t * options related to bins\n\t */\n\tbins?: {\n\t\trangeLabel?: string;\n\t};\n}\n\n/**\n * options specific to line charts\n */\nexport interface LineChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n}\n\n/**\n * options specific to area charts\n */\nexport interface AreaChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n\t/**\n\t * options to bound the area of the chart\n\t */\n\tbounds?: {\n\t\tupperBoundMapsTo?: string;\n\t\tlowerBoundMapsTo?: string;\n\t};\n}\n\n/**\n * options specific to area charts\n */\nexport interface StackedAreaChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?: string | { name: string };\n}\n\n/**\n * options specific to world cloud charts\n */\nexport interface WordCloudChartTooltipOptions extends TooltipOptions {\n\t/** the label that shows up by the highlighted word in the tooltip */\n\twordLabel?: string;\n\t/** the label that shows up by the value of the highlighted word in the tooltip */\n\tvalueLabel?: string;\n}\n\nexport interface WorldCloudChartOptions extends BaseChartOptions {\n\twordCloud?: {\n\t\t/** what key in your charting data will the font sizes map to? */\n\t\tfontSizeMapsTo?: string;\n\t\t/** a function (chartSize, data) => {} that'll decide the range of font sizes, e.g. [10, 80] */\n\t\tfontSizeRange?: Function;\n\t\t/** what key in your charting data will the words map to? */\n\t\twordMapsTo?: string;\n\t};\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: WordCloudChartTooltipOptions;\n}\n\n/**\n * options specific to pie charts\n */\nexport interface PieChartOptions extends BaseChartOptions {\n\tpie?: {\n\t\tlabels?: {\n\t\t\tformatter?: Function;\n\t\t\tenabled?: Boolean;\n\t\t};\n\t\talignment?: Alignments;\n\t\t/**\n\t\t * identifier for value key in your charting data\n\t\t * defaults to value\n\t\t */\n\t\tvalueMapsTo?: string;\n\t\tsortFunction?: (a: any, b: any) => number;\n\t};\n}\n\n/**\n * options specific to gauge charts\n */\nexport interface GaugeChartOptions extends BaseChartOptions {\n\tgauge?: {\n\t\tarcWidth?: number;\n\t\tdeltaArrow?: {\n\t\t\tdirection?: ArrowDirections;\n\t\t\tsize?: Function;\n\t\t\tenabled: Boolean;\n\t\t};\n\t\tshowPercentageSymbol?: Boolean;\n\t\tstatus?: Statuses;\n\t\tdeltaFontSize?: Function;\n\t\tnumberSpacing?: number;\n\t\tnumberFormatter?: Function;\n\t\tvalueFontSize?: Function;\n\t\ttype?: GaugeTypes;\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to donut charts\n */\nexport interface DonutChartOptions extends PieChartOptions {\n\tdonut?: {\n\t\tcenter?: {\n\t\t\tlabel?: string;\n\t\t\tnumber?: number;\n\t\t\tnumberFontSize?: Function;\n\t\t\ttitleFontSize?: Function;\n\t\t\ttitleYPosition?: Function;\n\t\t\tnumberFormatter?: Function;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\nexport interface MeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tshowLabels?: boolean;\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t\tpeak?: number;\n\t\tstatus?: {\n\t\t\tranges: Array<{\n\t\t\t\trange: [number, number];\n\t\t\t\tstatus: Statuses;\n\t\t\t}>;\n\t\t};\n\t\theight?: number;\n\t\ttitle?: {\n\t\t\tpercentageIndicator?: {\n\t\t\t\t/**\n\t\t\t\t * rendering of the percentage value relative to the dataset within title\n\t\t\t\t */\n\t\t\t\tenabled?: boolean;\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface ProportionalMeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tproportional?: {\n\t\t\ttotal?: number;\n\t\t\tunit?: string;\n\t\t};\n\t};\n}\n\n/**\n * options specific to radar charts\n */\nexport interface RadarChartOptions extends BaseChartOptions {\n\tradar?: {\n\t\taxes: {\n\t\t\tangle: string;\n\t\t\tvalue: string;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to combo charts\n */\nexport interface ComboChartOptions extends AxisChartOptions {\n\tcomboChartTypes: Array<{\n\t\ttype: ChartTypes | any;\n\t\toptions?: object;\n\t\tcorrespondingDatasets: Array<string>;\n\t}>;\n}\n\n/*\n * options specific to treemap charts\n */\nexport interface TreemapChartOptions extends BaseChartOptions {}\n\n/*\n * options specific to tree charts\n */\nexport interface TreeChartOptions extends BaseChartOptions {\n\ttree?: {\n\t\ttype?: TreeTypes;\n\t\trootTitle?: string;\n\t};\n}\n\n/*\n * options specific to circle pack charts\n */\nexport interface CirclePackChartOptions extends BaseChartOptions {\n\tcirclePack?: {\n\t\tcircles: {\n\t\t\tfillOpacity: number;\n\t\t};\n\t\t// depth of nodes to display\n\t\thierachyLevel: number;\n\t\tpadding?: {\n\t\t\touter?: number;\n\t\t\tinner?: number;\n\t\t};\n\t};\n}\n\n/**\n * options specific to Alluvial charts\n */\nexport interface AlluvialChartOptions extends BaseChartOptions {\n\talluvial: {\n\t\tunits?: string;\n\t\t/**\n\t\t * List of nodes to draw\n\t\t */\n\t\tnodes: Array<{\n\t\t\tname: string;\n\t\t\tcategory?: string;\n\t\t}>;\n\t\t/**\n\t\t * Node alignment (Default is center)\n\t\t */\n\t\tnodeAlignment?: Alignments;\n\t\t/**\n\t\t * Set the node padding\n\t\t */\n\t\tnodePadding?: number;\n\t\t/**\n\t\t * Enable single color usage for lines\n\t\t */\n\t\tmonochrome?: boolean;\n\t};\n}\n\n/**\n * options specific to Heatmap charts\n */\nexport interface HeatmapChartOptions extends BaseChartOptions {\n\theatmap: {\n\t\t/**\n\t\t * Divider width state - will default to auto\n\t\t * No cell divider for cell dimensions less than 16\n\t\t */\n\t\tdivider?: {\n\t\t\tstate?: DividerStatus;\n\t\t};\n\t\t/**\n\t\t * customize color legend\n\t\t * enabled by default on select charts\n\t\t */\n\t\tcolorLegend?: {\n\t\t\t/**\n\t\t\t * Text to display beside or on top of the legend\n\t\t\t * Position is determined by text length\n\t\t\t */\n\t\t\ttitle?: string;\n\t\t\ttype: ColorLegendType;\n\t\t};\n\t};\n}\n"]}
|
package/interfaces/enums.d.ts
CHANGED
package/interfaces/enums.js
CHANGED
package/interfaces/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["enums.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,UAAU,CAAC;AACvC,MAAM,CAAC,IAAM,MAAM,GAAG,UAAU,CAAC;AAEjC,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACtB,4BAAa,CAAA;IACb,0BAAW,CAAA;AACZ,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACrB,
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["enums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X;AAJD,WAAY,aAAa;IACxB,0BAAS,CAAA;IACT,8BAAa,CAAA;IACb,4BAAW,CAAA;AACZ,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACrB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;AACxB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB","sourcesContent":["import * as EventEnums from './events';\nexport const Events = EventEnums;\n\nexport enum RenderTypes {\n\tHTML = 'html',\n\tSVG = 'svg',\n}\n\n/**\n * enum of all supported chart themes\n */\nexport enum ChartTheme {\n\tWHITE = 'white',\n\tG100 = 'g100',\n\tG90 = 'g90',\n\tG10 = 'g10',\n}\n\n/**\n * enum of all color classname types\n */\nexport enum ColorClassNameTypes {\n\tBACKGROUND = 'background',\n\tFILL = 'fill',\n\tSTROKE = 'stroke',\n\tTOOLTIP = 'tooltip',\n}\n\n/**\n * enum of all possible axis positions\n */\nexport enum AxisPositions {\n\tLEFT = 'left',\n\tRIGHT = 'right',\n\tTOP = 'top',\n\tBOTTOM = 'bottom',\n}\n\n/**\n * enum of all possible axis positions\n */\nexport enum ZoomBarTypes {\n\tGRAPH_VIEW = 'graph_view',\n\tSLIDER_VIEW = 'slider_view',\n}\n\n/**\n * enum of all possible truncation types\n */\nexport enum TruncationTypes {\n\tEND_LINE = 'end_line',\n\tMID_LINE = 'mid_line',\n\tFRONT_LINE = 'front_line',\n\tNONE = 'none',\n}\n\n/**\n * enum of all possible cartesian orientations\n * to be used for determining the orientation\n * of graphs being draw over\n * cartesian scales\n */\nexport enum CartesianOrientations {\n\tVERTICAL = 'vertical',\n\tHORIZONTAL = 'horizontal',\n}\n\n/**\n * enum of all possible scale types\n */\nexport enum ScaleTypes {\n\tTIME = 'time',\n\tLINEAR = 'linear',\n\tLOG = 'log',\n\tLABELS = 'labels',\n\tLABELS_RATIO = 'labels-ratio',\n}\n\n/**\n * enum of all possible legend positions\n */\nexport enum LegendPositions {\n\tRIGHT = 'right',\n\tLEFT = 'left',\n\tTOP = 'top',\n\tBOTTOM = 'bottom',\n}\n\n/**\n * enum of all possible alignments\n */\nexport enum Alignments {\n\tLEFT = 'left',\n\tCENTER = 'center',\n\tRIGHT = 'right',\n}\n\n/**\n * enum of all possible legend orientations\n */\nexport enum LegendOrientations {\n\tHORIZONTAL = 'horizontal',\n\tVERTICAL = 'vertical',\n}\n\n/**\n * enum of tree types for the tree chart\n */\nexport enum TreeTypes {\n\tTREE = 'tree',\n\tDENDROGRAM = 'dendrogram',\n}\n\n/**\n * enum of all possible layout directions\n */\nexport enum LayoutDirection {\n\tROW = 'row',\n\tCOLUMN = 'column',\n\tROW_REVERSE = 'row-reverse',\n\tCOLUMN_REVERSE = 'column-reverse',\n}\n\n/**\n * enum of all possible layout growth values\n */\nexport enum LayoutGrowth {\n\tFIXED = 'fixed',\n\tPREFERRED = 'preferred',\n\tSTRETCH = 'stretch',\n}\n\n/**\n * enum of all possible layout align-items values\n */\nexport enum LayoutAlignItems {\n\tCENTER = 'center',\n}\n\n/**\n * enum of all possible callout directions\n */\nexport enum CalloutDirections {\n\tLEFT = 'left',\n\tRIGHT = 'right',\n}\n\n/**\n * enum of all possible skeleton/empty state types\n */\nexport enum Skeletons {\n\tGRID = 'grid',\n\tVERT_OR_HORIZ = 'vertOrHoriz',\n\tPIE = 'pie',\n\tDONUT = 'donut',\n}\n\n/**\n * enum of all possible attributes used to aling text horizontally\n */\nexport enum TextAnchor {\n\tSTART = 'start',\n\tMIDDLE = 'middle',\n\tEND = 'end',\n}\n\n/**\n * enum of all possible attributes used to aling text vertically\n */\nexport enum DominantBaseline {\n\tBASELINE = 'baseline',\n\tMIDDLE = 'middle',\n\tHANGING = 'hanging',\n}\n\nexport enum GaugeTypes {\n\tSEMI = 'semi',\n\tFULL = 'full',\n}\n\n/**\n * enum of all possible callout directions\n */\nexport enum ArrowDirections {\n\tUP = 'up',\n\tDOWN = 'down',\n}\n\n/**\n * enum of carbon statuses\n */\nexport enum Statuses {\n\tSUCCESS = 'success',\n\tWARNING = 'warning',\n\tDANGER = 'danger',\n}\n\n/**\n * enum of axis ticks rotation\n */\nexport enum TickRotations {\n\tALWAYS = 'always',\n\tAUTO = 'auto',\n\tNEVER = 'never',\n}\n\n/**\n * enum of chartTypes that work with combo chart\n */\nexport enum ChartTypes {\n\tSCATTER = 'scatter',\n\tLINE = 'line',\n\tSIMPLE_BAR = 'simple-bar',\n\tSTACKED_BAR = 'stacked-bar',\n\tGROUPED_BAR = 'grouped-bar',\n\tAREA = 'area',\n\tSTACKED_AREA = 'stacked-area',\n}\n\n/**\n * enum of supported toolbar control types\n */\nexport enum ToolbarControlTypes {\n\tEXPORT_CSV = 'Export as CSV',\n\tEXPORT_PNG = 'Export as PNG',\n\tEXPORT_JPG = 'Export as JPG',\n\tZOOM_IN = 'Zoom in',\n\tZOOM_OUT = 'Zoom out',\n\tRESET_ZOOM = 'Reset zoom',\n\tMAKE_FULLSCREEN = 'Make fullscreen',\n\tSHOW_AS_DATATABLE = 'Show as data-table',\n\tCUSTOM = 'Custom',\n}\n\n/**\n * enum of title orientations for _vertical axes_\n */\nexport enum AxisTitleOrientations {\n\tLEFT = 'left',\n\tRIGHT = 'right',\n}\n\n/**\n * enum of legend item type\n */\nexport enum LegendItemType {\n\tCHECKBOX = 'checkbox',\n\tRADIUS = 'radius',\n\tAREA = 'area',\n\tSIZE = 'size',\n\tLINE = 'line',\n\tQUARTILE = 'quartile',\n\tZOOM = 'zoom',\n}\n\n/**\n * enum of color legend types\n */\nexport enum ColorLegendType {\n\tLINEAR = 'linear',\n\tQUANTIZE = 'quantize',\n}\n\n/**\n * enum of divider status for heatmap\n */\nexport enum DividerStatus {\n\tON = 'on',\n\tAUTO = 'auto',\n\tOFF = 'off',\n}\n\n/**\n * enum of axis flavor\n */\nexport enum AxisFlavor {\n\tDEFAULT = 'default',\n\tHOVERABLE = 'hoverable',\n}\n"]}
|
package/model/model.js
CHANGED
|
@@ -18,6 +18,7 @@ import { Events, ScaleTypes } from '../interfaces';
|
|
|
18
18
|
import { scaleOrdinal } from 'd3-scale';
|
|
19
19
|
import { stack, stackOffsetDiverging } from 'd3-shape';
|
|
20
20
|
import { histogram } from 'd3-array';
|
|
21
|
+
import { formatDateTillMilliSeconds } from "../services/time-series";
|
|
21
22
|
/** The charting model layer which includes mainly the chart data and options,
|
|
22
23
|
* as well as some misc. information to be shared among components */
|
|
23
24
|
var ChartModel = /** @class */ (function () {
|
|
@@ -253,6 +254,10 @@ var ChartModel = /** @class */ (function () {
|
|
|
253
254
|
else {
|
|
254
255
|
stackKeys = Tools.removeArrayDuplicates(displayData.map(function (datum) {
|
|
255
256
|
var domainIdentifier = _this.services.cartesianScales.getDomainIdentifier(datum);
|
|
257
|
+
// Use time value as key for Date object to avoid multiple data in the same second
|
|
258
|
+
if (datum[domainIdentifier] instanceof Date) {
|
|
259
|
+
return formatDateTillMilliSeconds(datum[domainIdentifier]);
|
|
260
|
+
}
|
|
256
261
|
return datum[domainIdentifier] &&
|
|
257
262
|
typeof datum[domainIdentifier].toString === 'function'
|
|
258
263
|
? datum[domainIdentifier].toString()
|
|
@@ -301,7 +306,9 @@ var ChartModel = /** @class */ (function () {
|
|
|
301
306
|
var domainIdentifier = _this.services.cartesianScales.getDomainIdentifier(datum);
|
|
302
307
|
return (datum[groupMapsTo] === dataGroupName &&
|
|
303
308
|
datum.hasOwnProperty(domainIdentifier) &&
|
|
304
|
-
datum[domainIdentifier]
|
|
309
|
+
(datum[domainIdentifier] instanceof Date
|
|
310
|
+
? formatDateTillMilliSeconds(datum[domainIdentifier]) === key
|
|
311
|
+
: datum[domainIdentifier].toString() === key));
|
|
305
312
|
});
|
|
306
313
|
var rangeIdentifier = _this.services.cartesianScales.getRangeIdentifier(correspondingValues);
|
|
307
314
|
correspondingValues[dataGroupName] = correspondingDatum
|
package/model/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot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C,WAAW,CAC5C,IAAI,CAAC,UAAU,EAAE,EACjB,OAAO,EACP,SAAS,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,AAv2BD,IAu2BC","sourcesContent":["// Internal Imports\nimport * as Configuration from '../configuration';\nimport { histogram as histogramConfigs } from '../configuration-non-customizable';\n\nimport { Tools } from '../tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from '../interfaces';\n\n// D3\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack, stackOffsetDiverging } from 'd3-shape';\nimport { histogram } from 'd3-array';\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\tprotected services: any;\n\n\t// Internal Model state\n\tprotected state: any = {\n\t\toptions: {},\n\t};\n\n\t// Data labels\n\t/**\n\t * A list of all the data groups that have existed within the lifetime of the chart\n\t * @type string[]\n\t */\n\tprotected allDataGroups: string[];\n\n\t// Fill scales & fill related objects\n\tprotected colorScale: any = {};\n\n\tprotected colorClassNames: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetAllDataFromDomain(groups?) {\n\t\tif (!this.getData()) {\n\t\t\treturn null;\n\t\t}\n\t\tconst options = this.getOptions();\n\t\t// Remove datasets that have been disabled\n\t\tlet allData = this.getData();\n\t\tconst dataGroups = this.getDataGroups();\n\t\tconst { groupMapsTo } = Tools.getProperty(options, 'data');\n\t\tconst axesOptions = Tools.getProperty(options, 'axes');\n\n\t\t// filter out the groups that are irrelevant to the component\n\t\tif (groups) {\n\t\t\tallData = allData.filter((item) =>\n\t\t\t\tgroups.includes(item[groupMapsTo])\n\t\t\t);\n\t\t}\n\n\t\tif (axesOptions) {\n\t\t\tObject.keys(axesOptions).forEach((axis) => {\n\t\t\t\tconst mapsTo = axesOptions[axis].mapsTo;\n\t\t\t\tconst scaleType = axesOptions[axis].scaleType;\n\t\t\t\t// make sure linear/log values are numbers\n\t\t\t\tif (\n\t\t\t\t\tscaleType === ScaleTypes.LINEAR ||\n\t\t\t\t\tscaleType === ScaleTypes.LOG\n\t\t\t\t) {\n\t\t\t\t\tallData = allData.map((datum) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...datum,\n\t\t\t\t\t\t\t[mapsTo]:\n\t\t\t\t\t\t\t\tdatum[mapsTo] === null\n\t\t\t\t\t\t\t\t\t? datum[mapsTo]\n\t\t\t\t\t\t\t\t\t: Number(datum[mapsTo]),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Check for custom domain\n\t\t\t\tif (mapsTo && axesOptions[axis].domain) {\n\t\t\t\t\tif (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tallData = allData.filter((datum) =>\n\t\t\t\t\t\t\taxesOptions[axis].domain.includes(datum[mapsTo])\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [start, end] = axesOptions[axis].domain;\n\t\t\t\t\t\t// Filter out data outside domain if that datapoint is using that axis (has mapsTo property)\n\t\t\t\t\t\tallData = allData.filter(\n\t\t\t\t\t\t\t(datum) =>\n\t\t\t\t\t\t\t\t!(mapsTo in datum) ||\n\t\t\t\t\t\t\t\t(datum[mapsTo] >= start && datum[mapsTo] <= end)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn allData.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(group) => group.name === datum[groupMapsTo]\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart\n\t * @param groups the included datasets for the particular chart\n\t */\n\tgetDisplayData(groups?) {\n\t\tif (!this.get('data')) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst allDataFromDomain = this.getAllDataFromDomain(groups);\n\n\t\treturn allDataFromDomain.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(dataGroup) =>\n\t\t\t\t\tdataGroup.name === datum[groupMapsTo] &&\n\t\t\t\t\tdataGroup.status === ACTIVE\n\t\t\t);\n\t\t});\n\t}\n\n\tgetData() {\n\t\treturn this.get('data');\n\t}\n\n\tisDataEmpty() {\n\t\treturn !this.getData().length;\n\t}\n\n\t/**\n\t *\n\t * @param newData The new raw data to be set\n\t */\n\tsetData(newData) {\n\t\tconst sanitizedData = this.sanitize(Tools.clone(newData));\n\t\tconst dataGroups = this.generateDataGroups(sanitizedData);\n\n\t\tthis.set({\n\t\t\tdata: sanitizedData,\n\t\t\tdataGroups,\n\t\t});\n\n\t\treturn sanitizedData;\n\t}\n\n\tgetDataGroups(groups?) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'data',\n\t\t\t'loading'\n\t\t);\n\n\t\t// No data should be displayed while data is still loading\n\t\tif (isDataLoading) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// if its a combo chart, the specific chart will pass the model the groups it needs\n\t\tif (groups) {\n\t\t\treturn this.get('dataGroups').filter((dataGroup) =>\n\t\t\t\tgroups.includes(dataGroup.name)\n\t\t\t);\n\t\t}\n\t\treturn this.get('dataGroups');\n\t}\n\n\tgetActiveDataGroups(groups?) {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups(groups).filter(\n\t\t\t(dataGroup) => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames(groups?) {\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\treturn dataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames(groups?) {\n\t\tconst activeDataGroups = this.getActiveDataGroups(groups);\n\t\treturn activeDataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tprivate aggregateBinDataByGroup(bin) {\n\t\treturn Tools.groupBy(bin, 'group');\n\t}\n\n\tgetBinConfigurations() {\n\t\t// Manipulate data and options for Histogram\n\t\tconst data = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\n\t\tconst mainXPos = this.services.cartesianScales.getMainXAxisPosition();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\n\t\tconst axisOptions = options.axes[mainXPos];\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst { bins: axisBins = histogramConfigs.defaultBins } = axisOptions;\n\t\tconst areBinsDefined = Array.isArray(axisBins);\n\n\t\t// Get Histogram bins\n\t\tconst bins = histogram()\n\t\t\t.value((d) => d[domainIdentifier])\n\t\t\t.thresholds(axisBins)(data);\n\n\t\tif (!areBinsDefined) {\n\t\t\t// If bins are not defined by user\n\t\t\tconst binsWidth = bins[0].x1 - bins[0].x0;\n\t\t\t// Set last bin width as the others\n\t\t\tbins[bins.length - 1].x1 = +bins[bins.length - 1].x0 + binsWidth;\n\t\t} else {\n\t\t\t// Set last bin end as the last user defined one\n\t\t\tbins[bins.length - 1].x1 = axisBins[axisBins.length - 1];\n\t\t}\n\n\t\tconst binsDomain = areBinsDefined\n\t\t\t? [axisBins[0], axisBins[axisBins.length - 1]]\n\t\t\t: [bins[0].x0, bins[bins.length - 1].x1];\n\n\t\t// Get all groups\n\t\tconst groupsKeys = Array.from(new Set(data.map((d) => d[groupMapsTo])));\n\n\t\tconst histogramData = [];\n\n\t\t// Group data by bin\n\t\tbins.forEach((bin) => {\n\t\t\tconst key = `${bin.x0}-${bin.x1}`;\n\t\t\tconst aggregateDataByGroup = this.aggregateBinDataByGroup(bin);\n\n\t\t\tgroupsKeys.forEach((group: string) => {\n\t\t\t\t// For each dataset put a bin with value 0 if not exist\n\t\t\t\t// (Scale X won't change when changing showed datasets)\n\t\t\t\thistogramData.push({\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: aggregateDataByGroup[group] || 0,\n\t\t\t\t\tbin: bin.x0,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn {\n\t\t\tbins,\n\t\t\tbinsDomain,\n\t\t};\n\t}\n\n\tgetBinnedStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getActiveDataGroupNames();\n\n\t\tconst { bins } = this.getBinConfigurations();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tbins,\n\t\t});\n\n\t\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\tgetGroupedData(groups?) {\n\t\tconst displayData = this.getDisplayData(groups);\n\t\tconst groupedData = {};\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\tdisplayData.map((datum) => {\n\t\t\tconst group = datum[groupMapsTo];\n\t\t\tif (\n\t\t\t\tgroupedData[group] !== null &&\n\t\t\t\tgroupedData[group] !== undefined\n\t\t\t) {\n\t\t\t\tgroupedData[group].push(datum);\n\t\t\t} else {\n\t\t\t\tgroupedData[group] = [datum];\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(groupedData).map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tdata: groupedData[groupName],\n\t\t}));\n\t}\n\n\tgetStackKeys(\n\t\t{ bins = null, groups = null } = { bins: null, groups: null }\n\t) {\n\t\tconst options = this.getOptions();\n\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tlet stackKeys;\n\t\tif (bins) {\n\t\t\tstackKeys = bins.map((bin) => `${bin.x0}-${bin.x1}`);\n\t\t} else {\n\t\t\tstackKeys = Tools.removeArrayDuplicates(\n\t\t\t\tdisplayData.map((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn datum[domainIdentifier] &&\n\t\t\t\t\t\ttypeof datum[domainIdentifier].toString === 'function'\n\t\t\t\t\t\t? datum[domainIdentifier].toString()\n\t\t\t\t\t\t: datum[domainIdentifier];\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst axisPosition = this.services.cartesianScales.domainAxisPosition;\n\t\tconst scaleType = options.axes[axisPosition].scaleType;\n\n\t\t// Sort keys\n\t\tif (scaleType === ScaleTypes.TIME) {\n\t\t\tstackKeys.sort((a: any, b: any) => {\n\t\t\t\tconst dateA: any = new Date(a);\n\t\t\t\tconst dateB: any = new Date(b);\n\n\t\t\t\treturn dateA - dateB;\n\t\t\t});\n\t\t} else if (\n\t\t\tscaleType === ScaleTypes.LOG ||\n\t\t\tscaleType === ScaleTypes.LINEAR\n\t\t) {\n\t\t\tstackKeys.sort((a: any, b: any) => a - b);\n\t\t}\n\n\t\treturn stackKeys;\n\t}\n\n\tgetDataValuesGroupedByKeys({ bins = null, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\tconst stackKeys = this.getStackKeys({ bins, groups });\n\t\tif (bins) {\n\t\t\treturn stackKeys.map((key) => {\n\t\t\t\tconst [binStart, binEnd] = key.split('-');\n\n\t\t\t\tconst correspondingValues = { x0: binStart, x1: binEnd };\n\t\t\t\tconst correspondingBin = bins.find(\n\t\t\t\t\t(bin) => bin.x0.toString() === binStart.toString()\n\t\t\t\t);\n\n\t\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\t\tcorrespondingValues[\n\t\t\t\t\t\tdataGroupName\n\t\t\t\t\t] = correspondingBin.filter(\n\t\t\t\t\t\t(binItem) => binItem[groupMapsTo] === dataGroupName\n\t\t\t\t\t).length;\n\t\t\t\t});\n\n\t\t\t\treturn correspondingValues;\n\t\t\t}) as any;\n\t\t}\n\n\t\treturn stackKeys.map((key) => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\tconst correspondingDatum = displayData.find((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum.hasOwnProperty(domainIdentifier) &&\n\t\t\t\t\t\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\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null, divergent = false }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Get only active data groups so non-active data groups are not rendered\n\t\t// on legend item click\n\t\tconst dataGroupNames = this.getActiveDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tgroups,\n\t\t});\n\n\t\tif (percentage) {\n\t\t\tconst maxByKey = Tools.fromPairs(\n\t\t\t\tdataValuesGroupedByKeys.map((d: any) => [d.sharedStackKey, 0])\n\t\t\t);\n\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tmaxByKey[d.sharedStackKey] += d[name];\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// cycle through data values to get percentage\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tif (maxByKey[d.sharedStackKey]) {\n\t\t\t\t\t\td[name] = (d[name] / maxByKey[d.sharedStackKey]) * 100;\n\t\t\t\t\t} else {\n\t\t\t\t\t\td[name] = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst stackToUse = divergent\n\t\t\t? stack().offset(stackOffsetDiverging)\n\t\t\t: stack();\n\n\t\treturn stackToUse\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, configs?: any) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\t\tconst newConfig = Object.assign(\n\t\t\t{ skipUpdate: false, animate: true }, // default configs\n\t\t\tconfigs\n\t\t);\n\t\tif (!newConfig.skipUpdate) {\n\t\t\tthis.update(newConfig.animate);\n\t\t}\n\t}\n\n\tget(property?: string) {\n\t\tif (property) {\n\t\t\treturn this.state[property];\n\t\t} else {\n\t\t\treturn this.state;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param newOptions New options to be set\n\t */\n\tsetOptions(newOptions) {\n\t\tconst options = this.getOptions();\n\t\tTools.updateLegendAdditionalItems(options, newOptions);\n\n\t\tthis.set({\n\t\t\toptions: Tools.merge(options, newOptions),\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate(animate = true) {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setCustomColorScale();\n\t\tthis.setColorClassNames();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE, { animate });\n\t}\n\n\t/*\n\t * Data labels\n\t */\n\ttoggleDataLabel(changedLabel: string) {\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tconst hasDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\n\t\t// If there are deactivated items, toggle \"changedLabel\"\n\t\tif (hasDeactivatedItems) {\n\t\t\t// If the only active item is being toggled\n\t\t\t// Activate all items\n\t\t\tif (\n\t\t\t\tactiveItems.length === 1 &&\n\t\t\t\tactiveItems[0].name === changedLabel\n\t\t\t) {\n\t\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\t\tdataGroups[i].status = ACTIVE;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst indexToChange = dataGroups.findIndex(\n\t\t\t\t\t(group) => group.name === changedLabel\n\t\t\t\t);\n\t\t\t\tdataGroups[indexToChange].status =\n\t\t\t\t\tdataGroups[indexToChange].status === DISABLED\n\t\t\t\t\t\t? ACTIVE\n\t\t\t\t\t\t: DISABLED;\n\t\t\t}\n\t\t} else {\n\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\tdataGroups[i].status =\n\t\t\t\t\tgroup.name === changedLabel ? ACTIVE : DISABLED;\n\t\t\t});\n\t\t}\n\n\t\t// Updates selected groups\n\t\tconst updatedActiveItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\t\tconst options = this.getOptions();\n\n\t\tconst hasUpdatedDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\n\t\t// If there are deactivated items, map the item name into selected groups\n\t\tif (hasUpdatedDeactivatedItems) {\n\t\t\toptions.data.selectedGroups = updatedActiveItems.map(\n\t\t\t\t(activeItem) => activeItem.name\n\t\t\t);\n\t\t} else {\n\t\t\t// If every item is active, clear array\n\t\t\toptions.data.selectedGroups = [];\n\t\t}\n\n\t\t// dispatch legend filtering event with the status of all the dataLabels\n\t\tthis.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {\n\t\t\tdataGroups,\n\t\t});\n\n\t\t// Update model\n\t\tthis.set({\n\t\t\tdataGroups,\n\t\t});\n\t}\n\n\t/**\n\t * Should the data point be filled?\n\t * @param group\n\t * @param key\n\t * @param value\n\t * @param defaultFilled the default for this chart\n\t */\n\tgetIsFilled(group: any, key?: any, data?: any, defaultFilled?: boolean) {\n\t\tconst options = this.getOptions();\n\t\tif (options.getIsFilled) {\n\t\t\treturn options.getIsFilled(group, key, data, defaultFilled);\n\t\t} else {\n\t\t\treturn defaultFilled;\n\t\t}\n\t}\n\n\tgetFillColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultFillColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getFillColor) {\n\t\t\treturn options.getFillColor(group, key, data, defaultFillColor);\n\t\t} else {\n\t\t\treturn defaultFillColor;\n\t\t}\n\t}\n\n\tgetStrokeColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultStrokeColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getStrokeColor) {\n\t\t\treturn options.getStrokeColor(group, key, data, defaultStrokeColor);\n\t\t} else {\n\t\t\treturn defaultStrokeColor;\n\t\t}\n\t}\n\n\tisUserProvidedColorScaleValid() {\n\t\tconst userProvidedScale = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'scale'\n\t\t);\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tif (\n\t\t\tuserProvidedScale == null ||\n\t\t\tObject.keys(userProvidedScale).length == 0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn dataGroups.some((dataGroup) =>\n\t\t\tObject.keys(userProvidedScale).includes(dataGroup.name)\n\t\t);\n\t}\n\n\tgetColorClassName(configs: {\n\t\tclassNameTypes: ColorClassNameTypes[];\n\t\tdataGroupName?: string;\n\t\toriginalClassName?: string;\n\t}) {\n\t\tconst colorPairingTag = this.colorClassNames(configs.dataGroupName);\n\t\tlet className = configs.originalClassName;\n\t\tconfigs.classNameTypes.forEach(\n\t\t\t(type) =>\n\t\t\t\t(className = configs.originalClassName\n\t\t\t\t\t? `${className} ${type}-${colorPairingTag}`\n\t\t\t\t\t: `${type}-${colorPairingTag}`)\n\t\t);\n\n\t\treturn className;\n\t}\n\n\t/**\n\t * For charts that might hold an associated status for their dataset\n\t */\n\tgetStatus() {\n\t\treturn null;\n\t}\n\n\tgetAllDataGroupsNames() {\n\t\treturn this.allDataGroups;\n\t}\n\n\t/**\n\t * Converts data provided in the older format to tabular\n\t *\n\t */\n\tprotected transformToTabularData(data) {\n\t\tconsole.warn(\n\t\t\t\"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format\"\n\t\t);\n\t\tconst tabularData = [];\n\t\tconst { datasets, labels } = data;\n\n\t\t// Loop through all datasets\n\t\tdatasets.forEach((dataset) => {\n\t\t\t// Update each data point to the new format\n\t\t\tdataset.data.forEach((datum, i) => {\n\t\t\t\tlet group;\n\n\t\t\t\tconst datasetLabel = Tools.getProperty(dataset, 'label');\n\t\t\t\tif (datasetLabel === null) {\n\t\t\t\t\tconst correspondingLabel = Tools.getProperty(labels, i);\n\t\t\t\t\tif (correspondingLabel) {\n\t\t\t\t\t\tgroup = correspondingLabel;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgroup = 'Ungrouped';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgroup = datasetLabel;\n\t\t\t\t}\n\n\t\t\t\tconst updatedDatum = {\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey: labels[i],\n\t\t\t\t};\n\n\t\t\t\tif (isNaN(datum)) {\n\t\t\t\t\tupdatedDatum['value'] = datum.value;\n\t\t\t\t\tupdatedDatum['date'] = datum.date;\n\t\t\t\t} else {\n\t\t\t\t\tupdatedDatum['value'] = datum;\n\t\t\t\t}\n\n\t\t\t\ttabularData.push(updatedDatum);\n\t\t\t});\n\t\t});\n\n\t\treturn tabularData;\n\t}\n\n\tgetTabularDataArray() {\n\t\treturn [];\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tthis.services.files.downloadCSV(csvString, 'myChart.csv');\n\t}\n\n\tprotected getTabularData(data) {\n\t\t// if data is not an array\n\t\tif (!Array.isArray(data)) {\n\t\t\treturn this.transformToTabularData(data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\tdata = this.getTabularData(data);\n\n\t\treturn data;\n\t}\n\n\t/*\n\t * Data groups\n\t */\n\tprotected updateAllDataGroups() {\n\t\t// allDataGroups is used to generate a color scale that applies\n\t\t// to all the groups. Now when the data updates, you might remove a group,\n\t\t// and then bring it back in a newer data update, therefore\n\t\t// the order of the groups in allDataGroups matters so that you'd never\n\t\t// have an incorrect color assigned to a group.\n\n\t\t// Also, a new group should only be added to allDataGroups if\n\t\t// it doesn't currently exist\n\n\t\tif (!this.allDataGroups) {\n\t\t\tthis.allDataGroups = this.getDataGroupNames();\n\t\t} else {\n\t\t\t// Loop through current data groups\n\t\t\tthis.getDataGroupNames().forEach((dataGroupName) => {\n\t\t\t\t// If group name hasn't been stored yet, store it\n\t\t\t\tif (this.allDataGroups.indexOf(dataGroupName) === -1) {\n\t\t\t\t\tthis.allDataGroups.push(dataGroupName);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected generateDataGroups(data) {\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst options = this.getOptions();\n\n\t\tconst uniqueDataGroups = Tools.removeArrayDuplicates(\n\t\t\tdata.map((datum) => datum[groupMapsTo])\n\t\t);\n\n\t\t// check if selectedGroups can be applied to chart with current data groups\n\t\tif (options.data.selectedGroups.length) {\n\t\t\tconst hasAllSelectedGroups = options.data.selectedGroups.every(\n\t\t\t\t(groupName) => uniqueDataGroups.includes(groupName)\n\t\t\t);\n\t\t\tif (!hasAllSelectedGroups) {\n\t\t\t\toptions.data.selectedGroups = [];\n\t\t\t}\n\t\t}\n\n\t\t// Get group status based on items in selected groups\n\t\tconst getStatus = (groupName) =>\n\t\t\t!options.data.selectedGroups.length ||\n\t\t\toptions.data.selectedGroups.includes(groupName)\n\t\t\t\t? ACTIVE\n\t\t\t\t: DISABLED;\n\n\t\treturn uniqueDataGroups.map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tstatus: getStatus(groupName),\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setCustomColorScale() {\n\t\tif (!this.isUserProvidedColorScaleValid()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, 'color', 'scale');\n\n\t\tObject.keys(userProvidedScale).forEach((dataGroup) => {\n\t\t\tif (!this.allDataGroups.includes(dataGroup)) {\n\t\t\t\tconsole.warn(`\"${dataGroup}\" does not exist in data groups.`);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Go through allDataGroups. If a data group has a color value provided\n\t\t * by the user, add that to the color range\n\t\t */\n\t\tconst providedDataGroups = this.allDataGroups.filter(\n\t\t\t(dataGroup) => userProvidedScale[dataGroup]\n\t\t);\n\n\t\tprovidedDataGroups.forEach(\n\t\t\t(dataGroup) =>\n\t\t\t\t(this.colorScale[dataGroup] = userProvidedScale[dataGroup])\n\t\t);\n\t}\n\n\t/*\n\t * Color palette\n\t */\n\tprotected setColorClassNames() {\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\n\t\t// Check if user has defined numberOfVariants (differ from given data)\n\t\tlet numberOfVariants = Tools.getProperty(\n\t\t\tcolorPairingOptions,\n\t\t\t'numberOfVariants'\n\t\t);\n\t\tif (!numberOfVariants || numberOfVariants < this.allDataGroups.length) {\n\t\t\tnumberOfVariants = this.allDataGroups.length;\n\t\t}\n\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// If number of dataGroups is greater than 5, user 14-color palette\n\t\tconst numberOfColors = numberOfVariants > 5 ? 14 : numberOfVariants;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) =>\n\t\t\t\t`${numberOfColors}-${pairingOption}-${(index % 14) + 1}`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["model.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MA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from '../configuration';\nimport { histogram as histogramConfigs } from '../configuration-non-customizable';\n\nimport { Tools } from '../tools';\nimport { Events, ScaleTypes, ColorClassNameTypes } from '../interfaces';\n\n// D3\nimport { scaleOrdinal } from 'd3-scale';\nimport { stack, stackOffsetDiverging } from 'd3-shape';\nimport { histogram } from 'd3-array';\nimport { formatDateTillMilliSeconds } from \"../services/time-series\";\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class ChartModel {\n\tprotected services: any;\n\n\t// Internal Model state\n\tprotected state: any = {\n\t\toptions: {},\n\t};\n\n\t// Data labels\n\t/**\n\t * A list of all the data groups that have existed within the lifetime of the chart\n\t * @type string[]\n\t */\n\tprotected allDataGroups: string[];\n\n\t// Fill scales & fill related objects\n\tprotected colorScale: any = {};\n\n\tprotected colorClassNames: any = {};\n\n\tconstructor(services: any) {\n\t\tthis.services = services;\n\t}\n\n\tgetAllDataFromDomain(groups?) {\n\t\tif (!this.getData()) {\n\t\t\treturn null;\n\t\t}\n\t\tconst options = this.getOptions();\n\t\t// Remove datasets that have been disabled\n\t\tlet allData = this.getData();\n\t\tconst dataGroups = this.getDataGroups();\n\t\tconst { groupMapsTo } = Tools.getProperty(options, 'data');\n\t\tconst axesOptions = Tools.getProperty(options, 'axes');\n\n\t\t// filter out the groups that are irrelevant to the component\n\t\tif (groups) {\n\t\t\tallData = allData.filter((item) =>\n\t\t\t\tgroups.includes(item[groupMapsTo])\n\t\t\t);\n\t\t}\n\n\t\tif (axesOptions) {\n\t\t\tObject.keys(axesOptions).forEach((axis) => {\n\t\t\t\tconst mapsTo = axesOptions[axis].mapsTo;\n\t\t\t\tconst scaleType = axesOptions[axis].scaleType;\n\t\t\t\t// make sure linear/log values are numbers\n\t\t\t\tif (\n\t\t\t\t\tscaleType === ScaleTypes.LINEAR ||\n\t\t\t\t\tscaleType === ScaleTypes.LOG\n\t\t\t\t) {\n\t\t\t\t\tallData = allData.map((datum) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...datum,\n\t\t\t\t\t\t\t[mapsTo]:\n\t\t\t\t\t\t\t\tdatum[mapsTo] === null\n\t\t\t\t\t\t\t\t\t? datum[mapsTo]\n\t\t\t\t\t\t\t\t\t: Number(datum[mapsTo]),\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Check for custom domain\n\t\t\t\tif (mapsTo && axesOptions[axis].domain) {\n\t\t\t\t\tif (scaleType === ScaleTypes.LABELS) {\n\t\t\t\t\t\tallData = allData.filter((datum) =>\n\t\t\t\t\t\t\taxesOptions[axis].domain.includes(datum[mapsTo])\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [start, end] = axesOptions[axis].domain;\n\t\t\t\t\t\t// Filter out data outside domain if that datapoint is using that axis (has mapsTo property)\n\t\t\t\t\t\tallData = allData.filter(\n\t\t\t\t\t\t\t(datum) =>\n\t\t\t\t\t\t\t\t!(mapsTo in datum) ||\n\t\t\t\t\t\t\t\t(datum[mapsTo] >= start && datum[mapsTo] <= end)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn allData.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(group) => group.name === datum[groupMapsTo]\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart\n\t * @param groups the included datasets for the particular chart\n\t */\n\tgetDisplayData(groups?) {\n\t\tif (!this.get('data')) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst allDataFromDomain = this.getAllDataFromDomain(groups);\n\n\t\treturn allDataFromDomain.filter((datum) => {\n\t\t\treturn dataGroups.find(\n\t\t\t\t(dataGroup) =>\n\t\t\t\t\tdataGroup.name === datum[groupMapsTo] &&\n\t\t\t\t\tdataGroup.status === ACTIVE\n\t\t\t);\n\t\t});\n\t}\n\n\tgetData() {\n\t\treturn this.get('data');\n\t}\n\n\tisDataEmpty() {\n\t\treturn !this.getData().length;\n\t}\n\n\t/**\n\t *\n\t * @param newData The new raw data to be set\n\t */\n\tsetData(newData) {\n\t\tconst sanitizedData = this.sanitize(Tools.clone(newData));\n\t\tconst dataGroups = this.generateDataGroups(sanitizedData);\n\n\t\tthis.set({\n\t\t\tdata: sanitizedData,\n\t\t\tdataGroups,\n\t\t});\n\n\t\treturn sanitizedData;\n\t}\n\n\tgetDataGroups(groups?) {\n\t\tconst isDataLoading = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'data',\n\t\t\t'loading'\n\t\t);\n\n\t\t// No data should be displayed while data is still loading\n\t\tif (isDataLoading) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// if its a combo chart, the specific chart will pass the model the groups it needs\n\t\tif (groups) {\n\t\t\treturn this.get('dataGroups').filter((dataGroup) =>\n\t\t\t\tgroups.includes(dataGroup.name)\n\t\t\t);\n\t\t}\n\t\treturn this.get('dataGroups');\n\t}\n\n\tgetActiveDataGroups(groups?) {\n\t\tconst { ACTIVE } = Configuration.legend.items.status;\n\n\t\treturn this.getDataGroups(groups).filter(\n\t\t\t(dataGroup) => dataGroup.status === ACTIVE\n\t\t);\n\t}\n\n\tgetDataGroupNames(groups?) {\n\t\tconst dataGroups = this.getDataGroups(groups);\n\t\treturn dataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tgetActiveDataGroupNames(groups?) {\n\t\tconst activeDataGroups = this.getActiveDataGroups(groups);\n\t\treturn activeDataGroups.map((dataGroup) => dataGroup.name);\n\t}\n\n\tprivate aggregateBinDataByGroup(bin) {\n\t\treturn Tools.groupBy(bin, 'group');\n\t}\n\n\tgetBinConfigurations() {\n\t\t// Manipulate data and options for Histogram\n\t\tconst data = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\n\t\tconst mainXPos = this.services.cartesianScales.getMainXAxisPosition();\n\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier();\n\n\t\tconst axisOptions = options.axes[mainXPos];\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst { bins: axisBins = histogramConfigs.defaultBins } = axisOptions;\n\t\tconst areBinsDefined = Array.isArray(axisBins);\n\n\t\t// Get Histogram bins\n\t\tconst bins = histogram()\n\t\t\t.value((d) => d[domainIdentifier])\n\t\t\t.thresholds(axisBins)(data);\n\n\t\tif (!areBinsDefined) {\n\t\t\t// If bins are not defined by user\n\t\t\tconst binsWidth = bins[0].x1 - bins[0].x0;\n\t\t\t// Set last bin width as the others\n\t\t\tbins[bins.length - 1].x1 = +bins[bins.length - 1].x0 + binsWidth;\n\t\t} else {\n\t\t\t// Set last bin end as the last user defined one\n\t\t\tbins[bins.length - 1].x1 = axisBins[axisBins.length - 1];\n\t\t}\n\n\t\tconst binsDomain = areBinsDefined\n\t\t\t? [axisBins[0], axisBins[axisBins.length - 1]]\n\t\t\t: [bins[0].x0, bins[bins.length - 1].x1];\n\n\t\t// Get all groups\n\t\tconst groupsKeys = Array.from(new Set(data.map((d) => d[groupMapsTo])));\n\n\t\tconst histogramData = [];\n\n\t\t// Group data by bin\n\t\tbins.forEach((bin) => {\n\t\t\tconst key = `${bin.x0}-${bin.x1}`;\n\t\t\tconst aggregateDataByGroup = this.aggregateBinDataByGroup(bin);\n\n\t\t\tgroupsKeys.forEach((group: string) => {\n\t\t\t\t// For each dataset put a bin with value 0 if not exist\n\t\t\t\t// (Scale X won't change when changing showed datasets)\n\t\t\t\thistogramData.push({\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue: aggregateDataByGroup[group] || 0,\n\t\t\t\t\tbin: bin.x0,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn {\n\t\t\tbins,\n\t\t\tbinsDomain,\n\t\t};\n\t}\n\n\tgetBinnedStackedData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst dataGroupNames = this.getActiveDataGroupNames();\n\n\t\tconst { bins } = this.getBinConfigurations();\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tbins,\n\t\t});\n\n\t\treturn stack()\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\tgetGroupedData(groups?) {\n\t\tconst displayData = this.getDisplayData(groups);\n\t\tconst groupedData = {};\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\n\t\tdisplayData.map((datum) => {\n\t\t\tconst group = datum[groupMapsTo];\n\t\t\tif (\n\t\t\t\tgroupedData[group] !== null &&\n\t\t\t\tgroupedData[group] !== undefined\n\t\t\t) {\n\t\t\t\tgroupedData[group].push(datum);\n\t\t\t} else {\n\t\t\t\tgroupedData[group] = [datum];\n\t\t\t}\n\t\t});\n\n\t\treturn Object.keys(groupedData).map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tdata: groupedData[groupName],\n\t\t}));\n\t}\n\n\tgetStackKeys(\n\t\t{ bins = null, groups = null } = { bins: null, groups: null }\n\t) {\n\t\tconst options = this.getOptions();\n\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tlet stackKeys;\n\t\tif (bins) {\n\t\t\tstackKeys = bins.map((bin) => `${bin.x0}-${bin.x1}`);\n\t\t} else {\n\t\t\tstackKeys = Tools.removeArrayDuplicates(\n\t\t\t\tdisplayData.map((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\t// Use time value as key for Date object to avoid multiple data in the same second\n\t\t\t\t\tif (datum[domainIdentifier] instanceof Date) {\n\t\t\t\t\t\treturn formatDateTillMilliSeconds(datum[domainIdentifier]);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn datum[domainIdentifier] &&\n\t\t\t\t\t\ttypeof datum[domainIdentifier].toString === 'function'\n\t\t\t\t\t\t? datum[domainIdentifier].toString()\n\t\t\t\t\t\t: datum[domainIdentifier];\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst axisPosition = this.services.cartesianScales.domainAxisPosition;\n\t\tconst scaleType = options.axes[axisPosition].scaleType;\n\n\t\t// Sort keys\n\t\tif (scaleType === ScaleTypes.TIME) {\n\t\t\tstackKeys.sort((a: any, b: any) => {\n\t\t\t\tconst dateA: any = new Date(a);\n\t\t\t\tconst dateB: any = new Date(b);\n\n\t\t\t\treturn dateA - dateB;\n\t\t\t});\n\t\t} else if (\n\t\t\tscaleType === ScaleTypes.LOG ||\n\t\t\tscaleType === ScaleTypes.LINEAR\n\t\t) {\n\t\t\tstackKeys.sort((a: any, b: any) => a - b);\n\t\t}\n\n\t\treturn stackKeys;\n\t}\n\n\tgetDataValuesGroupedByKeys({ bins = null, groups = null }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\t\tconst displayData = this.getDisplayData(groups);\n\n\t\tconst dataGroupNames = this.getDataGroupNames();\n\n\t\tconst stackKeys = this.getStackKeys({ bins, groups });\n\t\tif (bins) {\n\t\t\treturn stackKeys.map((key) => {\n\t\t\t\tconst [binStart, binEnd] = key.split('-');\n\n\t\t\t\tconst correspondingValues = { x0: binStart, x1: binEnd };\n\t\t\t\tconst correspondingBin = bins.find(\n\t\t\t\t\t(bin) => bin.x0.toString() === binStart.toString()\n\t\t\t\t);\n\n\t\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\t\tcorrespondingValues[\n\t\t\t\t\t\tdataGroupName\n\t\t\t\t\t] = correspondingBin.filter(\n\t\t\t\t\t\t(binItem) => binItem[groupMapsTo] === dataGroupName\n\t\t\t\t\t).length;\n\t\t\t\t});\n\n\t\t\t\treturn correspondingValues;\n\t\t\t}) as any;\n\t\t}\n\n\t\treturn stackKeys.map((key) => {\n\t\t\tconst correspondingValues = { sharedStackKey: key };\n\t\t\tdataGroupNames.forEach((dataGroupName) => {\n\t\t\t\tconst correspondingDatum = displayData.find((datum) => {\n\t\t\t\t\tconst domainIdentifier = this.services.cartesianScales.getDomainIdentifier(\n\t\t\t\t\t\tdatum\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tdatum[groupMapsTo] === dataGroupName &&\n\t\t\t\t\t\tdatum.hasOwnProperty(domainIdentifier) &&\n\t\t\t\t\t\t(datum[domainIdentifier] instanceof Date\n\t\t\t\t\t\t\t? formatDateTillMilliSeconds(datum[domainIdentifier]) === key\n\t\t\t\t\t \t: datum[domainIdentifier].toString() === key)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier(\n\t\t\t\t\tcorrespondingValues\n\t\t\t\t);\n\t\t\t\tcorrespondingValues[dataGroupName] = correspondingDatum\n\t\t\t\t\t? correspondingDatum[rangeIdentifier]\n\t\t\t\t\t: null;\n\t\t\t});\n\n\t\t\treturn correspondingValues;\n\t\t}) as any;\n\t}\n\n\tgetStackedData({ percentage = false, groups = null, divergent = false }) {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\t// Get only active data groups so non-active data groups are not rendered\n\t\t// on legend item click\n\t\tconst dataGroupNames = this.getActiveDataGroupNames(groups);\n\t\tconst dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({\n\t\t\tgroups,\n\t\t});\n\n\t\tif (percentage) {\n\t\t\tconst maxByKey = Tools.fromPairs(\n\t\t\t\tdataValuesGroupedByKeys.map((d: any) => [d.sharedStackKey, 0])\n\t\t\t);\n\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tmaxByKey[d.sharedStackKey] += d[name];\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// cycle through data values to get percentage\n\t\t\tdataValuesGroupedByKeys.forEach((d: any) => {\n\t\t\t\tdataGroupNames.forEach((name) => {\n\t\t\t\t\tif (maxByKey[d.sharedStackKey]) {\n\t\t\t\t\t\td[name] = (d[name] / maxByKey[d.sharedStackKey]) * 100;\n\t\t\t\t\t} else {\n\t\t\t\t\t\td[name] = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tconst stackToUse = divergent\n\t\t\t? stack().offset(stackOffsetDiverging)\n\t\t\t: stack();\n\n\t\treturn stackToUse\n\t\t\t.keys(dataGroupNames)(dataValuesGroupedByKeys)\n\t\t\t.map((series, i) => {\n\t\t\t\t// Add data group names to each series\n\t\t\t\treturn Object.keys(series)\n\t\t\t\t\t.filter((key: any) => !isNaN(key))\n\t\t\t\t\t.map((key) => {\n\t\t\t\t\t\tconst element = series[key];\n\t\t\t\t\t\telement[groupMapsTo] = dataGroupNames[i];\n\n\t\t\t\t\t\treturn element;\n\t\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * @return {Object} The chart's options\n\t */\n\tgetOptions() {\n\t\treturn this.state.options;\n\t}\n\n\tset(newState: any, configs?: any) {\n\t\tthis.state = Object.assign({}, this.state, newState);\n\t\tconst newConfig = Object.assign(\n\t\t\t{ skipUpdate: false, animate: true }, // default configs\n\t\t\tconfigs\n\t\t);\n\t\tif (!newConfig.skipUpdate) {\n\t\t\tthis.update(newConfig.animate);\n\t\t}\n\t}\n\n\tget(property?: string) {\n\t\tif (property) {\n\t\t\treturn this.state[property];\n\t\t} else {\n\t\t\treturn this.state;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param newOptions New options to be set\n\t */\n\tsetOptions(newOptions) {\n\t\tconst options = this.getOptions();\n\t\tTools.updateLegendAdditionalItems(options, newOptions);\n\n\t\tthis.set({\n\t\t\toptions: Tools.merge(options, newOptions),\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * Updates miscellanous information within the model\n\t * such as the color scales, or the legend data labels\n\t */\n\tupdate(animate = true) {\n\t\tif (!this.getDisplayData()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateAllDataGroups();\n\n\t\tthis.setCustomColorScale();\n\t\tthis.setColorClassNames();\n\t\tthis.services.events.dispatchEvent(Events.Model.UPDATE, { animate });\n\t}\n\n\t/*\n\t * Data labels\n\t */\n\ttoggleDataLabel(changedLabel: string) {\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tconst hasDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\t\tconst activeItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\n\t\t// If there are deactivated items, toggle \"changedLabel\"\n\t\tif (hasDeactivatedItems) {\n\t\t\t// If the only active item is being toggled\n\t\t\t// Activate all items\n\t\t\tif (\n\t\t\t\tactiveItems.length === 1 &&\n\t\t\t\tactiveItems[0].name === changedLabel\n\t\t\t) {\n\t\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\t\tdataGroups[i].status = ACTIVE;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst indexToChange = dataGroups.findIndex(\n\t\t\t\t\t(group) => group.name === changedLabel\n\t\t\t\t);\n\t\t\t\tdataGroups[indexToChange].status =\n\t\t\t\t\tdataGroups[indexToChange].status === DISABLED\n\t\t\t\t\t\t? ACTIVE\n\t\t\t\t\t\t: DISABLED;\n\t\t\t}\n\t\t} else {\n\t\t\t// If every item is active, then enable \"changedLabel\" and disable all other items\n\t\t\tdataGroups.forEach((group, i) => {\n\t\t\t\tdataGroups[i].status =\n\t\t\t\t\tgroup.name === changedLabel ? ACTIVE : DISABLED;\n\t\t\t});\n\t\t}\n\n\t\t// Updates selected groups\n\t\tconst updatedActiveItems = dataGroups.filter(\n\t\t\t(group) => group.status === ACTIVE\n\t\t);\n\t\tconst options = this.getOptions();\n\n\t\tconst hasUpdatedDeactivatedItems = dataGroups.some(\n\t\t\t(group) => group.status === DISABLED\n\t\t);\n\n\t\t// If there are deactivated items, map the item name into selected groups\n\t\tif (hasUpdatedDeactivatedItems) {\n\t\t\toptions.data.selectedGroups = updatedActiveItems.map(\n\t\t\t\t(activeItem) => activeItem.name\n\t\t\t);\n\t\t} else {\n\t\t\t// If every item is active, clear array\n\t\t\toptions.data.selectedGroups = [];\n\t\t}\n\n\t\t// dispatch legend filtering event with the status of all the dataLabels\n\t\tthis.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {\n\t\t\tdataGroups,\n\t\t});\n\n\t\t// Update model\n\t\tthis.set({\n\t\t\tdataGroups,\n\t\t});\n\t}\n\n\t/**\n\t * Should the data point be filled?\n\t * @param group\n\t * @param key\n\t * @param value\n\t * @param defaultFilled the default for this chart\n\t */\n\tgetIsFilled(group: any, key?: any, data?: any, defaultFilled?: boolean) {\n\t\tconst options = this.getOptions();\n\t\tif (options.getIsFilled) {\n\t\t\treturn options.getIsFilled(group, key, data, defaultFilled);\n\t\t} else {\n\t\t\treturn defaultFilled;\n\t\t}\n\t}\n\n\tgetFillColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultFillColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getFillColor) {\n\t\t\treturn options.getFillColor(group, key, data, defaultFillColor);\n\t\t} else {\n\t\t\treturn defaultFillColor;\n\t\t}\n\t}\n\n\tgetStrokeColor(group: any, key?: any, data?: any) {\n\t\tconst options = this.getOptions();\n\t\tconst defaultStrokeColor = Tools.getProperty(this.colorScale, group);\n\n\t\tif (options.getStrokeColor) {\n\t\t\treturn options.getStrokeColor(group, key, data, defaultStrokeColor);\n\t\t} else {\n\t\t\treturn defaultStrokeColor;\n\t\t}\n\t}\n\n\tisUserProvidedColorScaleValid() {\n\t\tconst userProvidedScale = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'scale'\n\t\t);\n\t\tconst dataGroups = this.getDataGroups();\n\n\t\tif (\n\t\t\tuserProvidedScale == null ||\n\t\t\tObject.keys(userProvidedScale).length == 0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn dataGroups.some((dataGroup) =>\n\t\t\tObject.keys(userProvidedScale).includes(dataGroup.name)\n\t\t);\n\t}\n\n\tgetColorClassName(configs: {\n\t\tclassNameTypes: ColorClassNameTypes[];\n\t\tdataGroupName?: string;\n\t\toriginalClassName?: string;\n\t}) {\n\t\tconst colorPairingTag = this.colorClassNames(configs.dataGroupName);\n\t\tlet className = configs.originalClassName;\n\t\tconfigs.classNameTypes.forEach(\n\t\t\t(type) =>\n\t\t\t\t(className = configs.originalClassName\n\t\t\t\t\t? `${className} ${type}-${colorPairingTag}`\n\t\t\t\t\t: `${type}-${colorPairingTag}`)\n\t\t);\n\n\t\treturn className;\n\t}\n\n\t/**\n\t * For charts that might hold an associated status for their dataset\n\t */\n\tgetStatus() {\n\t\treturn null;\n\t}\n\n\tgetAllDataGroupsNames() {\n\t\treturn this.allDataGroups;\n\t}\n\n\t/**\n\t * Converts data provided in the older format to tabular\n\t *\n\t */\n\tprotected transformToTabularData(data) {\n\t\tconsole.warn(\n\t\t\t\"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format\"\n\t\t);\n\t\tconst tabularData = [];\n\t\tconst { datasets, labels } = data;\n\n\t\t// Loop through all datasets\n\t\tdatasets.forEach((dataset) => {\n\t\t\t// Update each data point to the new format\n\t\t\tdataset.data.forEach((datum, i) => {\n\t\t\t\tlet group;\n\n\t\t\t\tconst datasetLabel = Tools.getProperty(dataset, 'label');\n\t\t\t\tif (datasetLabel === null) {\n\t\t\t\t\tconst correspondingLabel = Tools.getProperty(labels, i);\n\t\t\t\t\tif (correspondingLabel) {\n\t\t\t\t\t\tgroup = correspondingLabel;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgroup = 'Ungrouped';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgroup = datasetLabel;\n\t\t\t\t}\n\n\t\t\t\tconst updatedDatum = {\n\t\t\t\t\tgroup,\n\t\t\t\t\tkey: labels[i],\n\t\t\t\t};\n\n\t\t\t\tif (isNaN(datum)) {\n\t\t\t\t\tupdatedDatum['value'] = datum.value;\n\t\t\t\t\tupdatedDatum['date'] = datum.date;\n\t\t\t\t} else {\n\t\t\t\t\tupdatedDatum['value'] = datum;\n\t\t\t\t}\n\n\t\t\t\ttabularData.push(updatedDatum);\n\t\t\t});\n\t\t});\n\n\t\treturn tabularData;\n\t}\n\n\tgetTabularDataArray() {\n\t\treturn [];\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tthis.services.files.downloadCSV(csvString, 'myChart.csv');\n\t}\n\n\tprotected getTabularData(data) {\n\t\t// if data is not an array\n\t\tif (!Array.isArray(data)) {\n\t\t\treturn this.transformToTabularData(data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\tdata = this.getTabularData(data);\n\n\t\treturn data;\n\t}\n\n\t/*\n\t * Data groups\n\t */\n\tprotected updateAllDataGroups() {\n\t\t// allDataGroups is used to generate a color scale that applies\n\t\t// to all the groups. Now when the data updates, you might remove a group,\n\t\t// and then bring it back in a newer data update, therefore\n\t\t// the order of the groups in allDataGroups matters so that you'd never\n\t\t// have an incorrect color assigned to a group.\n\n\t\t// Also, a new group should only be added to allDataGroups if\n\t\t// it doesn't currently exist\n\n\t\tif (!this.allDataGroups) {\n\t\t\tthis.allDataGroups = this.getDataGroupNames();\n\t\t} else {\n\t\t\t// Loop through current data groups\n\t\t\tthis.getDataGroupNames().forEach((dataGroupName) => {\n\t\t\t\t// If group name hasn't been stored yet, store it\n\t\t\t\tif (this.allDataGroups.indexOf(dataGroupName) === -1) {\n\t\t\t\t\tthis.allDataGroups.push(dataGroupName);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected generateDataGroups(data) {\n\t\tconst { groupMapsTo } = this.getOptions().data;\n\t\tconst { ACTIVE, DISABLED } = Configuration.legend.items.status;\n\t\tconst options = this.getOptions();\n\n\t\tconst uniqueDataGroups = Tools.removeArrayDuplicates(\n\t\t\tdata.map((datum) => datum[groupMapsTo])\n\t\t);\n\n\t\t// check if selectedGroups can be applied to chart with current data groups\n\t\tif (options.data.selectedGroups.length) {\n\t\t\tconst hasAllSelectedGroups = options.data.selectedGroups.every(\n\t\t\t\t(groupName) => uniqueDataGroups.includes(groupName)\n\t\t\t);\n\t\t\tif (!hasAllSelectedGroups) {\n\t\t\t\toptions.data.selectedGroups = [];\n\t\t\t}\n\t\t}\n\n\t\t// Get group status based on items in selected groups\n\t\tconst getStatus = (groupName) =>\n\t\t\t!options.data.selectedGroups.length ||\n\t\t\toptions.data.selectedGroups.includes(groupName)\n\t\t\t\t? ACTIVE\n\t\t\t\t: DISABLED;\n\n\t\treturn uniqueDataGroups.map((groupName) => ({\n\t\t\tname: groupName,\n\t\t\tstatus: getStatus(groupName),\n\t\t}));\n\t}\n\n\t/*\n\t * Fill scales\n\t */\n\tprotected setCustomColorScale() {\n\t\tif (!this.isUserProvidedColorScaleValid()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options = this.getOptions();\n\t\tconst userProvidedScale = Tools.getProperty(options, 'color', 'scale');\n\n\t\tObject.keys(userProvidedScale).forEach((dataGroup) => {\n\t\t\tif (!this.allDataGroups.includes(dataGroup)) {\n\t\t\t\tconsole.warn(`\"${dataGroup}\" does not exist in data groups.`);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Go through allDataGroups. If a data group has a color value provided\n\t\t * by the user, add that to the color range\n\t\t */\n\t\tconst providedDataGroups = this.allDataGroups.filter(\n\t\t\t(dataGroup) => userProvidedScale[dataGroup]\n\t\t);\n\n\t\tprovidedDataGroups.forEach(\n\t\t\t(dataGroup) =>\n\t\t\t\t(this.colorScale[dataGroup] = userProvidedScale[dataGroup])\n\t\t);\n\t}\n\n\t/*\n\t * Color palette\n\t */\n\tprotected setColorClassNames() {\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\n\t\t// Check if user has defined numberOfVariants (differ from given data)\n\t\tlet numberOfVariants = Tools.getProperty(\n\t\t\tcolorPairingOptions,\n\t\t\t'numberOfVariants'\n\t\t);\n\t\tif (!numberOfVariants || numberOfVariants < this.allDataGroups.length) {\n\t\t\tnumberOfVariants = this.allDataGroups.length;\n\t\t}\n\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// If number of dataGroups is greater than 5, user 14-color palette\n\t\tconst numberOfColors = numberOfVariants > 5 ? 14 : numberOfVariants;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) =>\n\t\t\t\t`${numberOfColors}-${pairingOption}-${(index % 14) + 1}`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Carbon charting components",
|
|
5
5
|
"main": "./bundle.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"d3-cloud": "1.2.5",
|
|
56
56
|
"d3-sankey": "0.12.3",
|
|
57
57
|
"date-fns": "2.8.1",
|
|
58
|
-
"dom-to-image": "2.6.0",
|
|
59
58
|
"lodash-es": "4.17.21",
|
|
60
59
|
"resize-observer-polyfill": "1.5.0"
|
|
61
60
|
},
|