/** * 总呼叫量统计 * */ var token = $.cookie("token"); var date; //初始日期 var arrNum = []; var myChart; $(document).ready(function() { $('.tool_bars').authorizeButton(); //日期 laydate.render({ elem: '#chooseTime', theme: '#249fea', type: 'year', }); //柱形图 // 基于准备好的dom,初始化echarts实例 myChart = echarts.init(document.getElementById('huData')); myChart.clear(); myChart.showLoading(); option = { color: ['#249fea'], 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' //顶部数据显示位置 } } } ] }; // 使用刚指定的配置项和数据显示图表。 getChartData(date); myChart.setOption(option); myChart.on('click', function(params) { if(params.componentType === 'series') { if(params.dataIndex) { var month = params.name; } } }); //搜索事件 $("#sc_btns").click(function() { $(".huTable tbody").html(''); date = $("#chooseTime").val(); Ajax(date); getChartData(date); myChart.setOption(option); }); //tab切换 $('.hu-tab li').click(function() { $(this).addClass('active') .siblings().removeClass('active'); var index = $(this).index(); $('.hu-content >div').eq(index).show() .siblings().hide(); }) }) Ajax(date); function Ajax(date) { $.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(''); $('