提交 fa66a607 编写于 作者: K kener

【准纪守法,优化代码】代码规范

上级 f7c9bd89
......@@ -38,11 +38,11 @@ define(function (require) {
}
Scatter.prototype = {
type : ecConfig.CHART_TYPE_SCATTER,
type: ecConfig.CHART_TYPE_SCATTER,
/**
* 绘制图形
*/
_buildShape : function () {
_buildShape: function () {
var series = this.series;
this._sIndex2ColorMap = {}; // series默认颜色索引,seriesIndex索引到color
this._symbol = this.option.symbolList;
......@@ -60,7 +60,7 @@ define(function (require) {
for (var i = 0, l = series.length; i < l; i++) {
serie = series[i];
serieName = serie.name;
if (serie.type == ecConfig.CHART_TYPE_SCATTER) {
if (serie.type === ecConfig.CHART_TYPE_SCATTER) {
series[i] = this.reformOption(series[i]);
this._sIndex2ShapeMap[i] = this.query(serie, 'symbol')
|| this._symbol[i % this._symbol.length];
......@@ -122,7 +122,7 @@ define(function (require) {
/**
* 构建类目轴为水平方向的散点图系列
*/
_buildSeries : function (seriesArray) {
_buildSeries: function (seriesArray) {
if (seriesArray.length === 0) {
return;
}
......@@ -150,12 +150,12 @@ define(function (require) {
pointList[seriesIndex] = [];
for (var i = 0, l = serie.data.length; i < l; i++) {
data = serie.data[i];
value = typeof data != 'undefined'
? (typeof data.value != 'undefined'
value = data != null
? (data.value != null
? data.value
: data)
: '-';
if (value == '-' || value.length < 2) {
if (value === '-' || value.length < 2) {
// 数据格式不符
continue;
}
......@@ -179,18 +179,18 @@ define(function (require) {
this._buildPointList(pointList);
},
_markMap : function (xAxis, yAxis, data, pointList) {
_markMap: function (xAxis, yAxis, data, pointList) {
var xMarkMap = {
min0 : Number.POSITIVE_INFINITY,
max0 : Number.NEGATIVE_INFINITY,
sum0 : 0,
counter0 : 0,
average0 : 0,
min1 : Number.POSITIVE_INFINITY,
max1 : Number.NEGATIVE_INFINITY,
sum1 : 0,
counter1 : 0,
average1 : 0
min0: Number.POSITIVE_INFINITY,
max0: Number.NEGATIVE_INFINITY,
sum0: 0,
counter0: 0,
average0: 0,
min1: Number.POSITIVE_INFINITY,
max1: Number.NEGATIVE_INFINITY,
sum1: 0,
counter1: 0,
average1: 0
};
var value;
for (var i = 0, l = pointList.length; i < l; i++) {
......@@ -273,7 +273,7 @@ define(function (require) {
/**
* 生成折线和折线上的拐点
*/
_buildPointList : function (pointList) {
_buildPointList: function (pointList) {
var series = this.series;
var serie;
var seriesPL;
......@@ -323,7 +323,7 @@ define(function (require) {
/**
* 生成折线图上的拐点图形
*/
_getSymbol : function (seriesIndex, dataIndex, name, x, y) {
_getSymbol: function (seriesIndex, dataIndex, name, x, y) {
var series = this.series;
var serie = series[seriesIndex];
var data = serie.data[dataIndex];
......@@ -355,24 +355,24 @@ define(function (require) {
return itemShape;
},
_getLargeSymbol : function (pointList, nColor) {
_getLargeSymbol: function (pointList, nColor) {
return new SymbolShape({
zlevel : this._zlevelBase,
_main : true,
zlevel: this._zlevelBase,
_main: true,
hoverable: false,
style : {
pointList : pointList,
color : nColor,
strokeColor : nColor
style: {
pointList: pointList,
color: nColor,
strokeColor: nColor
},
highlightStyle : {
pointList : []
highlightStyle: {
pointList: [ ]
}
});
},
// 位置转换
getMarkCoord : function (seriesIndex, mpData) {
getMarkCoord: function (seriesIndex, mpData) {
var serie = this.series[seriesIndex];
var xMarkMap = this.xMarkMap[seriesIndex];
var xAxis = this.component.xAxis.getAxis(serie.xAxisIndex);
......@@ -380,12 +380,11 @@ define(function (require) {
var pos;
if (mpData.type
&& (mpData.type == 'max' || mpData.type == 'min' || mpData.type == 'average')
&& (mpData.type === 'max' || mpData.type === 'min' || mpData.type === 'average')
) {
// 特殊值内置支持
// 默认取纵值
var valueIndex = typeof mpData.valueIndex != 'undefined'
? mpData.valueIndex : 1;
var valueIndex = mpData.valueIndex != null ? mpData.valueIndex : 1;
pos = [
xMarkMap[mpData.type + 'X' + valueIndex],
xMarkMap[mpData.type + 'Y' + valueIndex],
......@@ -411,7 +410,7 @@ define(function (require) {
/**
* 刷新
*/
refresh : function (newOption) {
refresh: function (newOption) {
if (newOption) {
this.option = newOption;
this.series = newOption.series;
......@@ -426,7 +425,7 @@ define(function (require) {
* @param {Object} param
* @param {Object} status
*/
ondataRange : function (param, status) {
ondataRange: function (param, status) {
if (this.component.dataRange) {
this.refresh();
status.needRefresh = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册