VSeed, an elegant data composer, transforming complexity into simplicity.
!!!###!!!title=Taro VChart——VisActor/VChart tutorial documents!!!###!!!!!!###!!!description=[Taro](https://docs.taro.zone/docs/) is a commonly used cross-end and cross-frame solution. VChart specially encapsulates the corresponding chart component based on the Taro framework: `@visactor/taro-vchart`.- Warehouse address: [taro-vchart](https://github.com/VisActor/VChart/tree/main/packages/taro-vchart)- Example address: [taro-vchart-example](https://github.com/VisActor/taro-vchart-example)!!!###!!!
Taro VChart
Taro is a commonly used cross-end and cross-frame solution. VChart specially encapsulates the corresponding chart component based on the Taro framework: @visactor/taro-vchart.
@visactor/taro-vchart The method of chart component is very simple, the steps are as follows:
Introduce chart component: import VChart from '@visactor/taro-vchart'
Declare the chart component and declare necessary attributes
The type attribute is used to declare the environment parameters. It does not need to be declared. Taro.getEnv() will be used by default internally.
canvasId must be passed, used to identify the internal canvas component
spec is the corresponding VChart chart configuration item
The following is an example code for a column chart. For details, you can download our example project: taro-vchart-example for field running experience.
The configured environment. Currently, the environments supported by the component are: WeChat mini program ('weapp'), Byte mini program ('tt'), Feishu mini program('lark'), browser('web'), h5 mobile('h5')
Taro-VChart inherently supports on-demand loading. When on-demand loading of VChart is required, there are two methods:
Use the <VChartSimple /> tag to implement custom on-demand loading.
Supported from version 1.10.0
The <VChartSimple /> component and the <VChart /> component are almost identical in usage. The only difference is that users need to import the VChart constructor class from @viasctor/vchart/esm/core, register the required charts and components as described in this document, and pass them to <VChartSimple />.
Use semantic tags, all of which support on-demand loading by default. The default registered components for each type of semantic tag are as follows:
Supported from version 1.12.0
Chart
Category
Additional Registered Components
<LineChart/>
Cartesian Charts
registerLabel
<AreaChart/>
Cartesian Charts
registerLabel, registerTotalLabel
<BarChart/>
Cartesian Charts
registerLabel, registerTotalLabel
<Bar3dChart/>
Cartesian Charts
registerLabel, registerTotalLabel
<BoxPlotChart/>
Cartesian Charts
registerLabel,
<HeatmapChart/>
Cartesian Charts
registerLabel
<Histogram3dChart/>
Cartesian Charts
registerLabel
<HistogramChart/>
Cartesian Charts
registerLabel
<LinearProgressChart/>
Cartesian Charts
registerLabel
<RangeColumnChart/>
Cartesian Charts
registerLabel
<RangeColumn3dChart/>
Cartesian Charts
registerLabel
<ScatterChart/>
Cartesian Charts
registerLabel
<SequenceChart/>
Cartesian Charts
registerLabel
<WaterfallChart/>
Cartesian Charts
registerLabel, registerTotalLabel
<RadarChart/>
Polar Charts
registerLabel
<RoseChart/>
Polar Charts
registerLabel
<CircularProgressChart/>
Polar Charts
registerLabel, registerIndicator
<Pie3dChart/>
General Charts
registerLabel, registerIndicator
<PieChart/>
General Charts
registerLabel, registerIndicator
<CirclePackingChart/>
General Charts
None
<FunnelChart/>
General Charts
registerLabel
<Funnel3dChart/>
General Charts
registerLabel
<GaugeChart/>
General Charts
None
<MapChart/>
General Charts
registerLabel
<SankeyChart/>
General Charts
None
<SunburstChart/>
General Charts
None
<TreemapChart/>
General Charts
None
<VennChart/>
General Charts
None
<WordCloud3dChart/>
General Charts
None
<WordCloudChart/>
General Charts
None
<LiquidChart/>
General Charts
registerIndicator
For Cartesian charts, the default registered components are as follows:
registerCartesianLinearAxis
registerCartesianBandAxis
registerCartesianTimeAxis
registerCartesianLogAxis
registerCartesianCrossHair
registerBrush
registerContinuousLegend
registerDataZoom
registerDiscreteLegend
registerCustomMark
registerAllMarks
registerMarkArea
registerMarkLine
registerMarkPoint
registerScrollBar
registerTitle
registerTooltip
registerCanvasTooltipHandler
For Polar charts, the default registered components are as follows:
registerPolarLinearAxis
registerPolarBandAxis
registerPolarCrossHair
registerBrush
registerContinuous Legend
registerDataZoom
registerDiscreteLegend
registerCustomMark
registerAllMarks
registerScrollBar
registerTitle
registerTooltip
registerCanvasTooltipHandler
For General charts, the default registered components are as follows:
registerDiscreteLegend
registerContinuousLegend
registerCustomMark
registerAllMarks
registerTitle
registerTooltip
registerCanvasTooltipHandler
When using semantic tags, if you need components that are not loaded by default, you only need to register the missing components.