npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tilez-echarts

v1.0.0

Published

Apache ECharts for Svelte layout engine tilez

Downloads

94

Readme

Tilez-Logo tilez - apache echarts

Apache ECharts tile for usage with Svelte layout engine tilez.

Installation

Install tilez-echarts as npm package via

npm install tilez-echarts

Usage

You can use Apache ECharts tile for tile types 'html' and 'svg'. Component EChartsTile has following props:

  • options Apache ECharts configuration
  • data JSON | Apache Arrow table | Array of JSON or Apache Arrow tables [optional]

HTML Tiles

For HTML tiles, there is a context necessary which specifies which components of ECharts should be used (treeshaking support). Also, you can set up an ECharts theme there.

<script lang="ts">
  // +page.svelte
  import { onMount, setContext } from 'svelte';
  import { type Writable, writable } from 'svelte/store';

  import { Tile } from 'tilez';
  import { type ThemeOption, EChartsHTMLConfig, EChartsTile } from 'tilez-echarts';

  import type { EChartsOption } from 'echarts';
  import { GridComponent, TooltipComponent} from 'echarts/components';
  import { BarChart } from 'echarts/charts';

  // fetch `theme` in `+page.server.ts`
  export let data: {theme: ThemeOption};

  const option: EChartsOption = {
    xAxis: {
      type: 'category',
      data: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
      axisTick: {
        alignWithLabel: true
      },
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: [28, 55, 43, 91, 81, 53, 19, 87, 52],
        type: 'bar',
        barWidth: '80%'
      },
    ],
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    }
  };

  // set up theme and minimal set of components, so that they can be shared across all ECharts tiles
  const echarts: Writable<EChartsHTMLConfig | null> = writable(null);
  setContext('echarts', echarts);

  onMount(() => {
    echarts.set(
      new EChartsHTMLConfig(
        data.theme,
        { renderer: 'canvas' },
        [
          BarChart,
          GridComponent,
          TooltipComponent
        ]
      )
    );
  });
</script>

<Tile type="html" width="800px" height="600px">
  <EChartsTile {option} />
</Tile>

SVG Tiles

For SVG tiles you can also use EChartsSVGConfig class for theme configuration. It is optional, as SVG tiles use global echarts package (no treeshaking).

<script lang="ts">
  import { Tile } from 'tilez';
  import { EChartsTile } from 'tilez-echarts';

  import type { EChartsOption } from 'echarts';

  const option: EChartsOption = {
    xAxis: {
      type: 'category',
      data: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
      axisTick: {
        alignWithLabel: true
      }
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: [28, 55, 43, 91, 81, 53, 19, 87, 52],
        type: 'bar',
        barWidth: '80%'
      }
    ]
  };
</script>

<Tile type="svg" width="800px" height="600px">
  <EChartsTile {option} />
</Tile>

Support of Arrow Datasets

By default, you add inline data to option of EChartsTile. However, you can also pass JSON or Apache Arrow table(s) to EChartsTile via data props. Arrow table(s) will be converted to ECharts dataset(s), which will be added to option automatically. See arrow route for an example.

SSR

Underlying EChartsSVGConfig class can also be used for server side rendering without tilez, see ssr route in example app.