xm-charts-vue v2.0.4
xm-charts-vue
用法
npm install -S xm-charts-vue
import Vue from 'vue'
import Chart, { VChart, BarChart, LineChart, AreaChart, PieChart, MapChart, registerTheme, registerMap } from 'xm-charts-vue'
Vue.use(Chart) // 整体
Vue.use(BarChart)Props (all reactive)
initOptionsUsed to initialize ECharts instance.
themeThe theme used for current ECharts instance.
optionsUsed to update data for ECharts instance. Modifying this prop will trigger ECharts'
setOptionmethod.If you mutate the data bound to
optionswhile retaining the object reference,setOptionwill be called withnotMerge: false. Otherwise, if you bind a new object tooptions,setOptionwill be called withnotMerge: true.For example, if we have the following template:
<v-chart :options="data" />Then:
this.data = newObject // setOption(this.options, true) this.data.title.text = 'Trends' // setOption(this.options, false)groupThis prop is automatically bound to the same prop of the ECharts instance.
autoresize(default:false)This prop indicates ECharts instance should be resized automatically whenever its root is resized.
manual-update(default:false)For performance critical scenarios (having a large dataset) we'd better bypass Vue's reactivity system for
optionsprop. By specifyingmanual-updateprop withtrueand not providingoptionsprop, the dataset won't be watched any more. After doing so, you need to retrieve the component instance withrefand manually callmergeOptionsmethod to update the chart.
Computed
widthreadonlyUsed to retrieve the current width of the ECharts instance.
heightreadonlyUsed to retrieve the current height of the ECharts instance.
computedOptionsreadonlyUsed to retrive the actual options calculated by ECharts after updating
options.
Methods
mergeOptions(usesetOptionin ECharts under the hood)Provides a better method name to describe the actual behavior of
setOption.appendDataresizedispatchActionshowLoadinghideLoadingconvertToPixelconvertFromPixelcontainPixelgetDataURLgetConnectedDataURLcleardispose
Static Methods
connectdisconnectregisterMapregisterThemegraphic.clipPointsByRectgraphic.clipRectByRect
Events
Vue-ECharts support the following events:
legendselectchangedlegendselectedlegendunselectedlegendscrolldatazoomdatarangeselectedtimelinechangedtimelineplaychangedrestoredataviewchangedmagictypechangedgeoselectchangedgeoselectedgeounselectedpieselectchangedpieselectedpieunselectedmapselectchangedmapselectedmapunselectedaxisareaselectedfocusnodeadjacencyunfocusnodeadjacencybrushbrushselectedrenderedfinished- Mouse events
clickdblclickmouseovermouseoutmousemovemousedownmouseupglobaloutcontextmenu
- ZRender events (since v4.1.0)
clickmousedownmouseupmousewheeldblclickcontextmenu
For further details, see ECharts' API documentation.
Local development
$ npm i
$ npm run serveOpen http://localhost:8080/ to see the demo.