private ensureChartIsInstantiated()

in analytics-example-widget/scripts/components/ChartComponent.tsx [50:67]


    private ensureChartIsInstantiated(chartOptions: Chart_Contracts.CommonChartOptions) {
        //Due to asynchronous nature of chart rendering in relation to REACT events, some safety checks are needed, until public API can correct for async flow. 
        this.chartServicePromise.then((chartService) => {
            this.ensurePriorInstancesAreCleared();

            if(this.isMounted){
                let container = ReactDOM.findDOMNode(this);
                if(container){
                    this.$wrappedContainer = $(container);

                    if (chartOptions) {
                        chartOptions = this.updateChartOptions(chartOptions);
                        chartService.createChart(this.$wrappedContainer, chartOptions);
                    }
                }
            }
        });
    }