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. LeetCode算法题-Count Primes(Java实现)

    这是悦乐书的第190次更新,第193篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第49题(顺位题号是204).计算小于非负数n的素数的数量.例如: 输入:10 输出:4 ...

  2. puppet 横向扩展(二)

    Table of Contents 1. 概述 2. 实验环境 3. 实验步骤 3.1. 机器B 的环境 3.1.1. 安装puppetmaster 以及 apache passenger 3.1.2 ...

  3. 【递推】ZSC1072: 数学、不容易系列之二—— LELE的RPG难题

    思路如下: f(n) = 1, ... , n-2 , n-1, n 前n-2个已涂好后,涂第n-1个即有2种情况: n-1的色与n-2和1的色都不相同,那么n就是剩下的那个色,没有选择. 即就是f( ...

  4. n2

    "express-ws": "^3.0.0", "devDependencies": {    "socket.io": ...

  5. 上传--spring-boot

    <dependency>   <groupId>commons-fileupload</groupId>   <artifactId>commons-f ...

  6. echarts修改上下左右的边距

    grid: {                top: '4%',                left: '3%',                right: '4%',            ...

  7. springboot统一异常处理类及注解参数为数组的写法

    统一异常处理类 package com.wdcloud.categoryserver.common.exception; import com.wdcloud.categoryserver.commo ...

  8. Java 8 新特性:3-函数(Function)接口

    (原) 以前,在创建泛型时,是这么写的: List<String> list = new ArrayList<String>(); 现在,可以这么写了: List<Str ...

  9. UVA1623-Enter The Dragon(并查集)

    Problem UVA1623-Enter The Dragon Accept: 108  Submit: 689Time Limit: 3000 mSec Problem Description T ...

  10. 转://RMAN跨平台可传输表空间和数据库

    参考链接: http://blog.itpub.net/23135684/viewspace-776048/ http://blog.sina.com.cn/s/blog_69e7b8d7010164 ...