zoukankan      html  css  js  c++  java
  • echarts 加单位 加数字单位

    formatter: function (array) {
                    return array.seriesName + "<br/>" + array.marker + array.name + "平均体重" + array.value + "KG"
                }

    完整代码:

    <div id="ChartB" style="height: 300px"></div>
    
    <script type="text/javascript">
        var chartDom = document.getElementById('ChartB');
        var myChart = echarts.init(chartDom);
        var option = {
            tooltip: {
                trigger: 'item',
                formatter: function (array) {
                    return array.seriesName + "<br/>" + array.marker + array.name + "平均体重" + array.value + "KG"
                }
            },
            xAxis: {
                type: 'category',
                data: ['2020-10', '2020-11', '2020-12', '2021-01', '2021-02', '2021-03'],
                axisLine: {
                    show: true
                }
            },
            yAxis: {
                type: 'value',
                name: 'KG',
                axisLine: {
                    show: true
                }
            },
            legend: {
                bottom: '0px'
            },
            grid: {
                top: '30px',
                left: '40px',
                right: '10px',
                bottom: '50px'
            },
            series: [
                {
                    name: '肉牛',
                    data: [40, 45, 45, 50, 55, 60],
                    type: 'line',
                    smooth: true
                }, {
                    name: '牛犊',
                    data: [55, 60, 65, 70, 75, 80],
                    type: 'line',
                    smooth: true
                }, {
                    name: '公牛',
                    data: [60, 65, 65, 63, 62, 60],
                    type: 'line',
                    smooth: true
                }, {
                    name: '母牛',
                    data: [70, 70, 72, 65, 68, 69],
                    type: 'line',
                    smooth: true
                }
            ]
        };
    
        option && myChart.setOption(option);
    </script>
    ^_^ 亲爱的客官,如果您觉得本文对您有好处,请移动你的鼠标点点下面的关注我,一起学习,一起分享.~ ^_^
  • 相关阅读:
    [Other] 应用下载网站的APK/IPA等常见MIME设置
    [AIR] StageWebView可以和js通信
    [JavaScript] 判断设备类型,加载相应css
    [HTML] H5在webApp中的注意事项
    [JavaScript] css将footer置于页面最底部
    python 装饰器
    python while...else和for...else语法
    Linux haproxy配置参数
    Linux haproxy基础
    Linux ospf+lvs
  • 原文地址:https://www.cnblogs.com/blts/p/14848536.html
Copyright © 2011-2022 走看看