• 背景


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--<meta name="viewport" content="width = device-width,initial-scale=1,maximum-scale=1"/>-->
    <title>鼠标的距离</title>
    <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="echarts.min.js"></script>

    </head>
    <style type="text/css">



    </style>
    <body>
    <div id="main" style=" 600px; height: 400px;">

    </div>
    </body>
    <script type="text/javascript">
    var myChart = echarts.init(document.getElementById('main'));


    var colorList = [];
    option = {
    calculable : true,
    tooltip : {
    trigger: 'axis'
    },
    xAxis : [
    {
    type : 'value',

    axisLabel:{formatter:'{value} 分'}

    },
    //辅助x轴

    ],
    yAxis : [
    {
    type : 'category',
    data : ['s1','s2','s3','s4','s5']
    },
    {
    type : 'category',
    axisLine: {show:false},
    axisTick: {show:false},
    axisLabel: {show:false},
    splitArea: {show:false},
    splitLine: {show:false},
    data : ['s1','s2','s3','s4','s5']
    }
    ],
    series : [
    {
    name:'成绩',
    type:'bar',
    itemStyle: {
    normal: {
    color: function(params) {
    return colorList[params.dataIndex]
    }
    }
    },
    data:[70,80,50,90,100]
    },
    //背景
    {
    name:'成绩',
    type:'bar',
    yAxisIndex:1,
    //颜色需要有透明度
    itemStyle: {normal: {color:'rgba(102, 102, 102,0.5)'}},
    //data填你需要的背景的值
    data:[100,100,100,100,100]
    },
    ]
    };
    for(var i in option.series[0].data){
    colorList[i]=option.series[0].data[i]>70 ? '#F08080' : '#7EC0EE';
    };
    myChart.setOption(option);
    </script>
    </html>
  • 相关阅读:
    Python3安装turtle提示错误:Command "python setup.py egg_info" failed with error code 1
    慕学生鲜xadmin登录不成功解决办法
    mysql删除后ID不连续解决办法
    Mac 安装gevent
    ubuntu 下 docker的简单使用
    python 字典的一些简单操作
    列表推导式
    Serializer字段和选项
    添加包解决一些导包问题
    css 文本换行,文本空白符处理相关 属性:white-space word-wrap word-break
  • 原文地址:https://www.cnblogs.com/junmoli/p/8697939.html
Copyright © 2020-2023  润新知