var token = $.cookie("token"); var seriesData = []; //柱形图数据 var date; //初始日期 var arrNum = []; var myChart; var aa = true; //日期 laydate.render({ elem: "#chooseTime", format: "yyyy-MM", type: "month", theme: "#00a1cb", // value: new Date() }); //tab切换 $(".hu-tab li").click(function () { $(this).addClass("active").siblings().removeClass("active"); var index = $(this).index(); $(".hu-content >div").eq(index).show().siblings().hide(); }); $(document).ready(function () { //柱形图 // 基于准备好的dom,初始化echarts实例 myChart = echarts.init(document.getElementById("huData")); option = { color: ["#1ab394"], tooltip: { trigger: "axis", axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: "line", // 默认为直线,可选为:'line' | 'shadow' }, }, toolbox: { show: true, }, calculable: true, xAxis: [ { type: "category", name: "月份", splitLine: { show: false, }, //去除网格线 data: [ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月", ], axisTick: { alignWithLabel: true, }, }, ], yAxis: [ { type: "value", name: "通话量", nameLocation: "end", splitLine: { show: false, }, //去除网格线 }, ], series: [ { name: "通话量", type: "bar", barWidth: "30%", //图形宽度 data: arrNum, itemStyle: { normal: { label: { show: true, textStyle: { color: "#800080", //顶部数据颜色 }, }, }, }, label: { normal: { show: true, position: "top", //顶部数据显示位置 }, }, }, ], }; // 使用刚指定的配置项和数据显示图表。 tu(date); myChart.setOption(option); // myChart.on('click', function(params) { // console.log(params); // if(params.componentType === 'series') { // if(params.dataIndex) { // console.log(params.data) // var month = params.name; // console.log(month); // } // } // }); }); Ajax(date); //搜索事件 $(".sear").click(function () { $(".huTable tbody").html(""); date = $("#chooseTime").val(); Ajax(date); tu(date); myChart.setOption(option); }); function Ajax(date) { $(".huTable tbody").html(""); $.ajax({ type: "get", url: huayi.config.callcenter_url + "TotalCall/GetDataList", async: true, dataType: "json", data: { token: token, years: date, }, success: function (data) { var con = data.data; if (con == null) { // $(".huTable tbody").html(''); $('