Skip to content

Instantly share code, notes, and snippets.

@pinguxx
Created April 3, 2019 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pinguxx/11b28f8463ac47e72174ef6f8d61cedf to your computer and use it in GitHub Desktop.
Save pinguxx/11b28f8463ac47e72174ef6f8d61cedf to your computer and use it in GitHub Desktop.
created() {
this._el = undefined;
this.chart = null;
this.render();
this.update(true);
}
update(newtype) {
if (!newtype && this.chart) {
return this.chart.update(this.data, this.options);
}
if (newtype && this.type && Chartist[this.type]) {
this.chart = new Chartist[this.type](this, this.data, this.options);
}
}
render() {
this.html`<div class="ct-chart"></div>`;
if (this._el) {
this._el = this.querySelector(".ct-chart");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment