echarts标题字体大小_echarts饼图显示百分比

echarts标题字体大小_echarts饼图显示百分比解决echarts饼图显示百分比,和显示内容字体及大小//基于准备好的dom,初始化echarts实例    varpieEchart=echarts.init(document.getElementById(‘pieEchart’));     //指定图表的配置项和数据     varpieoption={       ti…

大家好,又见面了,我是你们的朋友全栈君。

解决echarts饼图显示百分比,和显示内容字体及大小

// 基于准备好的dom,初始化echarts实例
        var pieEchart = echarts.init(document.getElementById(‘pieEchart’));

         // 指定图表的配置项和数据
         var pieoption = {  
            title : {  
                text: ‘公里总里程’,   
                x:’left’,
                textStyle:{

                    color:’#FFFFFF’,
                    fontSize:25
                }
            },  
            tooltip : {  
                trigger: ‘item’,  
                formatter: “{a} <br/>{b} : {c} KM”  
            },  
            legend: {  
                orient : ‘vertical’,  
                x : ‘left’,  
                top:40,
                itemWidth:70,
                itemHeight:30,
                formatter: ‘{name}’,
                textStyle:{

                    color: ‘#FFFFFF’
                },
                data:[{name:’高速50KM’,icon:’rect’},{name:’一级150KM’,icon:’rect’},{name:’二级150KM’,icon:’rect’},{name:’三级100KM’,icon:’rect’},{name:’四级50KM’,icon:’rect’}]  }
            ,   
            calculable : true,  
            series : [  
                {  
                    name:’公里总里程’,  
                    type:’pie’,  
                    radius : ‘70%’,//饼图的半径大小  
                    center: [‘60%’, ‘60%’],//饼图的位置 
                    label:{            //饼图图形上的文本标签
                            normal:{

                                show:true,
                                position:’inner’, //标签的位置
                                textStyle : {

                                    fontWeight : 300 ,
                                    fontSize : 16    //文字的字体大小
                                },
                                formatter:'{d}%’

                                
                            }
                        },
                    data:[  
                        {value:50,name:’高速50KM’,itemStyle:{normal:{color:’#FE0000′}}},  
                        {value:150,name:’一级150KM’,itemStyle:{normal:{color:’#F29700′}}},  
                        {value:150,name:’二级150KM’,itemStyle:{normal:{color:’#02B0ED’}}}, 
                        {value:100,name:’三级100KM’,itemStyle:{normal:{color:’#55E87D’}}},
                        {value:50,name:’四级50KM’,itemStyle:{normal:{color:’#FFE200′}}},
                    ]
                }  
            ]  
        };

            // 使用刚指定的配置项和数据显示图表。
            pieEchart.setOption(pieoption);

<div id="pieEchart" style="width: 480px;height:300px;">

echarts标题字体大小_echarts饼图显示百分比

 

如何给eCharts饼图区域指定颜色

  1. option = {
  2.         title : {
  3.         text: “全局指标状态分布图”,
  4.                x:”left”,
  5.                y:”top”
  6.         },
  7.         tooltip : {
  8.                show: true,
  9.                formatter: “{a} <br/>{b} : {c} ({d}%)”
  10.         },
  11.         color:[“red”, “green”,”yellow”,”blueviolet”]
  12. }

echarts标题字体大小_echarts饼图显示百分比

刷新数据

 <div class="foot_ri" id="txt">
        <div class="foot_txt">
            <span style="color: #6e85bf;font-size: 20px">诉求百分比占比</span>
            <div id="container" style="height: 100%; -webkit-tap-highlight-color: transparent; user-select: none; position: relative;"_echarts_instance_="ec_1550106173775">
                <div style="position: relative; overflow: hidden; width: 1920px; height: 1037px; padding: 0px; margin: 0px; border-width: 0px; cursor: default;">
                    <canvas data-zr-dom-id="zr_0" width="1920" height="1037"
                            style="position: absolute; left: 0px; top: 0px; width: 1920px; height: 1037px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 0px; margin: 0px; border-width: 0px;"></canvas>
                </div> 
            </div>
        </div>
    </div>

    <img src="../static/images/refresh.png" id="ig" style="margin-top: -370px;margin-left: 935px;">
</div>

 点击 id=”ig” 图片,id=”container” 饼图刷新

 

<#–2019/2/13饼图–>
<script type=”text/javascript”>
    var dom = document.getElementById(“container”);
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {

        // title: {

        //     text: ‘诉求百分比占比’,
        //     subtext: ”,
        //     x: ‘center’
        // },
        tooltip: {

            trigger: ‘item’,
            formatter: “{a} <br/>{b} : {c} ({d}%)”/*鼠标经过显示*/
        },
        // color:[‘#0160ae’, ‘#36a5fc’,’#0d86e7′],
        color: [‘#6f87bf’, ‘#7084a2’, ‘#5e6787’],
        legend: {

            orient: ‘vertical’,
            // bottom: 500,
            left: ‘right’,
            data: [‘咨询’, ‘意见建议’, ‘投诉举报’],
            textStyle: {

                fontWeight: 300,
                fontSize: 16,    //文字的字体大小
                color: ‘#345cc1’//文字的字体颜色
            },
        },
        series: [
            {

                name: ‘访问来源’,
                type: ‘pie’,
                radius: ‘65%’, /*饼图大小*/
                center: [‘40%’, ‘50%’], /*饼图位置*/
                data: [
                    {value: 335, name: ‘咨询’},
                    {value: 234, name: ‘意见建议’},
                    {value: 135, name: ‘投诉举报’}
                ],
                itemStyle: {

                    emphasis: {

                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: ‘rgba(0, 0, 0, 0.5)’
                    }
                }
            }
        ]
    };
    ;
    if (option && typeof option === “object”) {

        myChart.setOption(option, true);
    }
</script>
<#–结束–>
<#–2019/2/15刷新数据–>
<script>
    $(‘#ig’).click(function () {

        var dom = document.getElementById(“container”);
        var myChart = echarts.init(dom);
        myChart.setOption({ //加载数据图表
            series: {

                // 根据名字对应到相应的系列
                name: [‘数量’],
                data: [
                    {value: 222, name: ‘咨询’},
                    {value: 555, name: ‘意见建议’},
                    {value: 56, name: ‘投诉举报’}
                ]
            }

        })
    })
</script>

<#–结束–>

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/124677.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • QMovie的使用

    QMovie的使用QMovie是一个可以存放动态视频的类今天第一次使用,记录一下一般是配合QLabel使用的,可以用来存放GIF动态图 m_background=newQLabel(this);m_background->setGeometry(0,0,MENU_WINDOW_WIDTH,MENU_WINDOW_HEIGHT);QMovie*backgroundMovie=newQMovie(“:/images/menu/MenuBackground.gif”,QByteArra

    2022年6月16日
    61
  • sqldeveloper如何连接数据库_创建数据库的五个步骤

    sqldeveloper如何连接数据库_创建数据库的五个步骤转载出处:https://blog.csdn.net/u010185220/article/details/53106196SQLDeveloper不能用于创建Oracle数据库,只能用来连接已经创建的数据库,数据库的建立要通过DatabaseConfigurationAssistant(DBCA)来完成。找到开始菜单中Oracle-OraDb11g_home1下…

    2022年9月15日
    3
  • pycharm2021.11.3 激活码【中文破解版】

    (pycharm2021.11.3 激活码)这是一篇idea技术相关文章,由全栈君为大家提供,主要知识点是关于2021JetBrains全家桶永久激活码的内容IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html1M3Q9SD5XW-eyJsaWN…

    2022年3月28日
    55
  • bootstrap分页样式

    bootstrap分页样式bootstrap分页样式在bootstrap.min.css文件中好像没有包含进来bootstrap.css才有的 .pagination{height:40px;margin:20px0;}.paginationul{border-radius:3px3px3px3px;box-shadow:01px2pxrg

    2022年7月17日
    12
  • unity 减少drawcall_unity scroll

    unity 减少drawcall_unity scroll一般我们在实时渲染中,DC也就是DrawCall都会尽可能的降低他,以为着,CPU与GPU的绘制沟通会减少啥叫:DrawCall已OpenGL为例,就是调用带有绘制功能的API的次数如:DrawCall:10次,那就意味着调用了glDrawXXXX的API10次啥叫:SetPassCallUnity中,就无缘无故多了个叫:SetPassCall的家伙其实早在以前的游戏引擎里,没有pass这么一个说法,说是techni的说法因为这些都是封装的功

    2022年9月19日
    2
  • navicat 15 linux 在线激活码【注册码】

    navicat 15 linux 在线激活码【注册码】,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月20日
    88

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号