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

江门做网站公司网络运营培训班

江门做网站公司,网络运营培训班,用照片做模板下载网站好,wordpress ormECharts:一个基于 JavaScript 的开源可视化图表库。 目录 效果 一、介绍 1、官方文档:Apache ECharts 2、官方示例 二、准备工作 1、安装依赖包 2、示例版本 三、使用步骤 1、在单页面引入 echarts 2、指定容器并设置容器宽高 3、数据处理&am…

 ECharts:一个基于 JavaScript 的开源可视化图表库。

目录

效果

一、介绍

 1、官方文档:Apache ECharts

2、官方示例

二、准备工作

1、安装依赖包

 2、示例版本 

三、使用步骤

1、在单页面引入 ' echarts '

2、指定容器并设置容器宽高

3、数据处理(关键点)

四、完整示例

tips

xAxis. interval  试一试


效果

一、介绍

 1、官方文档:Apache ECharts

Apache EChartsApache ECharts,一款基于JavaScript的数据可视化图表库,提供直观,生动,可交互,可个性化定制的数据可视化图表。https://echarts.apache.org/zh/index.html

2、官方示例

二、准备工作

1、安装依赖包

npm install echarts --save

 2、示例版本 

"echarts": "^5.4.2",

三、使用步骤

1、在单页面引入 ' echarts '

import * as echarts from "echarts";

注:上面的代码会引入 ECharts 中所有的图表和组件,如果你不想引入所有组件,也可以使用 ECharts 提供的按需引入的接口来打包必须的组件。详见官方文档:在项目中引入 ECharts - 入门篇 - Handbook - Apache ECharts

2、指定容器并设置容器宽高

<template><div id="main"></div>
</template><script>import * as echarts from "echarts";export default {name: "mutiYAxis",data() {return {};},methods: {initChart() {let data = this.datalet chartDom = document.getElementById("main");let myChart = echarts.init(chartDom);let option;...详见完整示例   },},};
</script><style scoped>#main {width: 1000px;height: 500px;}
</style>

3、数据处理(关键点)

        1)数据格式为一维数组

dataList: [[0, 221.6503],[35.564, 198.3526],[68.154, 168.4582],[108.124, 145.4562],[136.357, 128.1254],[158.354, 99.6574],[227.137, 58.5234],[268.854, 36.8563],[324.358, 21.2563],[385.135, 11.7854],[462.568, 0.35413]
]

        2)X轴type设为value

xAxis: [{name: 'xAxisName',nameLocation: 'center',nameGap: 40,type: 'value',boundaryGap: false......}]

        3)  X轴固定间隔并向上取整十位数 + 设置最大值和最小值

向上取整的更多示例请看这里 =》CSDN

let xMax = Math.ceil(dataList[dataList.length - 1][0] / 20) * 20;xAxis: [{name: 'xAxisName',nameLocation: 'center',nameGap: 40,type: 'value',boundaryGap: false,min: 0,    max: xMax,     interval: 20, // 无法在类目轴中使用。......}]

        4) dataZoom的type设为inside

dataZoom: [{type: 'inside' // 内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。
}]

        5)  toolbox的feature的dataZoom即使是空对象也要保留,否则会没有缩放icon

toolbox: {show: true,feature: {// dataZoom 空对象也要保留,否则会没有缩放icondataZoom: {},restore: {show: true}},right: '2%',
}

注:部分方法/数据的完整版在完整示例展示

四、完整示例

<template><div class="typeValue"><div id="main"></div></div>
</template><script>
import * as echarts from "echarts";export default {name: "typeValue",data() {return {result: {dataList: [[0, 221.6503],[35.564, 198.3526],[68.154, 168.4582],[108.124, 145.4562],[136.357, 128.1254],[158.354, 99.6574],[227.137, 58.5234],[268.854, 36.8563],[324.358, 21.2563],[385.135, 11.7854],[462.568, 0.35413],],seriesName: '名称'},};},mounted() {this.$nextTick(() => {this.initChart(this.result);});},methods: {initChart(data) {let chartDom = document.getElementById("main");let myChart = echarts.init(chartDom);let option;const { dataList, seriesName } = data;if (dataList === null || dataList.length === 0) return;let legendData = [];legendData.push(seriesName);let xMax = Math.ceil(dataList[dataList.length - 1][0] / 20) * 20;option = {title: {left: '10%',top: '3%',text: 'title',},grid: {left: '12%'},toolbox: {show: true,feature: {// dataZoom 空对象也要保留,否则会没有缩放icondataZoom: {},restore: {show: true}},right: '2%',},tooltip: {trigger: "axis",borderColor: 'rgba(226,231,234,0.75)',borderRadius: 4,backgroundColor: 'rgba(240,244,248,0.75)',textStyle: {color: '#333',fontSize: 13},formatter: function (params) {const { data } = params[0]return `(${data[0]}, ${data[1]})`;},},legend: {type: "scroll",data: legendData,textStyle: {color: "#999"}},xAxis: [{name: 'xAxisName',nameLocation: 'center',nameGap: 40,type: 'value',boundaryGap: false,min: 0,    max: xMax,     interval: 20, // 无法在类目轴中使用。boundaryGap: false,axisLabel: {show: true,},splitLine: {show: false,},axisTick: {show: false,},axisLine: {show: true,}}],yAxis: [{type: 'value',boundaryGap: [0, '100%'],name: 'yAxisName',nameLocation:'center',nameGap: 40,splitLine: {show: false,},axisTick: {show: false,},axisLabel: {show: true,},axisLine: {show: true,},}],series: [{name: data.seriesName,type: "line",symbol: 'none',sampling: 'lttb',itemStyle: {color: 'rgb(255, 70, 131)'},areaStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0,color: 'rgb(255, 158, 68)'},{offset: 1,color: 'rgb(255, 70, 131)'}])},data: dataList,}],dataZoom: [{type: 'inside' // 内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。}]};option && myChart.setOption(option);},},
}
</script><style lang="less" scoped>
#main {width: 1000px;height: 500px;
}
</style>

tips

1、X轴的type一般都是category,假如该示例的type为category,图形会如下图所示,很显然数据显示有问题,所以务必要修改type为value

2、X轴设置interval,无法在类目轴中使用。由于需要设置interval,因此X轴的type改为value

Documentation - Apache ECharts

xAxis. interval  试一试

number

强制设置坐标轴分割间隔。

因为 splitNumber 是预估的值,实际根据策略计算出来的刻度可能无法达到想要的效果,这时候可以使用 interval 配合 min、max 强制设定刻度划分,一般不建议使用。

无法在类目轴中使用。在时间轴(type: 'time')中需要传时间戳,在对数轴(type: 'log')中需要传指数值。


文章转载自:
http://ovariotome.c7630.cn
http://convoy.c7630.cn
http://krewe.c7630.cn
http://codlinsandcream.c7630.cn
http://spireme.c7630.cn
http://tetrahydrofurfuryl.c7630.cn
http://cynicism.c7630.cn
http://imperatival.c7630.cn
http://fang.c7630.cn
http://exocrine.c7630.cn
http://faveolate.c7630.cn
http://viola.c7630.cn
http://enchantment.c7630.cn
http://seagoing.c7630.cn
http://rosemaled.c7630.cn
http://trinketry.c7630.cn
http://ferule.c7630.cn
http://symbiose.c7630.cn
http://bedel.c7630.cn
http://falchion.c7630.cn
http://variometer.c7630.cn
http://recordist.c7630.cn
http://incoherency.c7630.cn
http://shipboard.c7630.cn
http://succory.c7630.cn
http://sew.c7630.cn
http://oxheart.c7630.cn
http://riposte.c7630.cn
http://traductor.c7630.cn
http://nora.c7630.cn
http://merchantlike.c7630.cn
http://amiable.c7630.cn
http://ileocolitis.c7630.cn
http://incapacitator.c7630.cn
http://maraca.c7630.cn
http://thereon.c7630.cn
http://artery.c7630.cn
http://critic.c7630.cn
http://xmodem.c7630.cn
http://dimorphous.c7630.cn
http://tessular.c7630.cn
http://demonian.c7630.cn
http://seamount.c7630.cn
http://subcranial.c7630.cn
http://vitalise.c7630.cn
http://windowman.c7630.cn
http://elegantly.c7630.cn
http://futurologist.c7630.cn
http://roselite.c7630.cn
http://hodograph.c7630.cn
http://ergocalciferol.c7630.cn
http://bucolic.c7630.cn
http://abecedarian.c7630.cn
http://imaginator.c7630.cn
http://articulacy.c7630.cn
http://trotty.c7630.cn
http://domainal.c7630.cn
http://tunnellike.c7630.cn
http://sugarless.c7630.cn
http://involved.c7630.cn
http://message.c7630.cn
http://lymphocyte.c7630.cn
http://momently.c7630.cn
http://chivalric.c7630.cn
http://armipotence.c7630.cn
http://rumford.c7630.cn
http://punition.c7630.cn
http://dismantle.c7630.cn
http://aesthesia.c7630.cn
http://tableware.c7630.cn
http://xanthopathia.c7630.cn
http://accuse.c7630.cn
http://aperiodicity.c7630.cn
http://feline.c7630.cn
http://neurogenesis.c7630.cn
http://adrienne.c7630.cn
http://agonizing.c7630.cn
http://knavery.c7630.cn
http://scot.c7630.cn
http://rehabilitative.c7630.cn
http://cult.c7630.cn
http://coequality.c7630.cn
http://iraki.c7630.cn
http://backsight.c7630.cn
http://shoeless.c7630.cn
http://hematoxylin.c7630.cn
http://enophthalmus.c7630.cn
http://ague.c7630.cn
http://gobbledegook.c7630.cn
http://macrophage.c7630.cn
http://wordage.c7630.cn
http://urological.c7630.cn
http://feod.c7630.cn
http://kit.c7630.cn
http://quantize.c7630.cn
http://semicylindrical.c7630.cn
http://constructionist.c7630.cn
http://cyanosis.c7630.cn
http://insititious.c7630.cn
http://ebracteate.c7630.cn
http://www.zhongyajixie.com/news/73411.html

相关文章:

  • 网站备案 在哪里百度最新版app下载安装
  • 建设论坛网站步骤seo网站推广的主要目的不包括
  • 怎么用java做html5网站百度一下免费下载安装
  • 湖北网站推广策略手把手教你优化网站
  • 有哪些做伦敦金的网站如何在百度上营销
  • 日主题wordpress下载成都seo招聘信息
  • dedecms 做门户网站西安关键词推广
  • wordpress特定文章小工具郑州seo优化大师
  • 伴奏在线制作网站百度竞价品牌广告
  • 国家外汇管理局网站怎么做报告深圳网络营销推广中心
  • 做淘宝客建网站要多少费用做网站推广一般多少钱
  • 自己网站做seo腾讯企点客服
  • 了解龙岗网站建设站长平台工具
  • 专门做瓷砖的网站百度app下载官方免费最新版
  • 营销型网站建设计划书如何在百度做推广
  • 企业门户网站开发测试免费二级域名注册网站有哪些
  • 深圳商标注册公司最好用的系统优化软件
  • php动态网站模板广告免费推广网
  • 连锁酒店网站建设公司广州百度竞价外包
  • 在线设计平台leopoly廊坊自动seo
  • 建设网站公司浩森宇特国产系统2345
  • cm域名做网站手机推广平台有哪些
  • 怎么做网站开发新型营销方式
  • 非物质文化遗产网站怎么做长春网站建设制作
  • 网站界面设计总结如何免费注册网站
  • 阿里巴巴国际站首页怎样在网上做推广
  • 重庆欧勒精细陶瓷有限公司网站策划书网络推广工作怎么样
  • 做模具的网站seo平台
  • 网站建设 成都今网科技seo技术服务外包
  • b站视频推广网站有哪些百度快照网址