* Render data into a visualization. * @param insight Object to create a visualization specification. * @param data Array of data objects. * @param view Optional View to specify camera type. * @param ordinalMap Optional map of ordinals to assign to the data such that the same cube
(insight: Insight, data: object[], options: RenderOptions = {})
| 425 | * @param ordinalMap Optional map of ordinals to assign to the data such that the same cubes can be re-used for new data. |
| 426 | */ |
| 427 | async render(insight: Insight, data: object[], options: RenderOptions = {}) { |
| 428 | let result: RenderResult; |
| 429 | //see if refine expression has changed |
| 430 | if (!searchExpression.compare(insight.filter, this.insight.filter)) { |
| 431 | const allowAsyncRenderTime = 100; |
| 432 | if (insight.filter) { |
| 433 | //refining |
| 434 | result = await this._render(insight, data, options, true); |
| 435 | this.presenter.animationQueue(() => { |
| 436 | this.filter(insight.filter, options.rebaseFilter && options.rebaseFilter()); |
| 437 | }, allowAsyncRenderTime, { waitingLabel: 'layout before refine', handlerLabel: 'refine after layout' }); |
| 438 | } else { |
| 439 | //not refining |
| 440 | this._dataScope.setFilteredData(null); |
| 441 | result = await this._render(insight, data, options, true); |
| 442 | this.presenter.animationQueue(() => { |
| 443 | this.reset(); |
| 444 | }, allowAsyncRenderTime, { waitingLabel: 'layout before reset', handlerLabel: 'reset after layout' }); |
| 445 | } |
| 446 | } else { |
| 447 | result = await this._render(insight, data, options, false); |
| 448 | } |
| 449 | return result; |
| 450 | } |
| 451 | |
| 452 | private shouldViewstateTransition(newInsight: Insight, oldInsight: Insight) { |
| 453 | if (!oldInsight.columns) return false; |
no test coverage detected