/*开发人员:陈献斌
|
*
|
* 开发日记:2017-8-4
|
*
|
*/
|
|
define(['./CacheHelper', './ChartGraphic', 'esri/layers/FeatureLayer', 'dojo/aspect', 'dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html',
|
'dojo/topic', 'dojo/Deferred', 'dojo/on', './echarts.min'],
|
function (CacheHelper, ChartGraphic, g, aspect, declare, lang, arrayUtils, html, topic, Deferred, on, echarts) {
|
var _YwjcObject,showyear;
|
return declare(g, {
|
|
constructor : function(url, options) {
|
|
options = options || {};
|
options.opacity = 0;
|
dojo.mixin(this, options);
|
if (options) {
|
if (options.YwjcObject.JieShouContent.model.xAxis &&
|
options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel &&
|
options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval &&
|
options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval.indexOf("{") > -1) {
|
showyear = options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval.replace("{", "").replace("}", "");
|
var fun = function (index, data) {
|
if (data == showyear) {
|
return true;
|
} else if (index % 7 ==0) {
|
return true;
|
}
|
return false
|
};
|
options.YwjcObject.JieShouContent.model.xAxis[0].axisLabel.interval = fun;
|
|
}
|
_YwjcObject = this._YwjcObject = options.YwjcObject;
|
//this._LayerRender = options.YwjcObject.LayerRender;
|
|
if (this._YwjcObject.LayerRender) {
|
this._LayerRender = eval("[" + this._YwjcObject.LayerRender + "]")[0];
|
}
|
//debugger;
|
if ( typeof (this._YwjcObject.JieShouContent) == "string")
|
this._chartContent = eval('(' + this._YwjcObject.JieShouContent + ')');
|
else
|
this._chartContent = this._YwjcObject.JieShouContent;
|
}
|
this.clearLegendHandler = topic.subscribe("clearLegend", lang.hitch(this, this._closeLegend));
|
this.ReModifyLocHandler = topic.subscribe("ReModifyLoc", lang.hitch(this, this._ReModifyLoc));
|
|
this.zoomEndHandler = map.on("zoom-end", dojo.hitch(this, function() {
|
this.clear();//清除所有原统计图,后才可刷新加载新的行政统计。
|
this.suspend();
|
if(this._YwjcObject.YwtcLayerObject.definitionexpression){
|
var exp = this._YwjcObject.YwtcLayerObject.definitionexpression.replace(/\{0\}/g, map.getLevel());
|
this.setDefinitionExpression(exp);
|
}
|
this.resume();
|
this.refresh();
|
}));
|
},
|
|
_ReModifyLoc : function() {
|
var myDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
|
if (dojo.exists(myDivID)) {
|
var lDiv = dojo.byId(myDivID);
|
if (lDiv) {
|
dojo.style(lDiv, {
|
"bottom" : this._getMapBottom() + "px",
|
});
|
}
|
}
|
},
|
|
_closeLegend : function() {
|
var myDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
|
|
if (dojo.exists(myDivID)) {
|
var lDiv = dojo.byId(myDivID);
|
dojo.destroy(myDivID);
|
}
|
},
|
|
_setMap : function() {
|
var result = this.inherited(arguments);
|
var chartType = this._chartContent.chartType;
|
if (chartType != "tongjibiao") {
|
this._createECharTuLi();
|
}
|
|
return result;
|
},
|
|
_unsetMap : function() {
|
var result = this.inherited(arguments);
|
|
if (this.zoomEndHandler) {
|
this.zoomEndHandler.remove();
|
}
|
|
if (this.clearLegendHandler) {
|
this.clearLegendHandler.remove();
|
}
|
|
if (this.ReModifyLocHandler) {
|
this.ReModifyLocHandler.remove();
|
}
|
|
var myDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
|
|
if (dojo.exists(myDivID)) {
|
var lDiv = dojo.byId(myDivID);
|
dojo.destroy(myDivID);
|
}
|
var showDiv = document.getElementById("ShwoEChartDiv");
|
if (showDiv) {
|
showDiv.style.display = "none";//隐藏弹窗
|
showDiv.innerHTML = "";//清空弹窗内容
|
}
|
return result;
|
},
|
|
add : function(graphic) {
|
var chartGraphic = this.setPieGraphic(this._YwjcObject, graphic);
|
if (chartGraphic) {
|
arguments[0] = chartGraphic;
|
}
|
return this.inherited(arguments);
|
},
|
|
onGraphicDraw : function(graphicOp) {
|
var result = this.inherited(arguments);
|
|
var graphic = graphicOp.graphic;
|
|
if (graphic.drawPie) {
|
graphic.drawPie();
|
}
|
|
return result;
|
},
|
|
setPieGraphic : function(YwjcObject, addgraphic) {
|
var chartContent = this._chartContent;
|
//图表内容
|
var model = chartContent.model;
|
//模型
|
var dataList = chartContent.datalist;
|
//数据集
|
var chartWidth = chartContent.width;
|
//图表的宽度
|
var chartHeight = chartContent.height;
|
//图表的高度
|
var refField = chartContent.reffield;
|
//关联行政区划字段名称
|
var dataField = chartContent.datafield;
|
//图表类型
|
var chartType = chartContent.chartType;
|
|
//数据字段名称
|
|
//var loadstyle = true;
|
|
var objectid = null;
|
if (this.objectIdField) {
|
objectid = addgraphic.attributes[this.objectIdField];
|
}
|
|
var ywData = null;
|
if (objectid) {
|
ywData = CacheHelper.getCache(YwjcObject.ziYuanID, objectid);
|
}
|
if (ywData == null) {
|
var echartOption;
|
var TableData;
|
if (echartOption == null) {
|
echartOption = [];
|
var data = dojo.filter(dataList, function(item) {//遍历数据集,匹配对应的图表数据
|
var xzqh = eval("item." + refField);
|
//转换对象
|
if (xzqh == addgraphic.attributes[YwjcObject.YwtcRefField]) {//判断行政区划是否相同
|
return true;
|
}
|
});
|
|
if (data.length > 0) {//判断是否匹配到行政区划点
|
ywData = new Object();
|
ywData.Id = "id" + YwjcObject.label + addgraphic.attributes[YwjcObject.YwtcRefField];
|
ywData.ChartType = YwjcObject.ZhanShiFangShi;
|
if (YwjcObject.ZhanShiFangShi == "tongjibiao") {
|
TableData = data;
|
var Newmodel = lang.clone(model);
|
echartOption = Newmodel;
|
ywData.TableData = TableData;
|
} else {
|
var Newmodel = lang.clone(model);
|
for (var i = 0; i < dataField.length; i++) {
|
if (chartType && chartType == "radar") {//雷达图
|
if (i + 1 == dataField.length) {
|
Newmodel.radar[0].indicator = eval("data[0]." + dataField[i]);
|
} else {
|
Newmodel.series[i].data = eval("data[0]." + dataField[i]);
|
}
|
} else if (chartType && chartType == "graph") {//关系图
|
if (dataField.length == 3) {
|
Newmodel.series[i].nodes = eval("data[0]." + dataField[0]);
|
Newmodel.series[i].links = eval("data[0]." + dataField[1]);
|
Newmodel.series[i].categories = eval("data[0]." + dataField[2]);
|
break;
|
}
|
} else if (chartType && chartType == "bar") {
|
if (i + 1 == dataField.length) {
|
Newmodel.xAxis[0].data = eval("data[0]." + dataField[i]);
|
} else {
|
Newmodel.series[i].data = eval("data[0]." + dataField[i]);
|
}
|
} else {
|
if (dataField == "serie") {
|
Newmodel.series = eval("data[0]." + dataField);
|
}
|
else if (Newmodel.series[i].matrix) {
|
Newmodel.series[i].matrix = eval("data[0]." + dataField[i]);
|
} else {
|
Newmodel.series[i].data = eval("data[0]." + dataField[i]);
|
}
|
}
|
|
//转换对象,把数据系列填充模型的属性
|
}
|
//by hugongzuo@163.com
|
var xAxisData=chartContent.xAxisData;
|
var yAxisData=chartContent.yAxisData;
|
if(Newmodel.xAxis!=null && xAxisData!=null){
|
for(var i=0;i<Newmodel.xAxis.length;i++){
|
if(Newmodel.xAxis[i].data=="xAxisData"){
|
Newmodel.xAxis[i].data=xAxisData[i];
|
}
|
}
|
}
|
if(Newmodel.yAxis!=null && yAxisData!=null){
|
for(var i=0;i<Newmodel.yAxis.length;i++){
|
if(Newmodel.yAxis[i].data=="yAxisData"){
|
Newmodel.yAxis[i].data=yAxisData[i];
|
}
|
}
|
}
|
echartOption = Newmodel;
|
echartOption.ZiYuanID = YwjcObject.ziYuanID;
|
echartOption.xzqh = data[0].xzqh;
|
var xzqh_name = addgraphic.attributes[parent.XZQH_NAME_FIELD];
|
echartOption.xzqhName = xzqh_name ? xzqh_name : "详细信息";
|
}
|
ywData.ChartOption = echartOption;
|
if (objectid) {
|
CacheHelper.addCache(YwjcObject.ziYuanID, objectid, ywData);
|
}
|
}
|
}
|
}
|
if (_YwjcObject.JieShouContent.datalist.length > 1 && addgraphic.attributes.XZQH == "000000") {
|
chartWidth *= 1.5;
|
chartHeight *= 1.5;
|
}
|
if (ywData) {
|
var chartGraphic = new ChartGraphic({
|
geometry : addgraphic.geometry,
|
attributes : addgraphic.attributes,
|
chartOption : ywData.ChartOption,
|
cacheID : ywData.Id,
|
tableData : ywData.TableData,
|
ziYuanMC : YwjcObject.label.replace("_" + YwjcObject.ziYuanID, ""),
|
chartType : ywData.ChartType,
|
width : chartWidth,
|
height : chartHeight
|
});
|
|
//(lz)17.08.08 对应颜色
|
var cloneRender = lang.clone(this._LayerRender);
|
var series = ywData.ChartOption.series;
|
if (this._LayerRender && this._LayerRender.classfyFields) {
|
for (var i = 0; i < this._LayerRender.classfyFields.length; i++) {
|
|
var freshFields = [];
|
var data = series[i].data;
|
var cFields = this._LayerRender.classfyFields[i].data;
|
|
for (var d = 0; d < cFields.length; d++) {
|
for (var c = 0; c < data.length; c++) {
|
if (data[c].name == cFields[d].field) {
|
freshFields.push(cFields[d]);
|
}
|
}
|
|
};
|
cloneRender.classfyFields[i].data = freshFields;
|
};
|
}
|
|
chartGraphic.setChartOption(cloneRender);
|
|
return chartGraphic;
|
}
|
},
|
|
/*
|
|
onGraphicRemove : function(graphic) {
|
|
var a = this.inherited(arguments);
|
if (graphic.removePie) {
|
graphic.removePie();
|
}
|
|
return a;
|
|
},
|
|
*/
|
|
_removeShape : function(graphic, c, b) {
|
var a = this.inherited(arguments);
|
if (graphic.removePie) {
|
graphic.removePie();
|
}
|
|
return a;
|
},
|
|
_onExtentChangeHandler: function (a, c, levelChange, d) {
|
debugger
|
var result = this.inherited(arguments);
|
|
for (var i = 0; i < this.graphics.length; i++) {
|
if (this.graphics[i].drawPie) {
|
this.graphics[i].drawPie();
|
}
|
}
|
|
return result;
|
},
|
|
_getMapBottom : function() {
|
var bottom = 2;
|
/*
|
if (dojo.exists("mapBottomC")) {
|
var bottomC = dojo.byId("mapBottomC");
|
var widget = bottomC.firstChild;
|
if (null != widget) {
|
var timeSliderWidget = Ext.getCmp(widget.id);
|
bottom = timeSliderWidget.height;
|
}
|
}
|
*/
|
var DartControllers = _widgetManager.getWidgetsByName("DartController");
|
if (DartControllers.length > 0 && false) {
|
var DartController = DartControllers[0];
|
var DartControllerDom = dojo.byId(DartController.id);
|
if (DartControllerDom) {
|
bottom += DartControllerDom.clientHeight || 35;
|
}
|
}
|
|
var RelevancyLayerDom = dojo.byId("GuanLianZiYuan_Box");
|
if (RelevancyLayerDom) {
|
if (RelevancyLayerDom.style.display != "none") {
|
|
if (RelevancyLayerDom.clientHeight == 0) {
|
var pframe = dojo.byId("GLZY_IF");
|
if (pframe) {
|
var styleHeight = pframe.style["height"];
|
if (styleHeight) {
|
var clientHeight = Number(styleHeight.substr(0, styleHeight.length - 2));
|
bottom += clientHeight;
|
} else if (pframe.height) {
|
bottom += pframe.height;
|
}
|
}
|
|
} else {
|
bottom += RelevancyLayerDom.clientHeight;
|
}
|
}else {//add of lvhuanlong
|
var RelevancyLayerMinDom = dojo.byId("GuanLianZiYuan_MinBox");
|
if (RelevancyLayerMinDom) {
|
if (RelevancyLayerMinDom.style.display != "none") {
|
if (RelevancyLayerMinDom.clientHeight == 0) {
|
var pframe = dojo.byId("GLZY_IF");
|
if (pframe) {
|
var styleHeight = pframe.style["height"];
|
if (styleHeight) {
|
var clientHeight = Number(styleHeight.substr(0, styleHeight.length - 2));
|
bottom += clientHeight;
|
} else if (pframe.height) {
|
bottom += pframe.height;
|
}
|
}
|
} else {
|
bottom += RelevancyLayerMinDom.clientHeight;
|
}
|
}
|
}
|
}
|
}
|
|
return bottom;
|
},
|
|
_createECharTuLi : function() {//创建图例
|
topic.publish("clearLegend");
|
|
var divid = this.id;
|
|
var options = this._CreateLengendChartOption(this._LayerRender);
|
if (options) { //debugger;
|
//var renderer = pLayer.renderer;
|
var widthTuLiDiv = 200;
|
|
var heightTuLiDiv = 250;
|
|
var layerLabel = this._YwjcObject.label;
|
|
if (layerLabel.length > 11) {
|
widthTuLiDiv += (layerLabel.length - 11) * 15;
|
}
|
|
var legendDivID = "maplegendDiv_" + this._YwjcObject.ziYuanID;
|
entirelegendDivID=legendDivID;
|
var tuliContaner = dojo.create("div", {
|
id : legendDivID
|
});
|
|
dojo.style(tuliContaner, {
|
"right" : "2px",
|
"bottom" : this._getMapBottom() + "px",
|
"position" : "absolute",
|
"width" : widthTuLiDiv + "px",
|
"height" : heightTuLiDiv + "px",
|
"padding-left" : "8px",
|
"padding-top" : "8px",
|
"padding-bottom" : "8px",
|
"z-index" : "9999",
|
"border-style" : "solid",
|
"border-width" : "1px",
|
"border-color" : "#157fcc",
|
"background-color" : "white",
|
"pointer-events" : "painted",
|
"border-radius" : "5px",
|
"-webkit-border-radius" : "5px 5px 5px 5px"
|
});
|
|
document.getElementById("map").appendChild(tuliContaner);
|
|
var tuliTitle = dojo.doc.createElement("div");
|
|
dojo.style(tuliTitle, {
|
"width" : "100%",
|
"height" : "27px",
|
'left' : '0px',
|
'top' : '1px',
|
'position' : 'absolute',
|
'background-color' : 'rgb(201, 234, 251)',
|
'border-top-color' : 'rgb(201, 234, 251)',
|
'border-top-style' : 'solid',
|
'border-top-width' : '1px'
|
});
|
|
var tuliTitleCaption = dojo.doc.createElement("div");
|
dojo.style(tuliTitleCaption, {
|
"width" : "100%",
|
"height" : "100%",
|
'text-align' : 'center'
|
});
|
|
var tuliTitleSpan = dojo.doc.createElement("span");
|
|
dojo.style(tuliTitleSpan, {
|
'display' : 'inline-block',
|
'padding-top' : '5px',
|
'font-weight' : 'bold'
|
});
|
|
tuliTitleSpan.textContent = layerLabel;
|
tuliTitleCaption.appendChild(tuliTitleSpan);
|
|
tuliTitle.appendChild(tuliTitleCaption);
|
tuliContaner.appendChild(tuliTitle);
|
|
var tuli_div = dojo.doc.createElement("div", {
|
id : "divlegend"
|
});
|
|
dojo.style(tuli_div, {
|
'width' : widthTuLiDiv - 38 + 'px',
|
'height' : heightTuLiDiv - 38 + 'px',
|
'overflow-y' : 'auto',
|
'left' : '0px',
|
'top' : '28px',
|
'position' : 'absolute',
|
'margin-left' : '30px'
|
});
|
tuliContaner.appendChild(tuli_div);
|
//tuliContaner.append(tuliTitle);
|
|
var tuliThum = dojo.doc.createElement("div");
|
|
dojo.style(tuliThum, {
|
"width" : "100%",
|
"height" : "80px"
|
});
|
|
//tuli_div.appendChild(tuliThum);//update of lvhuanlong 不在图例中显示-小图表
|
|
var charObj = echarts.init(tuliThum);
|
charObj.setOption(options);
|
|
var html = "";
|
var divH = 0;
|
if (charObj._chartsViews.length > 0) {
|
var imageC = dojo.create("div", {
|
style : 'left: 0px; top: 0px; width: 28px; height: 28px; position: absolute;'
|
});
|
|
var image = dojo.create("img", {
|
style : 'cursor:pointer',
|
src : 'images/Leng/i_expand2.png',
|
id : 'imgTuLi'
|
});
|
imageC.appendChild(image);
|
tuliContaner.appendChild(imageC);
|
for (var i = 0; i < charObj._chartsViews.length; i++) {
|
if (charObj._chartsViews[i]._data) {
|
this._initLegendsNodeByChartsView(tuli_div, charObj._chartsViews[i], widthTuLiDiv, null);
|
}
|
}
|
|
/*
|
|
heightTuLiDiv = divH + 10 + 85;
|
widthTuLiDiv = myDivIDwidth * charObj._chartsViews.length + 10;
|
*/
|
//tuliContaner.className = "tuli_div_style";
|
|
//debugger;
|
dojo.style(tuliContaner, {
|
"right" : "2px",
|
"bottom" : this._getMapBottom() + "px",
|
"position" : "absolute",
|
"width" : widthTuLiDiv + "px",
|
"height" : heightTuLiDiv + "px",
|
"padding-left" : "8px",
|
"padding-top" : "8px",
|
"padding-bottom" : "8px",
|
"z-index" : "9999",
|
"border-style" : "solid",
|
"border-width" : "1px",
|
"border-color" : "#157fcc",
|
"background-color" : "white",
|
"pointer-events" : "painted",
|
"border-radius" : "5px",
|
"-webkit-border-radius" : "5px 5px 5px 5px"
|
});
|
|
dojo.connect(image, "click", lang.hitch(this, function() {
|
var imgTuLi = document.getElementById("imgTuLi");
|
|
if (tuliTitle.style.display == 'none') {
|
tuliTitle.style.display = 'block';
|
tuli_div.style.display = 'block';
|
imgTuLi.src = "images/Leng/i_expand2.png";
|
|
dojo.style(tuliContaner, {
|
"width" : widthTuLiDiv + "px",
|
"height" : heightTuLiDiv + "px"
|
});
|
} else {
|
tuliTitle.style.display = 'none';
|
tuli_div.style.display = 'none';
|
imgTuLi.src = "images/Leng/i_expand.png";
|
|
dojo.style(tuliContaner, {
|
"width" : "28px",
|
"height" : "28px"
|
});
|
}
|
}));
|
}
|
topic.publish("ReModifyLoc");
|
}
|
},
|
|
_initLegendsNodeByChartsView : function(legendsNode, chartsView, widthTuLiDiv, label) {
|
var colorList = chartsView._data._itemVisuals;
|
var labelList = chartsView._data._idList;
|
|
var legendInfos = [];
|
|
if (label != null) {
|
var tuliTitle = dojo.doc.createElement("div");
|
|
dojo.style(tuliTitle, {
|
"width" : "100%",
|
"height" : "27px",
|
//'background-color' : 'rgb(201, 234, 251)',
|
'border-bottom-color' : 'rgb(201, 234, 251)',
|
'border-bottom-style' : 'solid',
|
'border-bottom-width' : '1px'
|
});
|
|
var tuliTitleCaption = dojo.doc.createElement("div");
|
|
dojo.style(tuliTitleCaption, {
|
"width" : "100%",
|
"height" : "100%"
|
});
|
|
var tuliTitleSpan = dojo.doc.createElement("span");
|
|
dojo.style(tuliTitleSpan, {
|
'display' : 'inline-block',
|
'padding-top' : '5px',
|
'font-weight' : 'bold'
|
});
|
|
tuliTitleSpan.textContent = label;
|
|
tuliTitleCaption.appendChild(tuliTitleSpan);
|
|
tuliTitle.appendChild(tuliTitleCaption);
|
|
legendsNode.appendChild(tuliTitle);
|
}
|
|
arrayUtils.forEach(colorList, function(legendInfo, index) {
|
var label = labelList[index];
|
|
var legendDiv = dojo.create("div", {
|
"class" : "legend-div",
|
"style" : "overflow:hidden;padding-top:5px;"
|
});
|
|
var lengendSymbol = dojo.create("div", {
|
"class" : "legend-symbol jimu-float-leading"
|
});
|
|
dojo.style(lengendSymbol, {
|
'background-color' : legendInfo.color,
|
'width' : '40px',
|
'height' : '18px'
|
});
|
|
var labelDiv = dojo.create("div", {
|
"class" : "legend-label jimu-float-leading",
|
"innerHTML" : label,
|
});
|
|
dojo.style(labelDiv, {
|
'text-overflow' : 'clip',
|
'padding-left' : '5px'
|
});
|
|
legendDiv.appendChild(lengendSymbol);
|
|
legendDiv.appendChild(labelDiv);
|
|
legendsNode.appendChild(legendDiv);
|
|
}, this);
|
},
|
|
_CreateLengendChartOption : function(LayerRender) {
|
var chartOption = this.getLengendChartOption();
|
|
if (LayerRender) {
|
//图表内容
|
if (LayerRender.labelField) {
|
if (chartOption.title) {
|
chartOption.title.text = this.id;
|
}
|
|
}
|
|
if (LayerRender.classfyFields) {
|
var colors = [];
|
|
for (var i = 0; i < LayerRender.classfyFields.length; i++) {
|
var pieColorList = LayerRender.classfyFields[i].data;
|
|
for (var j = 0; j < pieColorList.length; j++) {
|
var pieColor = pieColorList[j].pieColor;
|
|
if (pieColor) {
|
colors.push(pieColor);
|
}
|
}
|
};
|
|
if (colors.length > 0) {
|
chartOption.color = colors;
|
}
|
}
|
}
|
|
return chartOption;
|
},
|
|
getLengendChartOption : function() {
|
var chartContent = this._chartContent;
|
//图表内容
|
var model = chartContent.model;
|
//模型
|
var dataList = chartContent.datalist;
|
|
var chartWidth = chartContent.width;
|
//图表的宽度
|
var chartHeight = chartContent.height;
|
|
//数据集
|
var chartWidth = 30;
|
//图表的宽度
|
var chartHeight = 30;
|
|
//图表的高度
|
var refField = chartContent.reffield;
|
//关联行政区划字段名称
|
var dataField = chartContent.datafield;
|
//图表类型
|
var chartType = chartContent.chartType;
|
|
var echartOption = null;
|
var data = dataList; //debugger;
|
if (data.length > 0) {//判断是否匹配到行政区划点
|
var Newmodel = lang.clone(model);
|
for (var i = 0; i < dataField.length; i++) {
|
if (chartType && chartType == "radar") {//雷达图
|
if (i + 1 == dataField.length) {
|
Newmodel.radar[0].indicator = lang.clone(eval("data[0]." + dataField[i]));
|
} else {
|
Newmodel.series[i].data = lang.clone(eval("data[0]." + dataField[i]));
|
}
|
} else if (chartType && chartType == "graph") {//关系图
|
if (dataField.length == 3) {
|
Newmodel.series[i].nodes = lang.clone(eval("data[0]." + dataField[0]));
|
Newmodel.series[i].links = lang.clone(eval("data[0]." + dataField[1]));
|
Newmodel.series[i].categories = lang.clone(eval("data[0]." + dataField[2]));
|
break;
|
}
|
} else if (chartType && chartType == "bar") {
|
if (i + 1 == dataField.length) {
|
Newmodel.xAxis[0].data = lang.clone(eval("data[0]." + dataField[i]));
|
} else {
|
Newmodel.series[i].data = lang.clone(eval("data[0]." + dataField[i]));
|
}
|
} else {
|
if (Newmodel.series[i].matrix) {
|
Newmodel.series[i].matrix = lang.clone(eval("data[0]." + dataField[i]));
|
} else {
|
|
Newmodel.series[i].data = lang.clone(eval("data[0]." + dataField[i]));
|
if (Newmodel.series[i].radius && Newmodel.series[i].radius.length>1 && dataField.length > 1) {
|
Newmodel.series[i].radius[0] = i * 20;
|
Newmodel.series[i].radius[1] = (i + 1) * 15;
|
|
}
|
|
}
|
}
|
//转换对象,把数据系列填充模型的属性
|
}
|
//by hugongzuo@163.com
|
var xAxisData=chartContent.xAxisData;
|
var yAxisData=chartContent.yAxisData;
|
if(Newmodel.xAxis!=null && xAxisData!=null){
|
for(var i=0;i<Newmodel.xAxis.length;i++){
|
if(Newmodel.xAxis[i].data=="xAxisData"){
|
Newmodel.xAxis[i].data=xAxisData[i];
|
}
|
}
|
}
|
if(Newmodel.yAxis!=null && yAxisData!=null){
|
for(var i=0;i<Newmodel.yAxis.length;i++){
|
if(Newmodel.yAxis[i].data=="yAxisData"){
|
Newmodel.yAxis[i].data=yAxisData[i];
|
}
|
}
|
}
|
echartOption = Newmodel;
|
}
|
if (echartOption) {
|
if (echartOption.series && echartOption.series.length >= 1 && echartOption.series[0].type == "pie") {
|
for (var i = 0; i < echartOption.series.length; i++) {
|
var data = echartOption.series[i].data;
|
|
if (data) {
|
for (var j = 0; j < data.length; j++) {
|
if (data[j].value) {
|
data[j].value = 10;
|
}
|
};
|
if(j==1){
|
data[0].name=echartOption.series[i].name;
|
}
|
}
|
};
|
|
echartOption.tooltip = null;
|
|
return echartOption;
|
}
|
}
|
|
return null;
|
}
|
});
|
});
|