survey-analytics
Version:
SurveyJS analytics Library.
1 lines • 2.07 MB
Source Map (JSON)
{"version":3,"file":"survey.analytics.mjs","sources":["../../src/dataProvider.ts","../../node_modules/tslib/tslib.es6.js","../../src/visualizerBase.ts","../../src/visualizationManager.ts","../../src/visualizerFactory.ts","../../src/number.ts","../../src/selectBase.ts","../../src/matrix.ts","../../src/boolean.ts","../../src/histogram.ts","../../src/alternativeVizualizersWrapper.ts","../../src/filterInfo.ts","../../node_modules/muuri/dist/muuri.js","../../src/layoutEngine.ts","../../src/visualizationPanel.ts","../../src/visualizationPanelDynamic.ts","../../src/visualizationMatrixDynamic.ts","../../src/visualizationMatrixDropdown.ts","../../src/plotly/setup.ts","../../src/plotly/selectBase.ts","../../src/plotly/matrix.ts","../../src/plotly/boolean.ts","../../src/plotly/ranking.ts","../../src/matrixDropdownGrouped.ts","../../src/plotly/matrixdropdown-grouped.ts","../../src/plotly/histogram.ts","../../src/plotly/rating.ts","../../src/wordcloud/stopwords/english.ts","../../src/wordcloud/stopwords/norwegian.ts","../../src/wordcloud/stopwords/dutch.ts","../../src/wordcloud/stopwords/spanish.ts","../../src/wordcloud/stopwords/index.ts","../../src/wordcloud/widget.ts","../../src/wordcloud/wordcloud.ts","../../src/text.ts","../../src/statistics-table.ts","../../src/nps.ts"],"sourcesContent":["import { Event } from \"survey-core\";\r\n\r\nexport type SummaryFilter = { field: string, type: string, value: any };\r\nexport type GetDataUsingCallbackFn = (params: { visualizer: any, filter?: Array<SummaryFilter>, callback?: (response: { data: Array<Object>, error?: any }) => void }) => void;\r\nexport type GetDataUsingPromiseFn = (params: { visualizer: any, filter?: Array<SummaryFilter> }) => Promise<Array<Object>>;\r\nexport type GetDataFn = GetDataUsingCallbackFn | GetDataUsingPromiseFn;\r\n\r\nexport class DataProvider {\r\n public static seriesMarkerKey = \"__sa_series_name\";\r\n\r\n private _filteredData: Array<{ [index: string]: any }>;\r\n protected filterValues: { [index: string]: any } = {};\r\n\r\n constructor(private _data: Array<any> | GetDataFn = []) {\r\n }\r\n\r\n public get data(): Array<any> {\r\n if(Array.isArray(this._data)) {\r\n return this._data;\r\n }\r\n return undefined;\r\n }\r\n public set data(data: Array<any> | GetDataFn) {\r\n if(Array.isArray(data)) {\r\n this._data = [].concat(data);\r\n } else {\r\n this._data = data;\r\n }\r\n this.raiseDataChanged();\r\n }\r\n public get dataFn(): GetDataFn {\r\n if(typeof this._data === \"function\") {\r\n return this._data;\r\n }\r\n return undefined;\r\n }\r\n\r\n public get filteredData(): Array<any> {\r\n if (this._filteredData === undefined) {\r\n let filterKeys = Object.keys(this.filterValues);\r\n if (filterKeys.length > 0) {\r\n this._filteredData = this.data.filter((item) => {\r\n return !Object.keys(this.filterValues).some(\r\n (key) => {\r\n const filterValue = this.filterValues[key];\r\n const filterValueType = typeof filterValue;\r\n const questionValue = item[key];\r\n if (Array.isArray(questionValue)) {\r\n if (filterValueType !== \"object\")\r\n return questionValue.indexOf(filterValue) == -1;\r\n }\r\n if (typeof questionValue === \"object\") {\r\n if (filterValueType !== \"object\")\r\n return true;\r\n return !questionContainsValue(questionValue, filterValue);\r\n }\r\n const seriesValue = item[DataProvider.seriesMarkerKey];\r\n if (!!seriesValue && filterValueType === \"object\") {\r\n return questionValue !== filterValue[seriesValue];\r\n }\r\n if (filterValueType === \"object\" && filterValue.start !== undefined && filterValue.end !== undefined) {\r\n let continioiusValue = typeof questionValue === \"number\" ? questionValue : Date.parse(questionValue);\r\n if (isNaN(continioiusValue)) {\r\n continioiusValue = parseFloat(questionValue);\r\n if (isNaN(continioiusValue)) {\r\n return true;\r\n }\r\n }\r\n return continioiusValue < filterValue.start || continioiusValue >= filterValue.end;\r\n }\r\n return item[key] !== this.filterValues[key];\r\n }\r\n );\r\n });\r\n } else {\r\n this._filteredData = this.data;\r\n }\r\n }\r\n return this._filteredData;\r\n }\r\n\r\n /**\r\n * Sets filter by question name and value.\r\n */\r\n public setFilter(questionName: string, selectedValue: any): void {\r\n var filterChanged = true;\r\n if (selectedValue !== undefined) {\r\n filterChanged = this.filterValues[questionName] !== selectedValue;\r\n this.filterValues[questionName] = selectedValue;\r\n } else {\r\n filterChanged = this.filterValues[questionName] !== undefined;\r\n delete this.filterValues[questionName];\r\n }\r\n if (filterChanged) {\r\n this.raiseDataChanged();\r\n }\r\n }\r\n\r\n /**\r\n * Fires when data has been changed.\r\n */\r\n public onDataChanged = new Event<\r\n (sender: DataProvider, options: any) => any,\r\n DataProvider,\r\n any\r\n >();\r\n\r\n public raiseDataChanged(questionName?: string): void {\r\n this._filteredData = undefined;\r\n if (!this.onDataChanged.isEmpty) {\r\n this.onDataChanged.fire(this, { questionName });\r\n }\r\n }\r\n\r\n public getFilters(): SummaryFilter[] {\r\n return Object.keys(this.filterValues).map(key => ({ field: key, type: \"=\", value: this.filterValues[key] }));\r\n }\r\n\r\n}\r\n\r\nfunction questionContainsValue(questionValue: any, filterValue: any) {\r\n const questionValueKeys = Object.keys(questionValue);\r\n const filterValueKeys = Object.keys(filterValue);\r\n\r\n if (filterValueKeys.length > questionValueKeys.length) return false;\r\n\r\n for (var key of filterValueKeys) {\r\n if (filterValue[key] != questionValue[key]) return false;\r\n }\r\n\r\n return true;\r\n}\r\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import { Question, QuestionCommentModel, settings } from \"survey-core\";\nimport { DataProvider, GetDataFn } from \"./dataProvider\";\nimport { VisualizerFactory } from \"./visualizerFactory\";\nimport { DocumentHelper, createLoadingIndicator } from \"./utils\";\nimport { localization } from \"./localizationManager\";\nimport { Event } from \"survey-core\";\n\nimport \"./visualizerBase.scss\";\n\nexport interface IDataInfo {\n name: string; // TODO - remove from this interface\n dataNames: Array<string>;\n getValues(): Array<any>;\n getLabels(): Array<string>;\n getSeriesValues(): Array<string>;\n getSeriesLabels(): Array<string>;\n}\n\nexport class PostponeHelper {\n public static postponeFunction: (fn: () => void, timeout?: number) => any;\n public static postpone(fn: () => void, timeout?: number): any {\n if(PostponeHelper.postponeFunction) {\n return PostponeHelper.postponeFunction(fn, timeout);\n } else {\n return setTimeout(fn, timeout);\n }\n }\n}\n\n/**\n * A base object for all visualizers. Use it to implement a custom visualizer.\n *\n * Constructor parameters:\n *\n * - `question`: [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question)\\\n * A survey question to visualize.\n * - `data`: `Array<any>`\\\n * Survey results.\n * - `options`\\\n * An object with the following properties:\n * - `dataProvider`: `DataProvider`\\\n * A data provider for this visualizer.\n * - `renderContent`: `(contentContainer: HTMLElement, visualizer: VisualizerBase) => void`\\\n * A function that renders the visualizer's HTML markup. Append the markup to `contentContainer`.\n * - `survey`: [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model)\\\n * Pass a `SurveyModel` instance if you want to use locales from the survey JSON schema.\n * - `seriesValues`: `Array<string>`\\\n * Series values used to group data.\n * - `seriesLabels`: `Array<string>`\\\n * Series labels to display. If this property is not set, `seriesValues` are used as labels.\n * - `type`: `string`\\\n * *(Optional)* The visualizer's type.\n *\n * [View Demo](https://surveyjs.io/dashboard/examples/how-to-plot-survey-data-in-custom-bar-chart/ (linkStyle))\n */\nexport class VisualizerBase implements IDataInfo {\n public static suppressVisualizerStubRendering: boolean = false;\n\n private _showToolbar = true;\n private _footerVisualizer: VisualizerBase = undefined;\n private _dataProvider: DataProvider = undefined;\n private _getDataCore: (dataInfo: IDataInfo) => number[][] = undefined\n public labelTruncateLength: number = 27;\n protected renderResult: HTMLElement = undefined;\n protected toolbarContainer: HTMLElement = undefined;\n protected headerContainer: HTMLElement = undefined;\n protected contentContainer: HTMLElement = undefined;\n protected footerContainer: HTMLElement = undefined;\n protected _supportSelection: boolean = false;\n // public static otherCommentQuestionType = \"comment\"; // TODO: make it configureable - allow choose what kind of question/visualizer will be used for comments/others\n public static otherCommentCollapsed = true;\n\n /**\n * An event that is raised after the visualizer's content is rendered.\n *\n * Parameters:\n *\n * - `sender`: `VisualizerBase`\\\n * A `VisualizerBase` instance that raised the event.\n *\n * - `options.htmlElement`: `HTMLElement`\\\n * A page element with the visualizer's content.\n * @see render\n * @see refresh\n **/\n public onAfterRender: Event<\n (sender: VisualizerBase, options: any) => any,\n VisualizerBase,\n any\n > = new Event<(sender: VisualizerBase, options: any) => any, VisualizerBase, any>();\n\n protected afterRender(contentContainer: HTMLElement) {\n this.onAfterRender.fire(this, { htmlElement: contentContainer });\n }\n\n /**\n * An event that is raised after a new locale is set.\n *\n * Parameters:\n *\n * - `sender`: `VisualizerBase`\\\n * A `VisualizerBase` instance that raised the event.\n *\n * - `options.locale`: `string`\\\n * The indentifier of a new locale (for example, \"en\").\n * @see locale\n */\n public onLocaleChanged = new Event<\n (sender: VisualizerBase, options: { locale: string }) => any,\n VisualizerBase,\n any\n >();\n\n // public onStateChanged = new Event<\n // (sender: VisualizationPanel, state: IState) => any,\n // VisualizationPanel,\n // any\n // >();\n /**\n * An event that is raised when the visualizer's state has changed.\n *\n * The state includes selected chart types, chart layout, sorting, filtering, and other customizations that a user has made while using the dashboard. Handle the `onStateChanged` event to save these customizations, for example, in `localStorage` and restore them when the user reloads the page.\n *\n * Parameters:\n *\n * - `sender`: `VisualizerBase`\\\n * A `VisualizerBase` instance that raised the event.\n *\n * - `state`: `any`\\\n * A new state of the visualizer. Includes information about the visualized elements and current locale.\n *\n * [View Demo](/dashboard/examples/save-dashboard-state-to-local-storage/ (linkStyle))\n * @see getState\n * @see setState\n */\n public onStateChanged: Event<\n (sender: VisualizerBase, options: any) => any,\n VisualizerBase,\n any\n > = new Event<(sender: VisualizerBase, options: any) => any, VisualizerBase, any>();\n\n protected stateChanged(name: string, value: any): void {\n if(this._settingState) {\n return;\n }\n this.onStateChanged.fire(this, this.getState());\n }\n\n protected toolbarItemCreators: { [name: string]: (toolbar?: HTMLDivElement) => HTMLElement } = {};\n\n constructor(\n public question: Question,\n data: Array<{ [index: string]: any }> | GetDataFn,\n public options: { [index: string]: any } = {},\n private _type?: string\n ) {\n this._getDataCore = this.questionOptions?.getDataCore;\n this._dataProvider = options.dataProvider || new DataProvider(data);\n this._dataProvider.onDataChanged.add(() => this.onDataChanged());\n this.loadingData = !!this._dataProvider.dataFn;\n\n if (typeof options.labelTruncateLength !== \"undefined\") {\n this.labelTruncateLength = options.labelTruncateLength;\n }\n }\n\n protected get questionOptions() {\n return this.options[this.question?.name];\n }\n\n protected onDataChanged(): void {\n this._calculationsCache = undefined;\n this.loadingData = !!this._dataProvider.dataFn;\n this.refresh();\n }\n\n /**\n * Returns the identifier of a visualized question.\n */\n get name(): string {\n return this.question.valueName || this.question.name;\n }\n\n get dataNames(): Array<string> {\n return [this.name];\n }\n\n /**\n * Indicates whether the visualizer displays a header. This property is `true` when a visualized question has a correct answer.\n * @see hasFooter\n */\n get hasHeader(): boolean {\n if (!this.options || !this.options.showCorrectAnswers) {\n return false;\n }\n return !!this.question && !!this.question.correctAnswer;\n }\n\n /**\n * Indicates whether the visualizer displays a footer. This property is `true` when a visualized question has a comment.\n * @see hasHeader\n */\n get hasFooter(): boolean {\n return (\n !!this.question && (this.question.hasComment || this.question.hasOther)\n );\n }\n\n protected createVisualizer<T = VisualizerBase>(question: Question, options?: { [index: string]: any }): T {\n let visualizerOptions = Object.assign({}, options || this.options);\n if (visualizerOptions.dataProvider === undefined) {\n visualizerOptions.dataProvider = this.dataProvider;\n }\n return VisualizerFactory.createVisualizer(question, this.data, visualizerOptions) as T;\n }\n\n /**\n * Allows you to access the footer visualizer. Returns `undefined` if the footer is absent.\n * @see hasFooter\n */\n get footerVisualizer(): VisualizerBase {\n if (!this.hasFooter) {\n return undefined;\n }\n if (!this._footerVisualizer) {\n const question = new QuestionCommentModel(\n this.question.name + (settings || {}).commentPrefix\n );\n question.title = this.processText(this.question.title);\n\n let visualizerOptions = Object.assign({}, this.options);\n visualizerOptions.renderContent = undefined;\n this._footerVisualizer = this.createVisualizer(question, visualizerOptions);\n if(!!this._footerVisualizer) {\n this._footerVisualizer.onUpdate = () => this.invokeOnUpdate();\n }\n }\n return this._footerVisualizer;\n }\n\n /**\n * Indicates whether users can select series points to cross-filter charts. To allow or disallow selection, set the [`allowSelection`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowSelection) property of the `IVisualizationPanelOptions` object in the [`VisualizationPanel`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel) constructor.\n */\n public get supportSelection(): boolean {\n return (\n (this.options.allowSelection === undefined ||\n this.options.allowSelection) &&\n this._supportSelection\n );\n }\n\n getSeriesValues(): Array<string> {\n return this.options.seriesValues || [];\n }\n\n getSeriesLabels(): Array<string> {\n return this.options.seriesLabels || this.getSeriesValues();\n }\n\n getValues(): Array<any> {\n throw new Error(\"Method not implemented.\");\n }\n\n getLabels(): Array<string> {\n return this.getValues();\n }\n\n /**\n * Registers a function used to create a toolbar item for this visualizer.\n *\n * The following code shows how to add a custom button and drop-down menu to the toolbar:\n *\n * ```js\n * import { VisualizationPanel, DocumentHelper } from \"survey-analytics\";\n *\n * const vizPanel = new VisualizationPanel( ... );\n *\n * // Add a custom button to the toolbar\n * vizPanel.visualizers[0].registerToolbarItem(\"my-toolbar-button\", () => {\n * return DocumentHelper.createButton(\n * // A button click event handler\n * () => {\n * alert(\"Custom toolbar button is clicked\");\n * },\n * // Button caption\n * \"Button\"\n * );\n * });\n *\n * // Add a custom drop-down menu to the toolbar\n * vizPanel.visualizers[0].registerToolbarItem(\"my-toolbar-dropdown\", () => {\n * return DocumentHelper.createSelector(\n * // Menu items\n * [\n * { value: 1, text: \"One\" },\n * { value: 2, text: \"Two\" },\n * { value: 3, text: \"Three\" }\n * ],\n * // A function that specifies initial selection\n * (option) => false,\n * // An event handler that is executed when selection is changed\n * (e) => {\n * alert(e.target.value);\n * }\n * );\n * });\n * ```\n * @param name A custom name for the toolbar item.\n * @param creator A function that accepts the toolbar and should return an `HTMLElement` with the toolbar item.\n * @see unregisterToolbarItem\n */\n public registerToolbarItem(\n name: string,\n creator: (toolbar?: HTMLDivElement) => HTMLElement\n ): void {\n this.toolbarItemCreators[name] = creator;\n }\n\n /**\n *\n * Unregisters a function used to create a toolbar item. Allows you to remove a toolbar item.\n * @param name A toolbar item name.\n * @returns A function previously used to [register](#registerToolbarItem) the removed toolbar item.\n * @see registerToolbarItem\n */\n public unregisterToolbarItem(\n name: string\n ): (toolbar?: HTMLDivElement) => HTMLElement {\n if(this.toolbarItemCreators[name] !== undefined) {\n const creator = this.toolbarItemCreators[name];\n delete this.toolbarItemCreators[name];\n return creator;\n }\n return undefined;\n }\n\n /**\n * Returns the visualizer's type.\n */\n public get type() {\n return this._type || \"visualizer\";\n }\n\n /**\n * @deprecated Use [`surveyData`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel#surveyData) instead.\n */\n protected get data() {\n return this.dataProvider.filteredData;\n }\n\n /**\n * Returns an array of survey results used to calculate values for visualization. If a user applies a filter, the array is also filtered.\n *\n * To get an array of calculated and visualized values, call the [`getCalculatedValues()`](https://surveyjs.io/dashboard/documentation/api-reference/visualizerbase#getCalculatedValues) method.\n */\n protected get surveyData() {\n return this.dataProvider.filteredData;\n }\n\n protected get dataProvider(): DataProvider {\n return this._dataProvider;\n }\n\n /**\n * Updates visualized data.\n * @param data A data array with survey results to be visualized.\n */\n updateData(data: Array<{ [index: string]: any }>) {\n if (!this.options.dataProvider) {\n this.dataProvider.data = data;\n }\n if (this.hasFooter) {\n this.footerVisualizer.updateData(data);\n }\n }\n\n onUpdate: () => void;\n\n invokeOnUpdate() {\n this.onUpdate && this.onUpdate();\n }\n\n /**\n * Deletes the visualizer and all its elements from the DOM.\n * @see clear\n */\n destroy() {\n if (!!this.renderResult) {\n this.clear();\n this.toolbarContainer = undefined;\n this.headerContainer = undefined;\n this.contentContainer = undefined;\n this.footerContainer = undefined;\n this.renderResult.innerHTML = \"\";\n this.renderResult = undefined;\n }\n if (!!this._footerVisualizer) {\n this._footerVisualizer.destroy();\n this._footerVisualizer.onUpdate = undefined;\n this._footerVisualizer = undefined;\n }\n }\n\n /**\n * Empties the toolbar, header, footer, and content containers.\n *\n * If you want to empty and delete the visualizer and all its elements from the DOM, call the [`destroy()`](https://surveyjs.io/dashboard/documentation/api-reference/visualizerbase#destroy) method instead.\n */\n public clear() {\n if (!!this.toolbarContainer) {\n this.destroyToolbar(this.toolbarContainer);\n }\n if (!!this.headerContainer) {\n this.destroyHeader(this.headerContainer);\n }\n if (!!this.contentContainer) {\n this.destroyContent(this.contentContainer);\n }\n if (!!this.footerContainer) {\n this.destroyFooter(this.footerContainer);\n }\n }\n\n protected createToolbarItems(toolbar: HTMLDivElement) {\n Object.keys(this.toolbarItemCreators || {}).forEach((toolbarItemName) => {\n let toolbarItem = this.toolbarItemCreators[toolbarItemName](toolbar);\n if (!!toolbarItem) {\n toolbar.appendChild(toolbarItem);\n }\n });\n }\n\n protected getCorrectAnswerText(): string {\n return !!this.question ? this.question.correctAnswer : \"\";\n }\n\n protected destroyToolbar(container: HTMLElement) {\n container.innerHTML = \"\";\n }\n\n protected renderToolbar(container: HTMLElement) {\n if (this.showToolbar) {\n const toolbar = <HTMLDivElement>(\n DocumentHelper.createElement(\"div\", \"sa-toolbar\")\n );\n this.createToolbarItems(toolbar);\n container.appendChild(toolbar);\n }\n }\n\n protected destroyHeader(container: HTMLElement) {\n if (!!this.options && typeof this.options.destroyHeader === \"function\") {\n this.options.destroyHeader(container, this);\n } else {\n container.innerHTML = \"\";\n }\n }\n\n protected destroyContent(container: HTMLElement) {\n if (!!this.options && typeof this.options.destroyContent === \"function\") {\n this.options.destroyContent(container, this);\n } else {\n container.innerHTML = \"\";\n }\n }\n\n protected renderHeader(container: HTMLElement) {\n if (!!this.options && typeof this.options.renderHeader === \"function\") {\n this.options.renderHeader(container, this);\n } else {\n const correctAnswerElement = DocumentHelper.createElement(\n \"div\",\n \"sa-visualizer__correct-answer\"\n );\n correctAnswerElement.innerText = localization.getString(\"correctAnswer\") + this.getCorrectAnswerText();\n container.appendChild(correctAnswerElement);\n }\n }\n\n protected async renderContentAsync(container: HTMLElement) {\n return new Promise<HTMLElement>((resolve, reject) => {\n container.innerText = localization.getString(\"noVisualizerForQuestion\");\n resolve(container);\n });\n }\n\n protected renderContent(container: HTMLElement) {\n if (!!this.options && typeof this.options.renderContent === \"function\") {\n const rendered = this.options.renderContent(container, this);\n if(rendered !== false) {\n this.afterRender(container);\n }\n } else {\n if(this.loadingData) {\n this.renderLoadingIndicator(this.contentContainer);\n }\n this.renderContentAsync(container).then(el => this.afterRender(el));\n }\n }\n\n protected destroyFooter(container: HTMLElement) {\n container.innerHTML = \"\";\n }\n\n protected renderFooter(container: HTMLElement) {\n container.innerHTML = \"\";\n if (this.hasFooter) {\n const footerTitleElement = DocumentHelper.createElement(\n \"h4\",\n \"sa-visualizer__footer-title\",\n { innerText: localization.getString(\"otherCommentTitle\") }\n );\n container.appendChild(footerTitleElement);\n\n const footerContentElement = DocumentHelper.createElement(\n \"div\",\n \"sa-visualizer__footer-content\"\n );\n footerContentElement.style.display = VisualizerBase.otherCommentCollapsed\n ? \"none\"\n : \"block\";\n\n const visibilityButton = DocumentHelper.createButton(() => {\n if (footerContentElement.style.display === \"none\") {\n footerContentElement.style.display = \"block\";\n visibilityButton.innerText = localization.getString(\"hideButton\");\n } else {\n footerContentElement.style.display = \"none\";\n visibilityButton.innerText = localization.getString(\n VisualizerBase.otherCommentCollapsed ? \"showButton\" : \"hideButton\"\n );\n }\n this.footerVisualizer.invokeOnUpdate();\n }, localization.getString(\"showButton\") /*, \"sa-toolbar__button--right\"*/);\n container.appendChild(visibilityButton);\n\n container.appendChild(footerContentElement);\n\n this.footerVisualizer.render(footerContentElement);\n }\n }\n\n /**\n * Renders the visualizer in a specified container.\n * @param targetElement An `HTMLElement` or an `id` of a page element in which you want to render the visualizer.\n */\n render(targetElement: HTMLElement | string) {\n if (typeof targetElement === \"string\") {\n targetElement = document.getElementById(targetElement);\n }\n this.renderResult = targetElement;\n\n this.toolbarContainer = DocumentHelper.createElement(\n \"div\",\n \"sa-visualizer__toolbar\"\n );\n targetElement.appendChild(this.toolbarContainer);\n this.renderToolbar(this.toolbarContainer);\n\n if (this.hasHeader) {\n this.headerContainer = DocumentHelper.createElement(\n \"div\",\n \"sa-visualizer__header\"\n );\n targetElement.appendChild(this.headerContainer);\n this.renderHeader(this.headerContainer);\n }\n\n this.contentContainer = DocumentHelper.createElement(\n \"div\",\n \"sa-visualizer__content\"\n );\n targetElement.appendChild(this.contentContainer);\n this.renderContent(this.contentContainer);\n\n this.footerContainer = DocumentHelper.createElement(\n \"div\",\n \"sa-visualizer__footer\"\n );\n targetElement.appendChild(this.footerContainer);\n this.renderFooter(this.footerContainer);\n }\n\n public updateContent(): void {\n this.destroyContent(this.contentContainer);\n this.renderContent(this.contentContainer);\n }\n\n /**\n * Re-renders the visualizer and its content.\n */\n public refresh(): void {\n if (!!this.headerContainer) {\n PostponeHelper.postpone(() => {\n this.destroyHeader(this.headerContainer);\n this.renderHeader(this.headerContainer);\n this.invokeOnUpdate();\n });\n }\n if (!!this.contentContainer) {\n PostponeHelper.postpone(() => {\n this.updateContent();\n this.invokeOnUpdate();\n });\n }\n if (!!this.footerContainer) {\n PostponeHelper.postpone(() => {\n this.destroyFooter(this.footerContainer);\n this.renderFooter(this.footerContainer);\n this.invokeOnUpdate();\n });\n }\n }\n\n protected processText(text: string): string {\n if (this.options.stripHtmlFromTitles !== false) {\n let originalText = text || \"\";\n let processedText = originalText.replace(/(<([^>]+)>)/gi, \"\");\n return processedText;\n }\n return text;\n }\n\n getRandomColor() {\n const colors = this.getColors();\n return colors[Math.floor(Math.random() * colors.length)];\n }\n\n private _backgroundColor = \"#f7f7f7\";\n\n get backgroundColor() { return this.getBackgroundColorCore(); }\n set backgroundColor(value) { this.setBackgroundColorCore(value); }\n\n protected getBackgroundColorCore() {\n return this._backgroundColor;\n }\n protected setBackgroundColorCore(color: string) {\n this._backgroundColor = color;\n if (this.footerVisualizer) this.footerVisualizer.backgroundColor = color;\n }\n\n static customColors: string[] = [];\n private static colors = [\n \"#86e1fb\",\n \"#3999fb\",\n \"#ff6771\",\n \"#1eb496\",\n \"#ffc152\",\n \"#aba1ff\",\n \"#7d8da5\",\n \"#4ec46c\",\n \"#cf37a6\",\n \"#4e6198\",\n ];\n\n getColors(count = 10) {\n const colors =\n Array.isArray(VisualizerBase.customColors) &&\n VisualizerBase.customColors.length > 0\n ? VisualizerBase.customColors\n : VisualizerBase.colors;\n\n let manyColors: any = [];\n\n for (let index = 0; index < count; index++) {\n manyColors = manyColors.concat(colors);\n }\n\n return manyColors;\n }\n\n /**\n * Gets or sets the visibility of the visualizer's toolbar.\n *\n * Default value: `true`\n */\n get showToolbar() {\n return this._showToolbar;\n }\n set showToolbar(newValue: boolean) {\n if (newValue != this._showToolbar) {\n this._showToolbar = newValue;\n if (!!this.toolbarContainer) {\n this.destroyToolbar(this.toolbarContainer);\n this.renderToolbar(this.toolbarContainer);\n }\n }\n }\n\n /**\n * @deprecated Use [`getCalculatedValues()`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel#getCalculatedValues) instead.\n */\n getData(): any {\n return this.getCalculatedValuesCore();\n }\n\n private _calculationsCache: Array<any> = undefined;\n\n protected getCalculatedValuesCore(): Array<any> {\n if (!!this._getDataCore) {\n return this._getDataCore(this);\n }\n\n return defaultStatisticsCalculator(this.surveyData, this);\n }\n\n protected loadingData: boolean = false;\n\n public renderLoadingIndicator(contentContainer: HTMLElement): void {\n contentContaine