eCharts-柱状图(横置) 配置说明
2018-01-24 14:53
239 查看
// 实例化eChart图表 function initEchart( idName, option ) { var myEchart = echarts.init( document.getElementById( idName ) ); myEchart.setOption( option ); } // 随机数生成 function randomNum( digitNumber, holdNumber ) { var random = Math.random(); random = Math.pow( 10, digitNumber ) * random; random = random.toFixed(holdNumber); return random; }
var option = { title: { text: "XX市历年空气质量优良天数比例", subtext: "", x: '16', textStyle: { fontWeight: 'normal' } }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } } }, toolbox: { orient: 'horizontal', feature: { magicType: { type: ['line', 'bar'] }, restore: {show: true}, saveAsImage: {show: true} }, bottom: 15, right: 20 }, grid: { // 上下左右边距 top: "20%", bottom: "10%", left: "8%", right: "3%", containLabel: true }, xAxis: [{ type: 'value', name: '', nameTextStyle: { color: '#6d9269' }, position: 'top', max: 100, boundaryGap: [0, 0.01], axisTick: { show: false, alignWithLabel: false }, axisLine: { show: false }, splitLine: { show: false } }], yAxis: [{ type: 'category', name: "年份", nameTextStyle: { color: '#6d9269' }, nameGap: 30, data: ["2012", "2013", "2014", "2015", "2016", "2017"], // Y轴分布类型 splitLine: { show: false }, axisLine: { show: false }, axisTick: { show: false }, axisLabel: { textStyle: {} } }], series: [{ name: "优良天数", type: "bar", stack: 'chart', data: data, // X轴对应类型的数值 itemStyle: { normal: { color: new echarts.graphic.LinearGradient( 0, 0, 1, 0, [ {offset: 0, color: '#a8e8a1'}, {offset: 1, color: '#65c95b'} ] ) } } }, { type: 'bar', stack: 'chart', silent: true, itemStyle: { normal: { color: '#f5f5f5' } }, data: reverseData }] }
var echartId = 'lineChart-01'; initEchart(echartId, option);
相关文章推荐
- echarts图表坐标刻度过多如何设置刻度间隔(interval)以及配置说明
- eCharts-散点图 配置说明
- ECharts配置简单说明
- eCharts-折线图 配置说明
- ECharts图表组件中级入门(Axis-axisLabel):图表坐标刻度过多如何设置刻度间隔(interval)以及配置说明
- CornerStone配置SVN,HTTP及SVN简单使用说明
- Oracle Golden Gate 系列十 -- 配置 Data Pump process 说明 与 示例
- 本田飞度汽车的配置和相关资料说明
- mybatis配置流程详细说明 最清晰 (包含测试方法)
- 服务器网络监控软件部署配置说明
- Redis配置文件参数说明
- Mybatis-generator配置说明
- Nginx配置文件详细说明
- WebConfig 2.0 配置详细说明
- nginx 配置文件参数说明
- WDM移动模型仿真配置说明
- 事务说明[tomcat] spring2.5.6 + hiberante3.1.3 + atomikos3.8.0 多数据源事务配置
- redis优化配置和redis.conf说明
- HP en3700打印服务器配置说明
- Nginx的基本配置与参数说明