Skip to content

Commit

Permalink
fix: Revert "Append chart to host element"
Browse files Browse the repository at this point in the history
This reverts commit 3cf4aed.
  • Loading branch information
mikaelkaron committed Apr 5, 2019
1 parent 7c11e81 commit 3efd39f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/apex-chart/apex-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Element, Prop, State, Watch, Method } from '@stencil/core';
import { Component, Prop, State, Watch, Method } from '@stencil/core';
import ApexCharts from 'apexcharts';
import { ApexOptions } from 'apexcharts';
import {
Expand Down Expand Up @@ -38,7 +38,6 @@ if (window) {
styleUrl: 'apex-chart.css'
})
export class chart {
@Element()
chartRef: HTMLElement;

/**
Expand Down Expand Up @@ -107,22 +106,23 @@ export class chart {
return this.chartObj.updateOptions(newOptions, redrawPaths, animate);
}

componentWillLoad() {
async componentDidLoad() {
if (this.chartObj === null) {
this.chartObj = new ApexCharts(
this.chartRef,
config(this.options, this.type, this.width, this.height, this.series)
);
return this.chartObj.render()
}
}

async render() {
return this.chartObj.render();
}

componentDidUnload() {
if (this.chartObj !== null) {
this.chartObj.destroy();
}
}

render() {
return <div ref={el => (this.chartRef = el)} />;
}
}

0 comments on commit 3efd39f

Please sign in to comment.