Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { LitElement, html } from "https://unpkg.com/lit-element@2.0.1/lit-element.js?module";
- import ApexCharts from "https://cdn.jsdelivr.net/npm/apexcharts";
- class NetatmoChartCard extends LitElement {
- static get properties() {
- return {
- hass: {},
- config: {},
- };
- }
- render() {
- return html`
- <div id="chart"></div>
- `;
- }
- setConfig(config) {
- this.config = config;
- }
- firstUpdated() {
- this._renderChart();
- }
- _renderChart() {
- const options = {
- chart: {
- type: 'line',
- height: 350
- },
- series: [{
- name: 'temperature',
- data: [30, 40, 45, 50, 49, 60, 70]
- }],
- xaxis: {
- categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
- }
- };
- const chart = new ApexCharts(this.shadowRoot.querySelector('#chart'), options);
- chart.render();
- }
- }
- customElements.define('netatmo-chart-card', NetatmoChartCard);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement