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

gridy-chart-echarts

v2.1.2

Published

GridyGrid chart component ECharts driver

Downloads

49

Readme

GridyGrid chart component ECharts driver

Installation

npm i gridy-grid echarts gridy-chart-echarts gridy-grid-default sk-theme-default

and plug it to your page

<script src="/node_modules/echarts/dist/echarts.js"></script>

then add element to your container or setup it programmatically

    <gridy-grid id="gridyGrid" base-path="/node_modules/gridy-grid/src" sort-field="$.title">
    <gridy-data-source fields='[{ "title": "Name", "path": "$.name" },{ "title": "Value", "path": "$.value"}]'
                   datasource-type="DataSourceLocal" datapath="$.data"></gridy-data-source>

    <gridy-chart id="gridyChart2" legend='{"data": ["sales"]}' type="bar" dri="echarts" field-name="Name" field-value="Value" width="400" height="400"></gridy-chart>

</gridy-grid>

Multiple charts support

<gridy-grid id="gridyGrid2" base-path="/node_modules/gridy-grid/src" sort-field="$.title">
    <gridy-data-source fields='[{ "title": "Name", "path": "$.name" },{ "title": "Value", "path": "$.value"},{ "title": "Group", "path": "$.group"}]'
                       datasource-type="DataSourceLocal" datapath="$.data"></gridy-data-source>
	<gridy-chart id="gridyChart2" options='{"xAxis": { "data": "names" }, "yAxis": {}}' legend='{"data": ["sales", "markt"]}' type="multi:bar:sales,line:markt" value-field dri="echarts" field-color="Color" field-name="Name" field-value="Value" field-group="Group" width="400" height="400"></gridy-chart>
    <gridy-pager id="gridyPager2"></gridy-pager>
</gridy-grid>
<script type="module">
    import { GridyGrid } from '/node_modules/gridy-grid/src/gridy-grid.js';
    let data = [];
    data.push({ name: 'FooBar1', value: 100, group: 'sales' });
    data.push({ name: 'FooBar1', value: 100, group: 'markt' });
    data.push({ name: 'FooBar2', value: 230, group: 'sales' });
    data.push({ name: 'FooBar2', value: 230, group: 'markt' });
    data.push({ name: 'FooBar3', value: 340, group: 'sales' });
    data.push({ name: 'FooBar3', value: 340, group: 'markt' });
    data.push({ name: 'FooBar4', value: 170, group: 'sales' });
    data.push({ name: 'FooBar4', value: 170, group: 'markt' });
    data.push({ name: 'FooBar5', value: 570, group: 'sales' });
    data.push({ name: 'FooBar5', value: 570, group: 'markt' });
    let grid = document.querySelector('#gridyGrid');
    grid.addEventListener('bootstrap', () => {
        grid.charts[0].addEventListener('skrender', (event) => {
            grid.dataSource.loadData(data);
        });
    });
    customElements.define('gridy-grid', GridyGrid);
</script>

Options

you can specify options for echarts as attribute of gridy-chart.

When xAxis or yAxis specified as string it will be populated from chart driver context by name. Note: some chart types may require at least empty x(y)Axis in options.

	<gridy-chart id="gridyChart2" options='{"xAxis": { "data": "names" }, "yAxis": {}}' type="line" dri="echarts" field-name="Name" field-value="Value" field-group="Group" inner-radius="50" width="400" height="400"></gridy-chart> 

JSONPath expressions on the same chart driver context are also supported for data fields.

attributes

echarts-renderer - renderer parameter for echarts init, possible options: 'svg', 'canvas' (default: 'canvas')

echarts-theme - theme parameter for echarts init (default: null)

value-field passes data extracted from specified field to option.series.data array, if not specified item is passed 'as-is' after mapping