Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize three-dimensional histogram with vue3.0+echarts

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to use vue3.0+echarts to achieve three-dimensional bar chart", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use vue3.0+echarts to achieve three-dimensional bar chart" bar!

Foreword:

Realization of echarts Stereo histogram by vue3.0

Achieve results:

Implementation steps:

1. Install echarts

Cnpm I-- save echarts

2. Page definition container

3. Introducing echarts into js

Export default {setup () {let state = reactive ({xAxisData: ['Hao Xing', 'Yan Zai', 'Doraemon','Li Qiang', 'Wang Ying', 'Lao Wang'), yAxisData: [4 var myChart 22, 11], yAxisData1: [1], echart: ref (),}) const echartInit = () = > {var myChart = echarts.init (state.echart) / / specify the configuration items and data of the chart var option = {tooltip: {trigger: "axis", axisPointer: {type: "shadow", / / default is straight line Optional: 'line' |' shadow'}, formatter: function (parms) {var str = parms [0] .axisValue + "" + parms [0] .value + "Login today:" + parms [0] .value + 'times' return str },}, textStyle: {color: "# 333",}, color: ["# 7BA9FA", "# 4690FA"], grid: {containLabel: true, left: "10%", top: "20%", bottom: "10%", right: "10%" }, xAxis: {type: "category", data: state.xAxisData, axisLine: {lineStyle: {color: "# 333",},}, axisTick: {show: false,}, axisLabel: {margin: 20 / / the distance between the scale label and the axis. TextStyle: {color: "# 000",}, yAxis: {type: "value", axisLine: {show: true, lineStyle: {color: "# B5B5B5",},} SplitLine: {lineStyle: {/ / use interval colors color: ["# B5B5B5"], type: "dashed", opacity: 0.5,},}, axisLabel: {},} Series: [{data: state.yAxisData, stack: "zs", type: "bar", barMaxWidth: "auto", barWidth: 60, itemStyle: {color: {x: 0, y: 0, x2: 0, y2: 1 Type: "linear", global: false, colorStops: [{offset: 0, color: "# 5EA1FF",}, {offset: 1, color: "# 90BEFF",},] }, / / the solid below, the color control is color's first {data: state.yAxisData1, type: "pictorialBar", barMaxWidth: "20", symbol: "diamond", symbolOffset: [0,50% "], symbolSize: [60 15], zlevel: 2,}, / / the solid above, the control color is color's second {data: state.yAxisData, type: "pictorialBar", barMaxWidth: "20", symbolPosition: "end", symbol: "diamond", symbolOffset: [0, "- 50%"] SymbolSize: [60, 12], zlevel: 2,}],} / / display the chart using the configuration items and data you just specified. MyChart.setOption (option);} / Mount onMounted (() = > {echartInit ()}) return {... toRefs (state), echartInit};}} .echartDiv {width: 100%; height: 400px Thank you for your reading, the above is the content of "how to use vue3.0+echarts to achieve three-dimensional histogram". After the study of this article, I believe you have a deeper understanding of how to use vue3.0+echarts to achieve three-dimensional histogram, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report