All Projects → eyelly-wu → taro-echarts

eyelly-wu / taro-echarts

Licence: MIT License
适用于 Taro 项目的 ECharts 图表组件,欢迎提 PR

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
SCSS
7915 projects
HTML
75241 projects

Projects that are alternatives of or similar to taro-echarts

gangxiaoer-taro
博雅塔小程序,基于Taro的版本,同步发布百度小程序,支付宝小程序。
Stars: ✭ 16 (-62.79%)
Mutual labels:  taro
data-visualization
🔗 configurable data visualization
Stars: ✭ 18 (-58.14%)
Mutual labels:  echarts
weapp-clover
由零打造的,基于taro,zoro的电商小程序实战项目
Stars: ✭ 77 (+79.07%)
Mutual labels:  taro
react-visualized-platform
🐞 基于 React 的雾霾数据爬虫分析平台
Stars: ✭ 31 (-27.91%)
Mutual labels:  echarts
zabbix-monitor
monitor system based on zabbix API pyzaabix grafana
Stars: ✭ 70 (+62.79%)
Mutual labels:  echarts
charts
📊 A set of charts based on rsuite and ECharts
Stars: ✭ 65 (+51.16%)
Mutual labels:  echarts
classmate-map
🧭 一款设计精美、体验优良的地图信息展示小程序,一个更有意思的同学录,可以在小程序中查看班级同学的毕业去向以及地域分布,多联(蹭)系(饭)。
Stars: ✭ 79 (+83.72%)
Mutual labels:  taro
tw-echarts
An All-in-one Visualization Framework for TiddlyWiki5 based on ECharts
Stars: ✭ 17 (-60.47%)
Mutual labels:  echarts
Taro-v2ex-weapp
awesome v2ex weapp 😎 目前支持微信小程序、支付宝小程序、h5
Stars: ✭ 25 (-41.86%)
Mutual labels:  taro
vue-echarts
Apache ECharts component for Vue.js.
Stars: ✭ 6,891 (+15925.58%)
Mutual labels:  echarts
taro-best-practices
使用 Taro 开发微信小程序、编译 H5 + React Native 的最佳实践
Stars: ✭ 118 (+174.42%)
Mutual labels:  taro
tarojs-router-next
Taro 小程序路由库/自动生成带参数类型提示的路由方法/允许传递任意类型、任意大小的参数数据/同步的路由方法调用/koa体验一致的路由中间件
Stars: ✭ 166 (+286.05%)
Mutual labels:  taro
EChartsAnnotation
ECharts的Java注解框架
Stars: ✭ 22 (-48.84%)
Mutual labels:  echarts
Taro-ParserRichText
适用于 Taro 的小程序富文本组件
Stars: ✭ 32 (-25.58%)
Mutual labels:  taro
recharts2
An R Interface to Baidu Echart3 Library
Stars: ✭ 31 (-27.91%)
Mutual labels:  echarts
k-line
股票、虚拟币交易k线图
Stars: ✭ 32 (-25.58%)
Mutual labels:  echarts
vue-kai-admin
学习vue-admin架构,顺便记录工作的组件
Stars: ✭ 31 (-27.91%)
Mutual labels:  echarts
stm32 wifi
stm32 + esp8266 + Express + MySQL + AngularJS + MUI +Maibu(技术过于陈旧, 仅供参考)
Stars: ✭ 0 (-100%)
Mutual labels:  echarts
taroWxParse
taro框架wxParse纯净封装组件,来源于项目实战,随下随用
Stars: ✭ 24 (-44.19%)
Mutual labels:  taro
eshop
Taro • 云开发电商小程序示例
Stars: ✭ 70 (+62.79%)
Mutual labels:  taro

Taro-Echarts

适用于Taro项目的ECharts图表组件,基于项目echarts-for-weixin封装

安装

npm i -S taro-echarts

配置

修改Taro项目的配置config/index

  1. copy
copy: {
  patterns: [
    // 需添加如下配置
    {
      from: 'node_modules/taro-echarts/components/ec-canvas/',
      to: 'dist/npm/taro-echarts/components/ec-canvas',
      ignore: ['ec-canvas.js', 'wx-canvas.js']
    }
  ],
  options: {
  }
}
  1. h5.esnextModules
h5: {
  // 需添加如下配置
  esnextModules: ['taro-echarts'],
  ...
}

使用

引入

import Chart from 'taro-echarts'

示例代码:以折线图为例

<Chart
  option={{
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      data: [820, 932, 901, 934, 1290, 1330, 1320],
      type: 'line'
    }]
  }}
/>

API

属性名 说明 类型 默认值
width 图表的宽 string 100%
height 图表的高 string 200px
option ECharts的option配置 object -
onBeforeSetOption 在echarts首次调用setOption前执行该方法,该方法会返回echarts的引用,可以在该方法中注册地图注册主题 (echarts)=>void -
customStyle 自定义容器样式 string -
loading 是否显示loading效果 bool false
loadingConf loading效果的样式配置 object -

支持度

h5 微信小程序 ReactNative 支付宝小程序 百度小程序 字节跳动小程序
× × × ×

微信小程序获取图片示例代码

import Taro, { Component } from '@tarojs/taro'
import { View, Button } from '@tarojs/components'
import Chart from 'taro-echarts'

export default class Page extends Component {

  setChartRef = node => this.chartRef = node

  preview = async () => {
    // 获取到临时图片地址
    const path = await this.chartRef.getImagePath()
    Taro.previewImage({ current: path, urls: [path] })
  }

  render() {
    return (
      <View>
        <Button onClick={this.preview}>查看生成图片</Button>
        <Chart
          ref={this.setChartRef}
          loadingConf={{ textColor: 123 }}
          option={{
            xAxis: {
              type: 'category',
              data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
              type: 'value'
            },
            series: [{
              data: [820, 932, 901, 934, 1290, 1330, 1320],
              type: 'line'
            }]
          }}
        />
      </View>
    )
  }
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].