当前位置: 首页 > news >正文

微信小程序制作精灵搜狗seo快速排名公司

微信小程序制作精灵,搜狗seo快速排名公司,北京最新疫情介绍,长沙制作网站设计多少钱【Echarts系列】水平柱状图 序示例数据格式代码 序 为了节省后续开发学习成本,这个系列将记录我工作所用到的一些echarts图表。 示例 水平柱状图如图所示: 数据格式 data [{name: 于洪区,value: 2736},{name: 新民市,value: 2844},{name: 皇姑区,…

【Echarts系列】水平柱状图

    • 示例
    • 数据格式
    • 代码

为了节省后续开发学习成本,这个系列将记录我工作所用到的一些echarts图表。

示例

水平柱状图如图所示:
在这里插入图片描述

数据格式

data = [{'name': '于洪区','value': 2736},{'name': '新民市','value': 2844},{'name': '皇姑区','value': 2889},{'name': '沈河区','value': 3143}]

代码

Vue版本以及脚本语言的选择各有不同,核心内容主要是option,重点关注该部分内容即可。

<template><div class="chart" ref="horizontalBarRef"></div>
</template><script lang="ts">
import { Component, Prop, Ref, Vue, Watch } from 'vue-property-decorator'
import echarts from 'echarts'@Component({name: 'HorizontalBar',components: {}
})
export default class HorizontalBar extends Vue {@Prop() data!: any@Prop({ default: () => ['rgba(72, 133, 201, 0.6)', 'rgba(72, 133, 201, 1)']}) colors?: any[]@Ref() horizontalBarRef!: any//此处监听是为了在有状态切换时,例如时间年份或其他条件改变时,能够让Echarts图表重新渲染@Watch('data')onDataChange() {this.createHorizontalBarChart()}private chart: any = {}createHorizontalBarChart() {this.chart = echarts.init(this.horizontalBarRef)const data = this.datalet names = []let values = []data.forEach(item => {names.push(item.name)values.push(item.value)})const option = {tooltip: {trigger: 'axis',axisPointer: {type: 'shadow'},confine: true,         //让提示框恒定在网格容器内,【针对显示不全或者被遮盖问题】},grid: {left: 20,right: 40,top: 0,bottom: 20,containLabel: true     //网格边距包含坐标标签},xAxis: {axisTick: {show: false          //是否显示X轴坐标刻度},axisLabel: {show: false		   //是否显示X轴坐标标签},axisLine: {show: false		   //是否显示X轴轴线},splitLine: {lineStyle: {type: 'dashed'	   //以虚线形式展示X轴在网格中的分隔线}}},yAxis: {type: 'category',data: names,axisTick: {show: false,alignWithLabel: true    //刻度与坐标标签对齐},axisLine: {show: true,lineStyle: {color: '#757790',     //设置Y轴轴线样式width: 2}},axisLabel: {textStyle: {color: '#757790',	 //设置Y轴坐标标签样式fontSize: 14}},splitLine: {show: false			//是否展示Y轴方向上的分隔线}},series: [{type: 'bar',barWidth: 10,itemStyle: {color: {type: 'linear',			//设置柱状条的渐变颜色x: 0,y: 0,x2: 1,y2: 0,colorStops: [{ offset: 0, color: this.colors[0] }, // 0% 处的颜色{ offset: 1, color: this.colors[1] } // 100% 处的颜色],global: false // 缺省为 false}},label: {show: true,				//展示柱状条数值信息position: 'right',color: '#12121D',fontSize: 14},data: values}]}this.chart.setOption(option)}mounted() {this.createHorizontalBarChart()window.addEventListener('resize', this.chartResize)}beforeDestroy() {if (this.chart) {window.removeEventListener('resize', this.chartResize)this.chart.dispose()}}chartResize() {if (this.chart) {this.chart.resize()}}
}
</script>
<style lang="scss" scoped>
.chart {width: 100%;height: 300px;
}
</style>
http://www.hkea.cn/news/951699/

相关文章:

  • 普通网站报价多少中南建设集团有限公司
  • 蚌埠做网站哪家好全网营销国际系统
  • 沈阳市网站制作谷歌香港google搜索引擎入口
  • 做美食网站的背景高端网站建设制作
  • 文件什么上传到wordpress泉州seo技术
  • 网站地址地图怎么做网页制作的软件有哪些
  • 如何用万网建设网站口碑营销策划方案
  • 做网站的基础架构东莞seo建站公司
  • 嘉兴做网站的哪家好龙岗网站制作
  • 论坛做网站好吗百度官方网页
  • 微信开发者工具获取系统日期seo优化一般包括
  • 怎么用文本做网站百度排行榜风云榜
  • 未来网站开发需求多搜索网站有哪几个
  • 网站建设 成都郑州高端网站制作
  • 快站怎么做淘客网站深圳关键词
  • 做网站时如何去掉网站横条小红书软文案例
  • 图虫南宁百度快速排名优化
  • 上城网站建设app推广文案
  • 网站建设特点宁波seo搜索引擎优化公司
  • 地产商网站建设网球新闻最新消息
  • 做爰全过程网站免费的视频谷歌seo搜索引擎
  • 怎么架设网站seo推广培训
  • 自己网站做问卷调查网页设计学生作业模板
  • 清远企业网站排名深圳网站建设系统
  • 互助平台网站建设费用卡点视频免费制作软件
  • 上海做b2b国际网站公司排名优化公司电话
  • 裙晖wordpress重庆seo整站优化
  • 乌克兰网站后缀谷歌浏览器下载电脑版
  • 建设部网站撤销注册资质的都是公职人员吗正规网络公司关键词排名优化
  • 杂志网站建设推广方案铜川网络推广