diff --git a/develop/src/echarts-ng-dimension.service.js b/develop/src/echarts-ng-dimension.service.js
index b212792..669d1e0 100644
--- a/develop/src/echarts-ng-dimension.service.js
+++ b/develop/src/echarts-ng-dimension.service.js
@@ -1,7 +1,7 @@
(function (angular) {
"use strict";
- angular.module('echarts-ng').provider('$dimension', DimensionAssistanceProvider);
+ angular.module("echarts-ng").provider("$dimension", DimensionAssistanceProvider);
/**
* @ngdoc service
@@ -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;
}
@@ -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";
}
/**
@@ -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");
}
/**
@@ -133,7 +133,7 @@
break;
}
- return base * length + 'px';
+ return base * length + "px";
}
/**
diff --git a/develop/src/echarts-ng-waterfall.service.js b/develop/src/echarts-ng-waterfall.service.js
index fa26f1d..2354723 100644
--- a/develop/src/echarts-ng-waterfall.service.js
+++ b/develop/src/echarts-ng-waterfall.service.js
@@ -1,7 +1,7 @@
(function (angular) {
"use strict";
- angular.module('echarts-ng').provider('$waterfall', WaterfallAssistanceProvider);
+ angular.module("echarts-ng").provider("$waterfall", WaterfallAssistanceProvider);
/**
* @ngdoc service
@@ -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"));
}
/**
@@ -62,11 +62,11 @@
var setting = {
tooltip: {
- trigger: 'axis',
+ trigger: "axis",
axisPointer: {
- type: 'shadow'
+ type: "shadow"
},
- formatter: '{a1}:
{b1}: {c1}'
+ formatter: "{a1}:
{b1}: {c1}"
}
};
@@ -132,12 +132,12 @@
var target = config.series[0]
, extension = {
- stack: 'waterfall',
- type: 'bar',
+ stack: "waterfall",
+ type: "bar",
label: {
normal: {
show: true,
- position: 'inside'
+ position: "inside"
}
}
};
@@ -145,17 +145,17 @@
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)
diff --git a/develop/src/echarts-ng.declare.js b/develop/src/echarts-ng.declare.js
index ae9cc3d..c163b5f 100644
--- a/develop/src/echarts-ng.declare.js
+++ b/develop/src/echarts-ng.declare.js
@@ -9,5 +9,5 @@
*
* @description - simple angular wrap for baidu echarts
*/
- angular.module('echarts-ng', []);
+ angular.module("echarts-ng", []);
})(angular);
\ No newline at end of file
diff --git a/develop/src/echarts-ng.directive.js b/develop/src/echarts-ng.directive.js
index c475740..545619b 100644
--- a/develop/src/echarts-ng.directive.js
+++ b/develop/src/echarts-ng.directive.js
@@ -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
@@ -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");
}
/**
@@ -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);
\ No newline at end of file
diff --git a/develop/src/echarts-ng.service.js b/develop/src/echarts-ng.service.js
index fca8ea6..6a9b373 100644
--- a/develop/src/echarts-ng.service.js
+++ b/develop/src/echarts-ng.service.js
@@ -1,7 +1,7 @@
(function (angular) {
"use strict";
- angular.module('echarts-ng').provider('$echarts', EchartsAssistanceProvider);
+ angular.module("echarts-ng").provider("$echarts", EchartsAssistanceProvider);
/**
* @ngdoc service
@@ -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"
}
}
};
@@ -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
@@ -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);
@@ -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;
}
@@ -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)"});
}
}
diff --git a/develop/src/echarts-ng.shim.js b/develop/src/echarts-ng.shim.js
index 51ce59f..360f8c2 100644
--- a/develop/src/echarts-ng.shim.js
+++ b/develop/src/echarts-ng.shim.js
@@ -1,6 +1,7 @@
(function (window) {
"use strict";
+ /*global Map:true*/
window.EchartsDecorativeMap = Map || AdaptableMap;
/**
@@ -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 () {
diff --git a/test/directive/echarts.spec.js b/test/directive/echarts.spec.js
index b20f0c5..e43aaa7 100644
--- a/test/directive/echarts.spec.js
+++ b/test/directive/echarts.spec.js
@@ -1,80 +1,77 @@
-describe('echarts-ng echarts directive', function () {
+describe("echarts-ng echarts directive", function () {
var $echarts
- , $timeout
, $rootScope
, $scope
, $compile
- , body = $('body')
- , $element
- , template = $('
').appendTo(body);
+ , body = $("body")
+ , template = $("").appendTo(body);
beforeEach(function () {
- module('echarts-ng');
+ module("echarts-ng");
});
- beforeEach(inject(function (_$echarts_, _$timeout_, _$rootScope_, _$compile_) {
+ beforeEach(inject(function (_$echarts_, _$rootScope_, _$compile_) {
$echarts = _$echarts_;
- $timeout = _$timeout_;
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
$compile = _$compile_;
}));
- describe('echarts-ng echarts directive exception handle', function () {
- it('should throw error when miss identity', function () {
+ describe("echarts-ng echarts directive exception handle", function () {
+ it("should throw error when miss identity", function () {
expect($compile(template).bind(this, $scope)).toThrow();
});
});
- describe('echarts-ng echarts directive core implement', function () {
+ describe("echarts-ng echarts directive core implement", function () {
var updateEchartsInstance;
beforeEach(function () {
- updateEchartsInstance = spyOn($echarts, 'updateEchartsInstance').and.stub();
+ updateEchartsInstance = spyOn($echarts, "updateEchartsInstance").and.stub();
$scope.identity = $echarts.generateInstanceIdentity();
- $scope.dimension = '5:4';
+ $scope.dimension = "5:4";
$scope.config = {
title: {
- text: 'Pie Chart',
- left: 'center',
+ text: "Pie Chart",
+ left: "center",
top: 20,
textStyle: {
- color: '#ccc'
+ color: "#ccc"
}
},
xAxis: [{
- type: 'category',
- data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
+ type: "category",
+ data: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
}],
yAxis: [{
- type: 'value'
+ type: "value"
}],
series: [{
- name: '搜索引擎',
- type: 'bar',
+ name: "搜索引擎",
+ type: "bar",
data: [820, 932, 901, 934, 1290, 1330, 1320]
}]
- }
+ };
});
beforeEach(function () {
- $element = $compile(template)($scope);
+ $compile(template)($scope);
$scope.$digest();
});
- it('should synchronize title change', function () {
- $scope.config.title.left = 'left';
+ it("should synchronize title change", function () {
+ $scope.config.title.left = "left";
$scope.$digest();
expect(updateEchartsInstance).toHaveBeenCalledWith($scope.identity, $scope.config);
});
- it('should synchronize title change', function () {
- $scope.config.title.textStyle = {fontStyle: 'italic'};
+ it("should synchronize title change", function () {
+ $scope.config.title.textStyle = {fontStyle: "italic"};
$scope.$digest();
expect(updateEchartsInstance).toHaveBeenCalledWith($scope.identity, $scope.config);
});
- it('should synchronize series change', function () {
+ it("should synchronize series change", function () {
$scope.config.series[0] = {
name: "jasmine",
type: "bar",
@@ -84,7 +81,7 @@ describe('echarts-ng echarts directive', function () {
expect(updateEchartsInstance).toHaveBeenCalledWith($scope.identity, $scope.config);
});
- it('should synchronize series change', function () {
+ it("should synchronize series change", function () {
$scope.config.series[1] = {
name: "jasmine",
type: "line",
diff --git a/test/service/dimension.spec.js b/test/service/dimension.spec.js
index 01db0df..1a24689 100644
--- a/test/service/dimension.spec.js
+++ b/test/service/dimension.spec.js
@@ -1,67 +1,67 @@
-describe('echarts-ng dimension service element irrelevant operation', function () {
+describe("echarts-ng dimension service element irrelevant operation", function () {
var $dimension;
- beforeEach(module('echarts-ng'));
+ beforeEach(module("echarts-ng"));
beforeEach(inject(function (_$dimension_) {
$dimension = _$dimension_;
}));
- it('should determine whether insert inline height when initialize', function () {
- var warn = spyOn(console, 'warn');
+ it("should determine whether insert inline height when initialize", function () {
+ var warn = spyOn(console, "warn");
expect(warn).not.toHaveBeenCalled();
expect($dimension.shouldAdaptDimension()).toBeFalsy();
expect($dimension.shouldAdaptDimension(null, 25)).toBeFalsy();
expect(warn).toHaveBeenCalled();
});
- it('should determine whether insert inline height when initialize', function () {
- var warn = spyOn(console, 'warn');
+ it("should determine whether insert inline height when initialize", function () {
+ var warn = spyOn(console, "warn");
expect(warn).not.toHaveBeenCalled();
- expect($dimension.shouldAdaptDimension(null, '100px')).toBeFalsy();
+ expect($dimension.shouldAdaptDimension(null, "100px")).toBeFalsy();
expect(warn).toHaveBeenCalled();
});
- it('should determine whether insert inline height when initialize', function () {
- var warn = spyOn(console, 'warn');
+ it("should determine whether insert inline height when initialize", function () {
+ var warn = spyOn(console, "warn");
expect(warn).not.toHaveBeenCalled();
- expect($dimension.shouldAdaptDimension(null, '16:9')).toBeTruthy();
+ expect($dimension.shouldAdaptDimension(null, "16:9")).toBeTruthy();
expect(warn).not.toHaveBeenCalled();
});
- it('should provide algorithm for dynamic height calculate', function () {
- expect($dimension.calculateDynamicDimension([{data: [10, 20, 15]}])).toEqual('180px');
+ it("should provide algorithm for dynamic height calculate", function () {
+ expect($dimension.calculateDynamicDimension([{data: [10, 20, 15]}])).toEqual("180px");
});
- it('should provide algorithm for dynamic height calculate', function () {
- expect($dimension.calculateDynamicDimension([{data: [10, 20, 15, 25, 45, 50]}])).toEqual('270px');
+ it("should provide algorithm for dynamic height calculate", function () {
+ expect($dimension.calculateDynamicDimension([{data: [10, 20, 15, 25, 45, 50]}])).toEqual("270px");
});
- it('should provide algorithm for dynamic height calculate', function () {
- expect($dimension.calculateDynamicDimension([{data: [10, 20, 15, 10, 20, 15, 10, 20, 15, 20]}])).toEqual('350px');
+ it("should provide algorithm for dynamic height calculate", function () {
+ expect($dimension.calculateDynamicDimension([{data: [10, 20, 15, 10, 20, 15, 10, 20, 15, 20]}])).toEqual("350px");
});
- it('should determine whether active dynamic height insert', function () {
+ it("should determine whether active dynamic height insert", function () {
expect($dimension.shouldAdjustEchartsDimension(false)).toBeFalsy();
expect($dimension.shouldAdjustEchartsDimension(true)).toBeFalsy();
});
- it('should determine whether active dynamic height insert', function () {
+ it("should determine whether active dynamic height insert", function () {
expect($dimension.shouldAdjustEchartsDimension(false)).toBeFalsy();
expect($dimension.shouldAdjustEchartsDimension(true)).toBeFalsy();
});
- it('should determine whether active dynamic height insert', function () {
+ it("should determine whether active dynamic height insert", function () {
expect($dimension.shouldAdjustEchartsDimension(true, null)).toBeFalsy();
expect($dimension.shouldAdjustEchartsDimension(true, [])).toBeFalsy();
});
- it('should determine whether active dynamic height insert', function () {
+ it("should determine whether active dynamic height insert", function () {
expect($dimension.shouldAdjustEchartsDimension(true, [{data: []}])).toBeTruthy();
});
- it('should wrap echarts instance resize', function () {
- var instance = jasmine.createSpyObj('instance', ['resize']);
+ it("should wrap echarts instance resize", function () {
+ var instance = jasmine.createSpyObj("instance", ["resize"]);
expect(instance.resize).not.toHaveBeenCalled();
$dimension.synchronizeEchartsDimension(instance);
@@ -69,20 +69,20 @@ describe('echarts-ng dimension service element irrelevant operation', function (
});
});
-describe('echarts-ng dimension service element related operation', function () {
+describe("echarts-ng dimension service element related operation", function () {
var $dimension
- , body = $('body')
+ , body = $("body")
, template
, element;
- beforeEach(module('echarts-ng'));
+ beforeEach(module("echarts-ng"));
beforeEach(inject(function (_$dimension_) {
$dimension = _$dimension_;
}));
beforeEach(function () {
- template = $('').appendTo(body);
+ template = $("").appendTo(body);
element = template[0];
});
@@ -91,21 +91,21 @@ describe('echarts-ng dimension service element related operation', function () {
element = null;
});
- it('should provide original height avoid echarts error', function () {
- $dimension.adaptEchartsDimension(element, '10:7');
+ it("should provide original height avoid echarts error", function () {
+ $dimension.adaptEchartsDimension(element, "10:7");
expect(template.height()).toEqual(70);
});
- it('should remove inline height', function () {
+ it("should remove inline height", function () {
var originalHeight = template.height();
- $dimension.adaptEchartsDimension(element, '10:7');
+ $dimension.adaptEchartsDimension(element, "10:7");
$dimension.removeEchartsDimension(element);
expect(template.height()).toEqual(originalHeight);
});
- it('should provide dynamic height avoid ugly visual', function () {
- spyOn($dimension, 'calculateDynamicDimension').and.returnValue('70px');
+ it("should provide dynamic height avoid ugly visual", function () {
+ spyOn($dimension, "calculateDynamicDimension").and.returnValue("70px");
$dimension.adjustEchartsDimension(element, []);
expect(template.height()).toEqual(70);
});
diff --git a/test/service/echarts.spec.js b/test/service/echarts.spec.js
index 67f7878..d3df54d 100644
--- a/test/service/echarts.spec.js
+++ b/test/service/echarts.spec.js
@@ -1,11 +1,11 @@
-describe('echarts-ng $echarts service', function () {
+describe("echarts-ng $echarts service", function () {
var $echarts
, $dimension
, $waterfall
, $timeout
, $rootScope;
- beforeEach(module('echarts-ng'));
+ beforeEach(module("echarts-ng"));
beforeEach(inject(function (_$echarts_, _$dimension_, _$waterfall_, _$timeout_, _$rootScope_) {
$echarts = _$echarts_;
@@ -15,16 +15,16 @@ describe('echarts-ng $echarts service', function () {
$rootScope = _$rootScope_;
}));
- it('should provide unique identity each time', function () {
+ it("should provide unique identity each time", function () {
var first = $echarts.generateInstanceIdentity()
, second = $echarts.generateInstanceIdentity();
expect(first).not.toEqual(second);
});
- it('should register each echarts instance', function () {
+ it("should register each echarts instance", function () {
var identity = $echarts.generateInstanceIdentity()
- , instance = 'jasmine-test';
+ , instance = "jasmine-test";
$echarts.registerEchartsInstance(identity, instance);
@@ -35,9 +35,9 @@ describe('echarts-ng $echarts service', function () {
expect($echarts.storage.has(identity)).toBeFalsy();
});
- it('should provide specific instance with promise', function () {
+ it("should provide specific instance with promise", function () {
var identity = $echarts.generateInstanceIdentity()
- , instance = 'jasmine-test'
+ , instance = "jasmine-test"
, target;
$echarts.registerEchartsInstance(identity, instance);
@@ -51,9 +51,9 @@ describe('echarts-ng $echarts service', function () {
expect(target).toEqual(instance);
});
- it('should provide specific instance with promise', function () {
+ it("should provide specific instance with promise", function () {
var identity = $echarts.generateInstanceIdentity()
- , error = spyOn(console, 'error').and.stub()
+ , error = spyOn(console, "error").and.stub()
, errorDesc;
$echarts.queryEchartsInstance(identity).catch(function (item) {
@@ -67,50 +67,50 @@ describe('echarts-ng $echarts service', function () {
expect(error).toHaveBeenCalled();
});
- it('should warn when instance not registered', function () {
+ it("should warn when instance not registered", function () {
var identity = $echarts.generateInstanceIdentity()
- , warn = spyOn(console, 'warn').and.stub();
+ , warn = spyOn(console, "warn").and.stub();
$echarts.updateEchartsInstance(identity);
expect(warn).toHaveBeenCalled();
});
- it('should update instance into latest', function () {
+ it("should update instance into latest", function () {
var identity = $echarts.generateInstanceIdentity()
- , instance = jasmine.createSpyObj('instance', ['setOption', 'getOption', 'showLoading', 'hideLoading', 'resize', 'clear', 'getDom']);
+ , instance = jasmine.createSpyObj("instance", ["setOption", "getOption", "showLoading", "hideLoading", "resize", "clear", "getDom"]);
$echarts.registerEchartsInstance(identity, instance);
- spyOn($waterfall, 'adaptWaterfallTooltip').and.stub();
- spyOn($dimension, 'adjustEchartsDimension').and.stub();
- spyOn($waterfall, 'adaptWaterfallSeries').and.returnValue({series: []});
+ spyOn($waterfall, "adaptWaterfallTooltip").and.stub();
+ spyOn($dimension, "adjustEchartsDimension").and.stub();
+ spyOn($waterfall, "adaptWaterfallSeries").and.returnValue({series: []});
$echarts.updateEchartsInstance(identity, {});
expect(instance.showLoading).toHaveBeenCalled();
});
- it('should update instance into latest', function () {
+ it("should update instance into latest", function () {
var identity = $echarts.generateInstanceIdentity()
- , instance = jasmine.createSpyObj('instance', ['setOption', 'getOption', 'showLoading', 'hideLoading', 'resize', 'clear', 'getDom'])
+ , instance = jasmine.createSpyObj("instance", ["setOption", "getOption", "showLoading", "hideLoading", "resize", "clear", "getDom"])
, series = [{
- name: '搜索引擎',
- type: 'bar',
- data: [820, 932, 901, 934, 1290, 1330, 1320]
- }];
+ name: "搜索引擎",
+ type: "bar",
+ data: [820, 932, 901, 934, 1290, 1330, 1320]
+ }];
$echarts.registerEchartsInstance(identity, instance);
- spyOn($waterfall, 'adaptWaterfallTooltip').and.stub();
- spyOn($dimension, 'adjustEchartsDimension').and.stub();
- spyOn($waterfall, 'adaptWaterfallSeries').and.returnValue({series: series});
+ spyOn($waterfall, "adaptWaterfallTooltip").and.stub();
+ spyOn($dimension, "adjustEchartsDimension").and.stub();
+ spyOn($waterfall, "adaptWaterfallSeries").and.returnValue({series: series});
$echarts.updateEchartsInstance(identity, {});
expect(instance.setOption).toHaveBeenCalledWith({series: series});
});
- it('should drift the original palette property', function () {
+ it("should drift the original palette property", function () {
var palette = ["#2ec7c9", "#b6a2de", "#5ab1ef", "#ffb980"]
, driftPalette = ["#5ab1ef", "#ffb980", "#2ec7c9", "#b6a2de"]
, driftOverflowPalette = ["#b6a2de", "#5ab1ef", "#ffb980", "#2ec7c9"];
@@ -119,9 +119,9 @@ describe('echarts-ng $echarts service', function () {
expect($echarts.driftPaletteProperty(palette, 5)).toEqual(driftOverflowPalette);
});
- it('should drift instance palette', function () {
+ it("should drift instance palette", function () {
var identity = $echarts.generateInstanceIdentity()
- , instance = jasmine.createSpyObj('instance', ['getOption', 'setOption']);
+ , instance = jasmine.createSpyObj("instance", ["getOption", "setOption"]);
instance.getOption.and.returnValues({color: ["#2ec7c9", "#b6a2de", "#5ab1ef", "#ffb980"]});
@@ -138,14 +138,14 @@ describe('echarts-ng $echarts service', function () {
});
});
-describe('echarts-ng $echarts provider', function () {
+describe("echarts-ng $echarts provider", function () {
var $echarts
, title = {
- left: 'center',
- top: 'top'
- };
+ left: "center",
+ top: "top"
+ };
- beforeEach(module('echarts-ng', function ($echartsProvider) {
+ beforeEach(module("echarts-ng", function ($echartsProvider) {
$echartsProvider.setGlobalOption({title: title});
}));
@@ -153,7 +153,7 @@ describe('echarts-ng $echarts provider', function () {
$echarts = _$echarts_;
}));
- it('should extend default global option with shallow override', function () {
+ it("should extend default global option with shallow override", function () {
expect($echarts.getEchartsGlobalOption().title).toEqual(title);
});
});
\ No newline at end of file
diff --git a/test/service/waterfall.spec.js b/test/service/waterfall.spec.js
index c50a9fa..24df5f4 100644
--- a/test/service/waterfall.spec.js
+++ b/test/service/waterfall.spec.js
@@ -1,26 +1,26 @@
-describe('echarts-ng waterfall service', function () {
+describe("echarts-ng waterfall service", function () {
var $waterfall;
- beforeEach(module('echarts-ng'));
+ beforeEach(module("echarts-ng"));
beforeEach(inject(function (_$waterfall_) {
$waterfall = _$waterfall_;
}));
- it('should provide assay result whether waterfall adapt should active', function () {
+ it("should provide assay result whether waterfall adapt should active", function () {
expect($waterfall.shouldAdaptWaterfall()).toBeFalsy();
expect($waterfall.shouldAdaptWaterfall({})).toBeFalsy();
expect($waterfall.shouldAdaptWaterfall({series: [1, 2]})).toBeFalsy();
- expect($waterfall.shouldAdaptWaterfall({series: [{data: 'hello world!'}]})).toBeFalsy();
- expect($waterfall.shouldAdaptWaterfall({series: [{type: 'bar'}]})).toBeFalsy();
+ expect($waterfall.shouldAdaptWaterfall({series: [{data: "hello world!"}]})).toBeFalsy();
+ expect($waterfall.shouldAdaptWaterfall({series: [{type: "bar"}]})).toBeFalsy();
- expect($waterfall.shouldAdaptWaterfall({series: [{type: 'waterfall', data: [10, 20, 30]}]})).toBeTruthy();
+ expect($waterfall.shouldAdaptWaterfall({series: [{type: "waterfall", data: [10, 20, 30]}]})).toBeTruthy();
});
- it('should provide switch adapt waterfall tooltip', function () {
- var instance = jasmine.createSpyObj('instance', ['setOption']);
+ it("should provide switch adapt waterfall tooltip", function () {
+ var instance = jasmine.createSpyObj("instance", ["setOption"]);
- spyOn($waterfall, 'shouldAdaptWaterfall').and.returnValues(false, true);
+ spyOn($waterfall, "shouldAdaptWaterfall").and.returnValues(false, true);
$waterfall.adaptWaterfallTooltip(instance, false);
expect(instance.setOption).not.toHaveBeenCalled();
@@ -29,25 +29,25 @@ describe('echarts-ng waterfall service', function () {
expect(instance.setOption).toHaveBeenCalledWith(jasmine.any(Object));
});
- it('should provide util sum method', function () {
+ it("should provide util sum method", function () {
expect($waterfall.calculateWaterfallSummary([1, 2, 3, 4])).toEqual(10);
});
/**
* @see {@link http://echarts.baidu.com/demo.html#bar-waterfall}
*/
- it('should provide waterfall step stone series', function () {
+ it("should provide waterfall step stone series", function () {
var base = [300, 900, 200, 300, 1200, 2900]
, target = [0, 300, 1200, 1400, 1700, 0];
expect($waterfall.calculateWaterfallFlow(base)).toEqual(target);
});
- it('should provide waterfall ultimate decoration', function () {
+ it("should provide waterfall ultimate decoration", function () {
var original = {
series: [{
- name: '生活费',
- type: 'waterfall',
+ name: "生活费",
+ type: "waterfall",
data: [300, 900, 200, 300, 1200, 2900]
}]
};