//下拉框
(function () {
$('#date_time_con').text(moment().subtract('days', 1).format('YYYY-MM-DD')+ ' - ' + moment().subtract('days', 1).format('YYYY-MM-DD'))
$('#daterange-btn').daterangepicker({
"linkedCalendars": false,
startDate:moment().subtract('days', 1),
endDate:moment().subtract('days', 1),
opens : 'left', //日期选择框的弹出位置
autoUpdateInput:false,
ranges: {
'昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
'最近一周': [moment().subtract('days', 7), moment().subtract('days', 1)],
'最近一个月': [moment().subtract('months', 1), moment().subtract('days', 1)],
'最近三个月': [moment().subtract('months', 3), moment().subtract('days', 1)],
},
maxDate : moment().subtract('days', 1), //最大时间
},
function(start, end) {
$('#daterange-btn #date_time_con').html(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
//alert(start.format('YYYYMMDD') + " - " + end.format('YYYYMMDD'));
fun.init();
fun.pieChartInit(start.format('YYYY-MM-DD'),end.format('YYYY-MM-DD'));
fun.statisticalChartInit(start.format('YYYY-MM-DD'),end.format('YYYY-MM-DD'));
// loadData(moment().subtract('days', 1).format('YYYY-MM-DD'),moment().subtract('days', 1).format('YYYY-MM-DD'));
}
);
$('#daterange-btn').on('show.daterangepicker', function(ev, picker) {
//do something, like clearing an input
if(picker.chosenLabel == '自定义'){
$('.daterangepicker').removeClass('show-calendar');
}
});
$('#daterange-btn').on('hide.daterangepicker', function(ev, picker) {
//do something, like clearing an input
if(picker.chosenLabel == '自定义'){
$('.daterangepicker').removeClass('show-calendar');
}
});
//饼图
var pie_option = {
tooltip : {
trigger: 'item',
formatter: "{b} : {c}辆 ({d}%)"
},
series : [
{
type:'pie',
radius : '65%',
center: ['50%', '50%'],
data:[
{
value:0,
name:'路内停车场',
itemStyle: {
normal: {
label: {
show: true,
textStyle: {
fontSize: 15,
fontWeight: "bold"
},
position: "center"
},
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(248,141,6,.9)'
}, {
offset: 1,
color: 'rgba(238,4,224,.9)'
}])
}
},
label: {
normal: {
position: 'outside',
textStyle: {
color: '#fff',
fontSize: 14,
},
formatter: '{b}:{c}辆\n 占比{d}%'
}
},
labelLine: {
normal: {
show: true,
length: 5,
length2: 5,
smooth: false,
lineStyle: {
width: 1,
color: 'rgba(238,4,224,.9)',
}
}
}
},
{
value:0,
name:'路外停车场',
itemStyle: {
normal: {
borderWidth:1,
borderColor:'#071c84',
shadowBlur:'10',
shadowColor:'#071c84',
shadowOffsetX:-5,
label: {
show: true,
textStyle: {
fontSize: 15,
fontWeight: "bold"
},
position: "center"
},
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(74,104,253,1)'
}, {
offset: 1,
color: 'rgba(74,104,253,.3)'
}])
}
},
label: {
normal: {
position: 'outside',
textStyle: {
color: '#fff',
fontSize: 14
},
formatter: '{b}:{c}辆\n 占比{d}%'
}
},
labelLine: {
normal: {
show: true,
length: 10,
smooth: false,
lineStyle: {
width: 1,
color: 'rgba(74,104,253,1)',
}
}
}
},
],
// roseType: 'radius',
label: {
normal: {
textStyle: {
color: 'rgba(255, 255, 255, 0.3)'
}
}
},
labelLine: {
normal: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: false,
length: 10,
}
},
itemStyle: {
normal: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function (idx) {
return Math.random() * 200;
}
}
]
};
var pie_echarts = echarts.init(document.getElementById('pie_echarts'));
//统计图
var bar_option = {
tooltip : {
trigger: 'axis'
},
calculable : true,
grid:{
top:'20',
},
xAxis : [
{
type : 'category',
data : ['商场','医院','小区','学校','写字楼','景区','交通场站','其他'],
axisLine:{
show:false,
},
axisTick:{
show:false,
},
axisLabel:{
textStyle:{
color:'#fff',
fontFamily:"Microsoft YaHei",
}
}
}
],
yAxis : [
{
show:false,
type : 'value',
axisTick:{
show:false,
},
axisLabel:{
show:false,
},
splitLine:{
show:false,
}
}
],
series : [
{
barWidth:'50%',
name:'停车数量',
type:'bar',
data:[],
itemStyle: {
normal: {
color: function(params) {
// build a color map as your need.
var colorList = [
// '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
// '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
// '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(16,137,152,1)'
}, {
offset: 1,
color: 'rgba(12,141,157,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(0,191,109,1)'
}, {
offset: 1,
color: 'rgba(0,191,109,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(255,254,29,1)'
}, {
offset: 1,
color: 'rgba(255,248,26,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(248,143,6,1)'
}, {
offset: 1,
color: 'rgba(248,143,6,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(74,104,253,1)'
}, {
offset: 1,
color: 'rgba(74,104,253,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(250,5,218,1)'
}, {
offset: 1,
color: 'rgba(250,5,218,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(0,204,255,1)'
}, {
offset: 1,
color: 'rgba(0,204,255,.4)'
}])},
{color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(249,49,59,1)'
}, {
offset: 1,
color: 'rgba(246,86,94,.4)'
}])},
];
return colorList[params.dataIndex].color
},label: {
show: true,
position: 'top',
formatter: '{c}'
}
}
}
}
]
};
var bar_echarts = echarts.init(document.getElementById('bar_echarts'));
var fun = {
/**初始化*/
init : function () {
// pie_echarts.setOption(pie_option,true);
bar_echarts.setOption(bar_option,true);
window.onresize = function () {
pie_echarts.resize();
bar_echarts.resize();
};
},
/**加载饼图 .*/
pieChartInit:function (beginTime,endTime) {
var req={
beginTime:new Date((beginTime+' 00:00:00').replace(new RegExp(/-/gm) ,"/")),
endTime:new Date((endTime+ ' 23:59:59').replace(new RegExp(/-/gm) ,"/")),
provId: sysComm.provId,
cityId: sysComm.cityId,
sysCode:sysComm.sysCode
};
//发起ajax请求
sysAjax({
method: "post",
url: dataUrl.util.getPieChartURL(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType:'json',
success: function(res){
var data = res.data;
if(data != null &&data.length >0){
//添加数据
$.each(data, function(index,row) {
if(1==row.plType){
pie_option.series[0].data[1].value=row.currentParkCount;
pie_option.series[0].data[1].name=row.plTypeName;
}else{
pie_option.series[0].data[0].value=row.currentParkCount;
pie_option.series[0].data[0].name=row.plTypeName;
}
});
if(data[0].currentParkCount > data[1].currentParkCount ){
$('#pie_chart').text(data[0].plTypeName);
}else{
$('#pie_chart').text(data[1].plTypeName);
}
pie_echarts.setOption(pie_option,true); //重新渲染
}//if
}
});
},
/**统计图.*/
statisticalChartInit:function(beginTime,endTime){
var req={
beginTime:new Date((beginTime+' 00:00:00').replace(new RegExp(/-/gm) ,"/")),
endTime:new Date((endTime+ ' 23:59:59').replace(new RegExp(/-/gm) ,"/")),
provId: sysComm.provId,
cityId: sysComm.cityId,
sysCode:sysComm.sysCode
};
//发起ajax请求
sysAjax({
method: "post",
url: dataUrl.util.getStatisticalChar(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType:'json',
success: function(res){
var data = res.data;
var returnName=new Array();
var returnData=new Array();
if(data != null && data.length >0){
$.each(data, function(index,row) {
returnName[index] = row.busiCircleName;
returnData[index] = row.currentParkCount;
});
bar_option.xAxis[0].data=returnName;
bar_option.series[0].data=returnData;
}
bar_echarts.setOption(bar_option);
//
var maxValueIndex = 0;
var maxValue = 0;
if(returnData != null && returnData.length >0){
$.each(returnData, function(index,row) {
if( row >maxValue ){
maxValue = row;
maxValueIndex=index;
}
});
$('#statistical_chart').text(returnName[maxValueIndex]);
}
}//function
});
},
/**生成轨迹.*/
addParkingTrack:function(){
}
};
fun.init();
fun.pieChartInit(moment().subtract('days', 1).format('YYYY-MM-DD'),moment().subtract('days', 1).format('YYYY-MM-DD'));
fun.statisticalChartInit(moment().subtract('days', 1).format('YYYY-MM-DD'),moment().subtract('days', 1).format('YYYY-MM-DD'));
fun.addParkingTrack();
//表格。。。。。。
;(function ($) {
var ser_object2;
var ser_object2_img;
var radius_v;
jQuery.fn.extend({
"M_select": function (options) {
var ojc_arr = this;
var ojc;
// select下拉框
for (i = 0; i < ojc_arr.length; i++) {
var ser_object = $(ojc_arr[i]);
$(ser_object).parent().addClass("select-con");
$(ser_object).parent().css("z-index", "1");
$(ser_object).wrap("");
$(ser_object).parent().parent().append('