🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

if-charts

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

if-charts

Charts Option Generator

unpublished
latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

How to Use

<!-- main.js -->
import IfChart from 'if-charts'
app.use(IfChart)
<!-- App.vue -->
<if-chart @ready="init => ready(init)" height="100px" theme="MileStone" />

setup(){
    const DataSet = {
        MileStoneData(g) {
            g.setGroupV({
                'yAxis.data': ['Mon', 'Tue', "Wen"],
                'series.0.name': 'MYData',
                'series.0.data': [100, 200, 300],
            })
        },
        ChargeTimesData(g) {
            g.setGroupV({
                'series.0.data': [
                    { value: 1048, name: '高峰时段' }, 
                    { value: 735, name: '平时段' }, 
                    { value: 580, name: '低估时段' }]
            })
        }
    }

    const ready = (init) => {
        let generator = init()
        DataSet.MileStoneData(generator)

    }
    return {ready}
}

Props

PropDescDefault
width图表宽度100%
height图表高度,{num}px200px
options用于echarts的option配置{}
types图表加载类型,数组['line', 'bar', 'pie', 'custom']
resize布尔值,是否支持resize变化true
clickEnable布尔值,是否支持图表点击true
theme使用echarts主题MileStone

Event

EventDescDemo
resize(echart)监听resize变化触发@resize
chartClickecharts点击事件@chart-click
ready图表ready事件,获取OptionGenerator@ready

Theme

NameDescSettingDemo
MileStone里程碑{'series.0.name', 'series.0.data'}
ChargeTimes时段{series.0.data}
ChargePolar环形饼图{title.0.text, series.0.data}
TrendChart折线/柱状图{legend.data, xAxis.data, series.0.name, series.0.data, series.1.name, series.1.data}

OptionGenerator

ready事件返回一个配置生成器的实例,该实例与图表的option绑定。通过修改实例,自动更新图表。

EventDesc
setGroupV(obj)批量设置optionsetGroupV({'series.0.name': 'Data01', 'series.0.name': 'Data02'})
setV(key, value)设置单个optionsetV('legend.data', ['Data01', 'Data02'])

FAQs

Package last updated on 26 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts