Skip to content

Commit

Permalink
Style: eslint规则格式化修整。
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-xiao-jian committed May 20, 2016
1 parent 7ef003c commit 38eff44
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 166 deletions.
16 changes: 8 additions & 8 deletions develop/src/echarts-ng-dimension.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (angular) {
"use strict";

angular.module('echarts-ng').provider('$dimension', DimensionAssistanceProvider);
angular.module("echarts-ng").provider("$dimension", DimensionAssistanceProvider);

/**
* @ngdoc service
Expand Down Expand Up @@ -46,12 +46,12 @@
*/
function shouldAdaptDimension(element, dimension) {
if (!angular.isString(dimension)) {
console.warn("The Pass Pixel Ratio Not Assign, Please Make Sure Height Already Specified");
console.warn("The Pass Pixel Ratio Not Assign, Please Make Sure Height Already Specified"); //eslint-disable-line no-console
return false;
}

if (dimension.split(':').length !== 2) {
console.warn("The Pass Pixel Ratio Invalid, Please Verify Param");
if (dimension.split(":").length !== 2) {
console.warn("The Pass Pixel Ratio Invalid, Please Verify Param"); //eslint-disable-line no-console
return false;
}

Expand All @@ -73,12 +73,12 @@
function adaptEchartsDimension(element, dimension) {
var width
, height
, ratio = dimension.split(':').reverse().map(Number);
, ratio = dimension.split(":").reverse().map(Number);

width = element.clientWidth;
height = width * ratio[0] / ratio[1];

element.style.height = height + 'px';
element.style.height = height + "px";
}

/**
Expand All @@ -91,7 +91,7 @@
* @description - remove echarts dimension
*/
function removeEchartsDimension(element) {
element.style.removeProperty ? element.style.removeProperty('height') : element.style.removeAttribute('height');
element.style.removeProperty ? element.style.removeProperty("height") : element.style.removeAttribute("height");
}

/**
Expand Down Expand Up @@ -133,7 +133,7 @@
break;
}

return base * length + 'px';
return base * length + "px";
}

/**
Expand Down
30 changes: 15 additions & 15 deletions develop/src/echarts-ng-waterfall.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (angular) {
"use strict";

angular.module('echarts-ng').provider('$waterfall', WaterfallAssistanceProvider);
angular.module("echarts-ng").provider("$waterfall", WaterfallAssistanceProvider);

/**
* @ngdoc service
Expand Down Expand Up @@ -44,7 +44,7 @@

var target = config.series[0];

return (angular.isArray(target.data) && angular.equals(target.type, 'waterfall'));
return (angular.isArray(target.data) && angular.equals(target.type, "waterfall"));
}

/**
Expand All @@ -62,11 +62,11 @@

var setting = {
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'shadow'
type: "shadow"
},
formatter: '{a1}: <br/> {b1}: {c1}'
formatter: "{a1}: <br/> {b1}: {c1}"
}
};

Expand Down Expand Up @@ -132,30 +132,30 @@

var target = config.series[0]
, extension = {
stack: 'waterfall',
type: 'bar',
stack: "waterfall",
type: "bar",
label: {
normal: {
show: true,
position: 'inside'
position: "inside"
}
}
};

angular.extend(target, extension);

var helper = {
name: 'helper',
type: 'bar',
stack: 'waterfall',
name: "helper",
type: "bar",
stack: "waterfall",
itemStyle: {
normal: {
barBorderColor: 'rgba(0,0,0,1)',
color: 'rgba(0,0,0,0)'
barBorderColor: "rgba(0,0,0,1)",
color: "rgba(0,0,0,0)"
},
emphasis: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
barBorderColor: "rgba(0,0,0,0)",
color: "rgba(0,0,0,0)"
}
},
data: waterfall.calculateWaterfallFlow(target.data)
Expand Down
2 changes: 1 addition & 1 deletion develop/src/echarts-ng.declare.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
*
* @description - simple angular wrap for baidu echarts
*/
angular.module('echarts-ng', []);
angular.module("echarts-ng", []);
})(angular);
27 changes: 13 additions & 14 deletions develop/src/echarts-ng.directive.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (angular, echarts) {
"use strict";

angular.module('echarts-ng').directive('echarts', echartsDirective);
angular.module("echarts-ng").directive("echarts", echartsDirective);

/**
* @ngdoc directive
Expand All @@ -18,27 +18,26 @@
*
* @description - simple angular directive wrap for echarts
*/
echartsDirective.$inject = ['$echarts', '$dimension'];
echartsDirective.$inject = ["$echarts", "$dimension"];
function echartsDirective($echarts, $dimension) {
return {
priority: 5,
restrict: 'A',
restrict: "A",
scope: {
echarts: '=',
echartsDimension: '=',
config: '='
echarts: "=",
echartsDimension: "=",
config: "="
},
bindToController: true,
controller: ['$scope', '$element', function ($scope, $element) {
controller: ["$scope", "$element", function ($scope, $element) {
var vm = this;

var OPTION = $echarts.getEchartsGlobalOption()
, identity = vm.echarts
, config = vm.config
, element = $element[0];

if (!identity) {
throw new Error('Echarts Instance Identity Required');
throw new Error("Echarts Instance Identity Required");
}

/**
Expand All @@ -64,26 +63,26 @@
// 绘制实例对象
$echarts.updateEchartsInstance(identity, vm.config);

$scope.$watchCollection('chart.config.title', function (current, prev) {
$scope.$watchCollection("chart.config.title", function (current, prev) {
if (!angular.equals(current, prev)) {
$echarts.updateEchartsInstance(identity, vm.config);
}
});

$scope.$watchCollection('chart.config.series', function (current, prev) {
$scope.$watchCollection("chart.config.series", function (current, prev) {
if (!angular.equals(current, prev)) {
$echarts.updateEchartsInstance(identity, vm.config);
}
});

$scope.$on('$destroy', function () {
$scope.$on("$destroy", function () {
instance.clear();
instance.dispose();
$echarts.removeEchartsInstance(identity);
$dimension.removeEchartsDimension(element);
});
}],
controllerAs: 'chart'
}
controllerAs: "chart"
};
}
})(angular, echarts);
38 changes: 20 additions & 18 deletions develop/src/echarts-ng.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (angular) {
"use strict";

angular.module('echarts-ng').provider('$echarts', EchartsAssistanceProvider);
angular.module("echarts-ng").provider("$echarts", EchartsAssistanceProvider);

/**
* @ngdoc service
Expand All @@ -14,30 +14,30 @@

// base echarts options
ctx.GLOBAL_OPTION = {
theme: 'macarons',
theme: "macarons",
driftPalette: true,
title: {
left: 'center',
top: 'top',
left: "center",
top: "top",
padding: [20, 10, 10, 10]
},
grid: {
top: '15%',
left: '5%',
right: '5%',
bottom: '5%',
top: "15%",
left: "5%",
right: "5%",
bottom: "5%",
containLabel: true
},
backgroundColor: 'rgba(255, 255, 255, .5)',
backgroundColor: "rgba(255, 255, 255, .5)",
legend: {
left: 'center',
top: 'top',
left: "center",
top: "top",
padding: [20, 10, 10, 10]
},
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'shadow'
type: "shadow"
}
}
};
Expand All @@ -56,9 +56,11 @@
*
* @description - echarts-ng util method
*/
ctx.$get = ['$q', '$timeout', '$waterfall', '$dimension', function ($q, $timeout, $waterfall, $dimension) {
ctx.$get = ["$q", "$timeout", "$waterfall", "$dimension", function ($q, $timeout, $waterfall, $dimension) {
var assistance = {};

/*global EchartsDecorativeMap*/

/**
* @ngdoc property
* @name echarts-ng.service:storage
Expand Down Expand Up @@ -134,8 +136,8 @@
if (assistance.storage.has(identity)) {
deferred.resolve(assistance.storage.get(identity));
} else {
console.error('Echarts Identity Not Registered, Please Verify The Process');
deferred.reject({errorDesc: 'Echarts Identity Not Registered, Please Verify The Process'});
console.error("Echarts Identity Not Registered, Please Verify The Process"); //eslint-disable-line no-console
deferred.reject({errorDesc: "Echarts Identity Not Registered, Please Verify The Process"});
}
}, 0);

Expand Down Expand Up @@ -170,7 +172,7 @@
, decorativeConfig;

if (angular.isUndefined(instance)) {
console.warn("The instance not registered. Probably the exception belongs to the directive wrap");
console.warn("The instance not registered. Probably the exception belongs to the directive wrap"); //eslint-disable-line no-console
return;
}

Expand All @@ -184,7 +186,7 @@
instance.setOption(decorativeConfig);
} else {
//instance.clear();
instance.showLoading('default', {maskColor: 'rgba(255, 255, 255, 1)'});
instance.showLoading("default", {maskColor: "rgba(255, 255, 255, 1)"});
}
}

Expand Down
3 changes: 2 additions & 1 deletion develop/src/echarts-ng.shim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(function (window) {
"use strict";

/*global Map:true*/
window.EchartsDecorativeMap = Map || AdaptableMap;

/**
Expand Down Expand Up @@ -28,7 +29,7 @@
if (this.has(identity)) delete this.storage[identity];
};

Object.defineProperty(AdaptableMap.prototype, 'size', {
Object.defineProperty(AdaptableMap.prototype, "size", {
enumerable: true,
configurable: false,
get: function () {
Expand Down
Loading

0 comments on commit 38eff44

Please sign in to comment.