Skip to content

bipa-app/svelte-echarts

 
 

Repository files navigation

svelte-echarts

A simple Apache ECharts component for Svelte! Check out this demo.

💿 Installation

npm i -D svelte-echarts echarts

⌨️ Usage demo

<script>
  import { Chart } from 'svelte-echarts'

  import { init, use } from 'echarts/core'
  import { BarChart } from 'echarts/charts'
  import { GridComponent, TitleComponent } from 'echarts/components'
  import { CanvasRenderer } from 'echarts/renderers'

  // now with tree-shaking
  use([BarChart, GridComponent, CanvasRenderer, TitleComponent])

  let options = {
    title: {
      text: 'ECharts Example',
    },
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    },
    yAxis: {
      type: 'value',
    },
    series: [
      {
        type: 'bar',
        data: [120, 200, 150, 80, 70, 110, 130],
      },
    ],
  }
</script>

<div class="app">
  <Chart {init} {options} />
</div>

<style>
  .app {
    width: 100vw;
    height: 100vh;
  }
</style>

About

Apache ECharts wrapper for Svelte

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Svelte 45.5%
  • TypeScript 44.5%
  • CSS 5.3%
  • JavaScript 2.8%
  • HTML 1.9%