Components
<VChart>
<VChart> brings full ECharts functionality to your Nuxt app.
If ssr
is turned on, <VChart>
will render a chart on the server then on the client once mounted in the browser.
Usage of
VChart
is almost the same as Vue-ECharts
. Besides, VChart
provides functionality of Server-side Rendering.When
ssr
is turned on, the client 'halve' of <VChart>
is based on Nuxt client-only component which is rendered only after being mounted. To access the rendered template using onMounted()
, add await nextTick()
in the callback of the onMounted()
hook.Props
init-options
: Optional chart init configurations. Seeecharts.init
'sopts
parameter.- type:
object
- Injection key:
INIT_OPTIONS_KEY
.
- type:
theme
: Theme to be applied. Seeecharts.init
'stheme
parameter.- type:
string
orobject
- Injection key:
THEME_KEY
.
- type:
option
: ECharts' universal interface. Modifying this prop will trigger ECharts'setOption
method. Read more here →.- type:
object
- type:
When
update-options
is not specified, notMerge: false
will be specified by default when the setOption
method is called if the option
object is modified directly and the reference remains unchanged; otherwise, if a new reference is bound to option
, notMerge: true
will be specified.update-options
: Options for updating chart option. SeeechartsInstance.setOption
'sopts
parameter.- type:
object
- Injection key:
UPDATE_OPTIONS_KEY
.
- type:
group
: Group name to be used in chart connection. SeeechartsInstance.group
.- type:
string
- type:
autoresize
: Whether the chart should be resized automatically whenever its root is resized. Use the options object to specify a custom throttle delay (in milliseconds) and/or an extra resize callback function.- type:
boolean
or{ throttle?: number, onResize?: ResizeObserverCallback }
- default:
false
- type:
loading
: Whether the chart is in loading state.- type:
boolean
- default:
false
- type:
loading-options
: Configuration item of loading animation. SeeechartsInstance.showLoading
'sopts
parameter.- type:
object
- Injection key:
LOADING_OPTIONS_KEY
.
- type:
manual-update
: For performance critical scenarios (having a large dataset) we'd better bypass Vue's reactivity system foroption
prop. By specifyingmanual-update
prop withtrue
and not providingoption
prop, the dataset won't be watched any more. After doing so, you need to retrieve the component instance withref
and manually callsetOption
method to update the chart.- type:
boolean
- default:
false
- type:
Events
You can bind events with Vue's v-on
directive.
<template>
<VChart :option="option" @highlight="handleHighlight" />
</template>
Only the
.once
event modifier is supported as other modifiers are tightly coupled with the DOM event system.highlight
downplay
selectchanged
legendselectchanged
legendselected
legendunselected
legendselectall
legendinverseselect
legendscroll
datazoom
datarangeselected
timelinechanged
timelineplaychanged
restore
dataviewchanged
magictypechanged
geoselectchanged
geoselected
geounselected
axisareaselected
brush
brushEnd
brushselected
globalcursortaken
rendered
finished
- Mouse events
- ZRender events
zr:click
zr:mousedown
zr:mouseup
zr:mousewheel
zr:dblclick
zr:contextmenu
Native DOM Events
As <VChart>
binds events to the ECharts instance by default, there is some caveat when using native DOM events. You need to prefix the event name with native:
to bind native DOM events.
<template>
<v-chart @native:click="handleClick" />
</template>