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

@echarts-start/vue-bridge

v0.5.0

Published

echarts bridge for vue

Downloads

12

Readme

vue-bridge

echarts vue bridge

Necessary

1. window对象注入echart. <script type="text/javascript" src="//cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
2. 需要 "lodash": "^4.x", "vue": "2.6.x"

Install

yarn add @echarts-start/vue-bridge

Usage

common

推荐使用

import { XAxis, YAxis, Dataset, Series, Tooltip, Legend, Chart } from "@echarts-start/vue-bridge";

  data(){
    return {
        loading: false,
          dimensions: ["product", "2015", "2016", "2017"],
          chartData : [
            { product: "Matcha Latte", "2015": 43.3, "2016": 85.8, "2017": 93.7 },
            { product: "Milk Tea", "2015": 83.1, "2016": 73.4, "2017": 55.1 },
            { product: "Cheese Cocoa", "2015": 86.4, "2016": 65.2, "2017": 82.5 },
            { product: "Walnut Brownie", "2015": 72.4, "2016": 53.9, "2017": 39.1 },
          ]
    }
  }

<Chart
  style="width: 100%; height: 400px"
  backgroundColor="rgba(0,0,0,0.1)"
  :loading="loading"
  :resize="true"
  :onChartClick="handleChartClick"
>
      <XAxis type="category" />
      <YAxis />
      <Dataset :source="chartData" :dimensions="dimensions" />
      <Series type="line" />
      <Series type="line" />
      <Series type="line" />
      <Tooltip trigger="axis" />
      <Legend />
    </Chart>

base

基础使用

import { XAxis, YAxis, Dataset, Series, Tooltip, Legend, BaseChart, MethodLoading, MethodResize, Event } from
"@echarts-start/vue-bridge";

<BaseChart style="width: 100%; height: 400px">
      <XAxis type="category" />
      <YAxis />
      <Dataset :source="chartData" :dimensions="dimensions" />
      <Series type="line" />
      <Series type="line" />
      <Series type="line" />
      <Tooltip trigger="axis" />
      <Legend />
      <MethodLoading :loading="loading" />
      <MethodResize :resize="true" />
      <Event eventName="click" :eventHandler="handleChartClick" />
    </BaseChart>

ref

操作 chart 对象

import { Chart } from "@echarts-start/vue-bridge";
<Chart style="width: 100%; height: 400px" :chartRef="handleChartInit" />
  handleChartInit(chart: IEChart) {
    chart.setOption({
      legend: {},
      tooltip: { trigger: "axis" },
      xAxis: { type: "category" },
      yAxis: {},
      series: [{ type: "line" }, { type: "line" }, { type: "line" }],
      dataset: { dimensions: this.dimensions, source: this.chartData },
    });
  }

props && 响应

series props 兼容;

series有多个类型,且每个类型有多个属性,每个属性都注册的话,打包后的代码会特别大。
现有属性只支持dataset模式;
其他属性需要写入series对象;

options 数据响应设计;

需要响应的属性要写入对应名字的对象中,如:
<c-series type="line" :series="{ data: [] }" />
其中data就是响应属性,其他options组件一样如此。换句话说,所有的属性写入响应对象也是完全可以的。
ps:dataset的source和dimensions是支持响应的。

详细 demo