Skip to content

Instantly share code, notes, and snippets.

@anoblet
Created February 14, 2019 14:44
Show Gist options
  • Save anoblet/b0a0d5d4c608d8c52c64e20dd9bd8bbd to your computer and use it in GitHub Desktop.
Save anoblet/b0a0d5d4c608d8c52c64e20dd9bd8bbd to your computer and use it in GitHub Desktop.
// @ts-ignore-start
import { LitElement, customElement, html } from "lit-element";
import GlobalStyle from "../../GlobalStyle";
import {GoogleCharts} from 'google-charts';
declare module "google-charts" {
api
}
//Load the charts library with a callback
GoogleCharts.load(drawChart);
console.log(GoogleCharts);
function drawChart() {
// Standard google charts functionality is available as GoogleCharts.api after load
const data = GoogleCharts.api.visualization.arrayToDataTable([
["Chart thing", "Chart amount"],
["Lorem ipsum", 60],
["Dolor sit", 22],
["Sit amet", 18]
]);
const pie_1_chart = new GoogleCharts.api.visualization.PieChart(
document.getElementById("chart1")
);
pie_1_chart.draw(data);
console.log(pie_1_chart);
}
@customElement("chart-component")
export class ChartComponent extends LitElement {
static get styles() {
return [GlobalStyle];
}
public render() {
return html``;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment