zoukankan      html  css  js  c++  java
  • echarts图表

    <div id="main" style=" 37.5rem;height: 25rem;"></div>

    
    <script>
        var myChart = echarts.init(document.getElementById("main"), 'light');
        $(function () {
            $.ajax({
                url: '/post/console.do',
                type: 'post',
                dataType: 'json',
                success: function (e) {
                    $("#count1").text(e.userCount);
                    $("#count2").text(e.userRegCount);
                    $("#count3").text(e.galleryCount);
                    $("#count4").text(e.galleryUploadCount);
                    var option = {
                        title: {
                            text: '论坛发帖统计'
                        },
                        tooltip: {
                            trigger: 'item',
                            formatter: function (params) {
                                var date = new Date(params.value[0]);
                                date = date.getFullYear() + '-' +
                                    (date.getMonth() + 1) + '-' +
                                    date.getDate();
                                return date + '<br/>' +
                                    params.value[1];
                            }
                        },
                        dataZoom: {
                            show: true,
                            start: 70
                        },
                        legend: {
                            data: ['论坛发帖统计']
                        },
                        grid: {
                            y2: 80
                        },
                        xAxis: [{
                            type: 'time',
                            splitNumber: 10
                        }],
                        yAxis: [{
                            type: 'value'
                        }],
                        series: [
                            {
                                name: '论坛发帖统计',
                                type: 'line',
                                data: (function () {
                                    var arr = e.echarts;
                                    var d = [];
                                    for (var i in arr) {
                                        d.push([new Date(arr[i].dateTime), arr[i].countNumber])
                                    }
                                    return d;
                                })()
    
    
                            }
                        ]
                    };
                    myChart.setOption(option);
                }
    
    
            })
        })
    </script>
    
    
    
  • 相关阅读:
    uva 10192 Vacation(最长公共子)
    SolrCloud应用简介
    2015第43周一solr相关概念
    2015第42周日
    2015第42周六Pgsql全文索引
    Java注解
    2015第42周四
    2015第42周三
    JS原型函数相关基础知识
    2015第42周一爬虫与反爬虫
  • 原文地址:https://www.cnblogs.com/JaminYe/p/10763372.html
Copyright © 2011-2022 走看看