(role, column, options)
| 14264 | }); |
| 14265 | } |
| 14266 | changeColumnMapping(role, column, options) { |
| 14267 | const columns = Object.assign({}, this.state.columns); |
| 14268 | const label = column ? (0, _language.strings).labelHistoryMapColumn(role) : (0, _language.strings).labelHistoryUnMapColumn(role); |
| 14269 | const final = ()=>{ |
| 14270 | const partialInsight = { |
| 14271 | columns, |
| 14272 | totalStyle: options ? options.totalStyle : this.state.totalStyle |
| 14273 | }; |
| 14274 | const errors = (0, _columns.ensureColumnsPopulated)(this.state.chart, partialInsight.totalStyle, partialInsight.columns, this.state.dataContent.columns); |
| 14275 | columns[role] = column && column.name; |
| 14276 | this.changeInsight(partialInsight, { |
| 14277 | label |
| 14278 | }, errors ? { |
| 14279 | errors |
| 14280 | } : null); |
| 14281 | }; |
| 14282 | const _changeInsight = (newInsight, columnUpdate, historyAction)=>{ |
| 14283 | newInsight.columns = (0, _sanddanceReact.SandDance).VegaDeckGl.util.deepMerge({}, columns, columnUpdate); |
| 14284 | (0, _partialInsight.savePref)(this.prefs, this.state.chart, "*", "*", { |
| 14285 | columns: columnUpdate |
| 14286 | }); |
| 14287 | this.changeInsight(newInsight, historyAction); |
| 14288 | }; |
| 14289 | if (column) { |
| 14290 | let columnUpdate; |
| 14291 | switch(role){ |
| 14292 | case "facet": |
| 14293 | { |
| 14294 | (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, "facet", column.name); |
| 14295 | const historicInsight = { |
| 14296 | columns, |
| 14297 | facetStyle: options ? options.facetStyle : this.state.facetStyle |
| 14298 | }; |
| 14299 | columnUpdate = { |
| 14300 | facet: column.name |
| 14301 | }; |
| 14302 | _changeInsight(historicInsight, columnUpdate, { |
| 14303 | label |
| 14304 | }); |
| 14305 | break; |
| 14306 | } |
| 14307 | case "color": |
| 14308 | { |
| 14309 | let calculating = null; |
| 14310 | let historicInsight = { |
| 14311 | scheme: options && options.scheme, |
| 14312 | columns, |
| 14313 | colorBin: this.state.colorBin |
| 14314 | }; |
| 14315 | if (!historicInsight.scheme) (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, "color", column.name); |
| 14316 | if (!historicInsight.scheme) historicInsight.scheme = (0, _colorScheme.bestColorScheme)(column, null, this.state.scheme); |
| 14317 | if (!column.stats.hasColorData) { |
| 14318 | historicInsight.directColor = false; |
| 14319 | if (this.state.directColor !== historicInsight.directColor) calculating = ()=>this._resize(); |
| 14320 | } |
| 14321 | if (this.state.columns && this.state.columns.color && this.state.columns.color !== column.name) { |
| 14322 | const currColorColumn = this.state.dataContent.columns.filter((c)=>c.name === this.state.columns.color)[0]; |
| 14323 | if (column.isColorData != currColorColumn.isColorData) calculating = ()=>this._resize(); |
no test coverage detected