1.双Y轴显示数量和占比

app.title = '坐标轴刻度与标签对齐';

option = {
    title : { //标题
            x : 'center',
            y : 5,
            text : '数量和占比图'    //换行用 \n
        },
    legend : { //图标
            show : true,
            x : 'center',
            y : 30,
            itemGap : 10,
            itemWidth : 30,
            itemHeight : 10,
            data : ['one','three']
        },
    color: ['#3398DB'],//  柱状图颜色

    tooltip : { //鼠标悬停提示内容
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器,坐标轴触发有效
            type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
        }
    },
    grid: { //布局   控制图的大小,调整下面这些值就可以
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
        //y2 : 40
        // y2可以控制 X轴跟Zoom控件之间的间隔,避免以为倾斜后造成 label重叠到zoom上
    },
    xAxis : [ //X轴
        {
            type : 'category',
            data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            axisTick: {
                alignWithLabel: true
            }
        }
    ],
    yAxis : [ //两个y轴
        {
            type : 'value',
            axisLabel : {
                show : true,
                interval : 'auto',
                formatter : '{value} '
            },
            splitNumber : 10,
            splitLine : {
                show : true,
                lineStyle : {
                    type : 'dashed'
                }
            },
            splitArea : {
                show : false
            }
        } ,
        {
            type : 'value',
            axisLabel : {
                show : true,
                interval : 'auto',
                formatter : '{value} %'
            },
            splitNumber : 10,
            splitLine : {
                show : true,
                lineStyle : {
                    type : 'dashed'
                }
            },
            splitArea : {
                show : false
            }
        }
    ],
    series : [ //用于指定图标显示类型

        {
            name : 'one',
            type : 'bar',
            barMaxWidth:100,
            yAxisIndex : '0',//使用第一个y轴
            itemStyle : {
                normal : {
                    color : 'rgba(139,26,26,1)',  //柱子颜色
                    borderType : 'dashed',

                    label : { //设置柱子上面的内容
                        show : false, //数据是否显示在柱子上
                        position : 'inside',
                        offset : [ 0, 0 ],
                        formatter : '{c}',  //如果是百分比:formatter : '{c}%',
                        textStyle : {//字体内容设置
                            color : '#000000',
                            fontStyle : 'normal',
                            fontWeight : 'normal',
                            fontFamily : 'sans-serif',
                            fontSize : 6
                        }
                    }
                }
            },
            data : [10, 52, 200, 334, 390, 330, 220]
        },
        {
                name : '比例',
                type : 'line',
                symbol : 'emptyCircle',
                showAllSymbol : true, //动画效果
                symbolSize : 12,
                smooth : true, //光滑的曲线
                yAxisIndex : '1',
                itemStyle : {
                    normal : {
                        color : 'rgba(139,26,26,1)',
                        label : {
                            show : true,
                            formatter : '{c}%',
                            textStyle : {
                                color : '#000000'
                            }
                        }
                    }
                },
                data : [1, 5, 20, 33, 39, 33, 22]

            },
    ]
};

echarts使用笔记四:双Y轴的更多相关文章

  1. Python科学计算技巧积累四——双y轴图像绘制

    双y轴图像具有单y轴图像没有的对比效果,在MATLAB中有plotyy函数可以实现,Python的实现方式没有MATLAB那样方便,不过实现效果却也不见得差. 以往我常用的绘图命令是import ma ...

  2. highchart 设置双Y轴坐标 双x轴坐标方法

    我们的图表一旦引入了两种不同单位或者数量级相差很大的数据以后,这时候需要两种坐标对其进行计量. 下面以设置双Y轴为例, y轴坐标的参数设置成: yAxis: [{ title: { text: '坐标 ...

  3. 绘制复数图形和双y轴图形

    clearclct=0:0.1:2*pi;x=sin(t);y=cos(t);z=x+i*y;subplot(1,3,1)plot(t,z,'r') %注:这种方式下,不论参数t,z哪个是复数,都将忽 ...

  4. Jqplot使用总结之二(双Y轴)

    最近需要用Jqplot做双Y轴的Chart图,首先我找到了文档上的例子并对数据做了一些调整: 1.例子展示: var s1 = [["2002-01-01", 112000], [ ...

  5. MSChart使用之双Y轴使用

    protected void SearchChart() { Chart1.ChartAreas.Clear(); Chart1.Series.Clear(); ChartArea _ChartAre ...

  6. 【Python】matplotlib 双y轴绘制及合并图例

    1.双y轴绘制 关键函数:twinx() 问题在于此时图例会有两个. # -*- coding: utf-8 -*- import numpy as np import matplotlib.pypl ...

  7. matlab画二维直方图以及双y轴坐标如何修改另一边y轴的颜色

    1.首先讲一下如何用hist画二维直方图 x=[- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...

  8. Python教程:matplotlib 绘制双Y轴曲线图

    前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:数据皮皮侠 双X轴的可以理解为共享y轴 ax1=ax.twiny() ...

  9. Python实现双X轴双Y轴绘图

    诈尸人口回归.这一年忙着灌水忙到头都掉了,最近在女朋友的提醒下终于想起来博客的账号密码,正好今天灌水的时候需要画一个双X轴双Y轴的图,研究了两小时终于用Py实现了.找资料的过程中没有发现有系统的文章, ...

随机推荐

  1. python-turtle 快给你的爷爷看看啥是 “小猪佩奇”

    完整代码: #!/usr/bin/env python2 # coding=utf-8 import turtle t = turtle.Pen() t.pensize(4) t.hideturtle ...

  2. echo '1'.print(2)+3; 的输出结果为什么是511

    今天看到一道有趣的题目,如上所示.结果为什么会是511呢? 这个结果的计算分为三步来理解: 首先计算的是 右边print(2)+3,这个你可以直接理解成print(2+3),得到的结果是5.而prin ...

  3. ASP.NET -- WebForm -- 给图片添加水印标记

    ASP.NET -- WebForm: 给图片添加水印标记 ASP.NET:使用 WebForm(C#) 制作一个简单的为图片添加水印的页面. 1. Test2.aspx文件 <%@ Page ...

  4. March 10th, 2018 Week 10th Saturday

    All good things must come to an end. 好景无常. Love is when the other person's happiness is more importa ...

  5. February 13th, 2018 Week 7th Tuesday

    You are your greatest asset. 你就是你自己最大的资本. For most of us, there are few things that we can count on ...

  6. 汲取营养的blog专栏

    网路上博客专栏是学习提升.思考深化的好途径,目前发现的博客价值高的平台: (1)EETOP www.eetop.cn (2)CSND www.csdn.net (3)cnblog www.cnblog ...

  7. DBUtils温习2

    上篇简单回顾了下DBUtils的简介和其常用的类,这篇博客结合C3P0连接池,做一个简单的增删改查操作 1.创建web项目,导入jar包 2.编写c3p0-config.xml和引入工具类 <? ...

  8. ArcMap2Sld:一个将MXD中图层配图样式转换为OGC的SLD文件的开源工具

    在一个项目中,用户采用GeoServer做为GIS服务器(原因嘛当然是免费能省钱,经过验证可能还会在性能和稳定性等表现力也有优越性),但是手上收集的数据都是ESRI格式的,这倒不打紧,因为GeoSer ...

  9. 用Python调用阿里云的短信接口

    #!/usr/bin/env python# -*- coding:utf-8 -*-# Author:Frank import uuidimport datetimeimport hmacimpor ...

  10. Linux中运行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory。

    在Linux中运行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...