您当前的位置: 首页 >  ar

杨林伟

暂无认证

  • 3浏览

    0关注

    3337博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

09Echarts - 折线图(Confidence Band)

杨林伟 发布时间:2019-04-30 14:55:35 ,浏览量:3

效果图

在这里插入图片描述

源代码


   
       
   
   
       
var dom = document.getElementById("container"); var myChart = echarts.init(dom); var app = {}; option = null; myChart.showLoading(); $.get('data/asset/data/confidence-band.json', function (data) { myChart.hideLoading(); var base = -data.reduce(function (min, val) { return Math.floor(Math.min(min, val.l)); }, Infinity); myChart.setOption(option = { title: { text: 'Confidence Band', subtext: 'Example in MetricsGraphics.js', left: 'center' }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', animation: false, label: { backgroundColor: '#ccc', borderColor: '#aaa', borderWidth: 1, shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 0, textStyle: { color: '#222' } } }, formatter: function (params) { return params[2].name + '' + params[2].value; } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'category', data: data.map(function (item) { return item.date; }), axisLabel: { formatter: function (value, idx) { var date = new Date(value); return idx === 0 ? value : [date.getMonth() + 1, date.getDate()].join('-'); } }, splitLine: { show: false }, boundaryGap: false }, yAxis: { axisLabel: { formatter: function (val) { return (val - base) * 100 + '%'; } }, axisPointer: { label: { formatter: function (params) { return ((params.value - base) * 100).toFixed(1) + '%'; } } }, splitNumber: 3, splitLine: { show: false } }, series: [{ name: 'L', type: 'line', data: data.map(function (item) { return item.l + base; }), lineStyle: { normal: { opacity: 0 } }, stack: 'confidence-band', symbol: 'none' }, { name: 'U', type: 'line', data: data.map(function (item) { return item.u - item.l; }), lineStyle: { normal: { opacity: 0 } }, areaStyle: { normal: { color: '#ccc' } }, stack: 'confidence-band', symbol: 'none' }, { type: 'line', data: data.map(function (item) { return item.value + base; }), hoverAnimation: false, symbolSize: 6, itemStyle: { normal: { color: '#c23531' } }, showSymbol: false }] }); });; if (option && typeof option === "object") { myChart.setOption(option, true); }
关注
打赏
1662376985
查看更多评论
立即登录/注册

微信扫码登录

0.0502s