Browse Source

update

master
guy 7 years ago
parent
commit
4554c2b0b0
  1. 27016
      dist/base.js
  2. 30598
      dist/bundle.js
  3. 20
      dist/bundle.min.js
  4. 1946
      dist/case.js
  5. 1739
      dist/chart.js
  6. 6
      dist/core.js
  7. 41
      dist/polyfill.js
  8. 104
      dist/router.js
  9. 2250
      dist/widget.js
  10. 12
      src/addons/chart/chart.combine.js
  11. 6
      src/addons/chart/chart.js
  12. 50
      src/addons/chart/chart/chart.abstract.js
  13. 32
      src/addons/chart/chart/chart.accumulatearea.js
  14. 38
      src/addons/chart/chart/chart.accumulateaxis.js
  15. 42
      src/addons/chart/chart/chart.accumulatebar.js
  16. 28
      src/addons/chart/chart/chart.accumulateradar.js
  17. 40
      src/addons/chart/chart/chart.area.js
  18. 38
      src/addons/chart/chart/chart.axis.js
  19. 42
      src/addons/chart/chart/chart.bar.js
  20. 81
      src/addons/chart/chart/chart.bubble.js
  21. 48
      src/addons/chart/chart/chart.comparearea.js
  22. 100
      src/addons/chart/chart/chart.compareaxis.js
  23. 40
      src/addons/chart/chart/chart.comparebar.js
  24. 148
      src/addons/chart/chart/chart.dashboard.js
  25. 18
      src/addons/chart/chart/chart.donut.js
  26. 102
      src/addons/chart/chart/chart.fallaxis.js
  27. 10
      src/addons/chart/chart/chart.forcebubble.js
  28. 20
      src/addons/chart/chart/chart.gismap.js
  29. 40
      src/addons/chart/chart/chart.line.js
  30. 66
      src/addons/chart/chart/chart.map.js
  31. 58
      src/addons/chart/chart/chart.multiaxis.js
  32. 58
      src/addons/chart/chart/chart.multiaxiscombine.js
  33. 38
      src/addons/chart/chart/chart.percentaccumulatearea.js
  34. 36
      src/addons/chart/chart/chart.percentaccumulateaxis.js
  35. 46
      src/addons/chart/chart/chart.pie.js
  36. 28
      src/addons/chart/chart/chart.radar.js
  37. 40
      src/addons/chart/chart/chart.rangearea.js
  38. 70
      src/addons/chart/chart/chart.scatter.js
  39. 366
      src/addons/chart/factory.charts.js
  40. 8
      src/base/canvas/canvas.js
  41. 28
      src/base/collection/collection.js
  42. 36
      src/base/combination/combo.js
  43. 22
      src/base/combination/expander.js
  44. 22
      src/base/combination/group.button.js
  45. 10
      src/base/combination/group.combo.js
  46. 6
      src/base/combination/group.virtual.js
  47. 14
      src/base/combination/loader.js
  48. 4
      src/base/combination/navigation.js
  49. 24
      src/base/combination/searcher.js
  50. 12
      src/base/combination/switcher.js
  51. 8
      src/base/combination/tab.js
  52. 4
      src/base/combination/tree.button.js
  53. 4
      src/base/el.js
  54. 17050
      src/base/formula/codemirror/codemirror.js
  55. 16
      src/base/formula/codemirror/formula-hint.js
  56. 26
      src/base/formula/codemirror/formula-mode.js
  57. 99
      src/base/formula/codemirror/show-hint.js
  58. 4
      src/base/formula/config.js
  59. 20
      src/base/formula/formulaeditor.js
  60. 56
      src/base/foundation/message.js
  61. 34
      src/base/grid/grid.js
  62. 24
      src/base/layer/layer.floatbox.js
  63. 42
      src/base/layer/layer.popup.js
  64. 4
      src/base/layer/layer.searcher.js
  65. 4
      src/base/list/listview.js
  66. 4
      src/base/list/virtuallist.js
  67. 66
      src/base/pager/pager.js
  68. 6
      src/base/pane.js
  69. 2
      src/base/single/a/a.js
  70. 32
      src/base/single/bar/bar.loading.js
  71. 18
      src/base/single/button/button.basic.js
  72. 22
      src/base/single/button/button.node.js
  73. 10
      src/base/single/button/buttons/button.icon.js
  74. 6
      src/base/single/button/buttons/button.image.js
  75. 14
      src/base/single/button/buttons/button.js
  76. 2
      src/base/single/button/buttons/button.text.js
  77. 4
      src/base/single/button/listitem/blankiconicontextitem.js
  78. 8
      src/base/single/button/listitem/blankicontexticonitem.js
  79. 6
      src/base/single/button/listitem/blankicontextitem.js
  80. 10
      src/base/single/button/listitem/icontexticonitem.js
  81. 2
      src/base/single/button/listitem/icontextitem.js
  82. 2
      src/base/single/button/listitem/texticonitem.js
  83. 2
      src/base/single/button/listitem/textitem.js
  84. 10
      src/base/single/button/node/icontexticonnode.js
  85. 6
      src/base/single/button/node/icontextnode.js
  86. 4
      src/base/single/button/node/texticonnode.js
  87. 2
      src/base/single/button/node/textnode.js
  88. 28
      src/base/single/editor/editor.code.js
  89. 16
      src/base/single/editor/editor.js
  90. 4
      src/base/single/editor/editor.multifile.js
  91. 12
      src/base/single/editor/editor.textarea.js
  92. 2
      src/base/single/icon/icon.js
  93. 6
      src/base/single/iframe/iframe.js
  94. 2
      src/base/single/img/img.js
  95. 12
      src/base/single/input/checkbox.js
  96. 14
      src/base/single/input/input.js
  97. 12
      src/base/single/input/radio.js
  98. 14
      src/base/single/label/label.js
  99. 10
      src/base/single/link/link.js
  100. 6
      src/base/single/single.js
  101. Some files were not shown because too many files have changed in this diff Show More

27016
dist/base.js vendored

File diff suppressed because one or more lines are too long

30598
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

20
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

1946
dist/case.js vendored

File diff suppressed because it is too large Load Diff

1739
dist/chart.js vendored

File diff suppressed because it is too large Load Diff

6
dist/core.js vendored

@ -25715,10 +25715,10 @@ Data.Constant = BICst = {};
* 缓冲池 * 缓冲池
* @type {{Buffer: {}}} * @type {{Buffer: {}}}
*/ */
;
(function () { (function () {
var Buffer = {}; var Buffer = {};
var MODE = false;//设置缓存模式为关闭 var MODE = false;// 设置缓存模式为关闭
Data.BufferPool = { Data.BufferPool = {
put: function (name, cache) { put: function (name, cache) {
@ -25736,7 +25736,7 @@ Data.Constant = BICst = {};
* 共享池 * 共享池
* @type {{Shared: {}}} * @type {{Shared: {}}}
*/ */
;
(function () { (function () {
var _Shared = {}; var _Shared = {};
Data.SharingPool = { Data.SharingPool = {

41
dist/polyfill.js vendored

@ -8,7 +8,7 @@ if (!Array.prototype.indexOf) {
// 1. Let o be the result of calling ToObject passing // 1. Let o be the result of calling ToObject passing
// the this value as the argument. // the this value as the argument.
if (this == null) { if (this == null) {
throw new TypeError('"this" is null or not defined'); throw new TypeError("\"this\" is null or not defined");
} }
var o = Object(this); var o = Object(this);
@ -60,8 +60,8 @@ if (!Array.prototype.indexOf) {
}; };
} }
if (!Array.prototype.lastIndexOf) { if (!Array.prototype.lastIndexOf) {
Array.prototype.lastIndexOf = function (searchElement /*, fromIndex*/) { Array.prototype.lastIndexOf = function (searchElement /* , fromIndex*/) {
'use strict'; "use strict";
if (this === void 0 || this === null) { if (this === void 0 || this === null) {
throw new TypeError(); throw new TypeError();
@ -79,8 +79,7 @@ if (!Array.prototype.lastIndexOf) {
n = Number(arguments[1]); n = Number(arguments[1]);
if (n != n) { if (n != n) {
n = 0; n = 0;
} } else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) {
else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) {
n = (n > 0 || -1) * Math.floor(Math.abs(n)); n = (n > 0 || -1) * Math.floor(Math.abs(n));
} }
} }
@ -99,14 +98,14 @@ if (!Array.prototype.lastIndexOf) {
* 特殊情况 * 特殊情况
* Created by wang on 15/6/23. * Created by wang on 15/6/23.
*/ */
//解决console未定义问题 guy // 解决console未定义问题 guy
window.console = window.console || (function () { window.console = window.console || (function () {
var c = {}; var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () { = c.clear = c.exception = c.trace = c.assert = function () {
}; };
return c; return c;
})(); })();
/* /*
* 前端缓存 * 前端缓存
*/ */
@ -127,29 +126,29 @@ window.localStorage || (window.localStorage = {
clear: function () { clear: function () {
this.items = {}; this.items = {};
} }
});if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { });if (typeof Set !== "undefined" && Set.toString().match(/native code/)) {
} else { } else {
Set = function () { Set = function () {
this.set = {} this.set = {};
}; };
Set.prototype.has = function (key) { Set.prototype.has = function (key) {
return this.set[key] !== undefined; return this.set[key] !== undefined;
}; };
Set.prototype.add = function (key) { Set.prototype.add = function (key) {
this.set[key] = 1 this.set[key] = 1;
}; };
Set.prototype.clear = function () { Set.prototype.clear = function () {
this.set = {} this.set = {};
}; };
}//修复ie9下sort方法的bug }// 修复ie9下sort方法的bug
;!function (window) { !function (window) {
var ua = window.navigator.userAgent.toLowerCase(), var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/; reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) { if (reg.test(ua)) {
var _sort = Array.prototype.sort; var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) { Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') { if (!!fn && typeof fn === "function") {
if (this.length < 2) { if (this.length < 2) {
return this; return this;
} }
@ -157,8 +156,8 @@ window.localStorage || (window.localStorage = {
for (; i < l; i++) { for (; i < l; i++) {
for (j = i + 1; j < l; j++) { for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]); t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t : r = (typeof t === "number" ? t :
!!t ? 1 : 0) > 0; t ? 1 : 0) > 0;
if (r === true) { if (r === true) {
tmp = this[i]; tmp = this[i];
this[i] = this[j]; this[i] = this[j];
@ -167,9 +166,9 @@ window.localStorage || (window.localStorage = {
} }
} }
return this; return this;
} else {
return _sort.call(this);
} }
return _sort.call(this);
}; };
} }
}(window); }(window);

104
dist/router.js vendored

@ -1,10 +1,10 @@
;(function(){ (function () {
var Events = { var Events = {
// Bind an event to a `callback` function. Passing `"all"` will bind // Bind an event to a `callback` function. Passing `"all"` will bind
// the callback to all events fired. // the callback to all events fired.
on: function (name, callback, context) { on: function (name, callback, context) {
if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this; if (!eventsApi(this, "on", name, [callback, context]) || !callback) return this;
this._events || (this._events = {}); this._events || (this._events = {});
var events = this._events[name] || (this._events[name] = []); var events = this._events[name] || (this._events[name] = []);
events.push({callback: callback, context: context, ctx: context || this}); events.push({callback: callback, context: context, ctx: context || this});
@ -14,7 +14,7 @@
// Bind an event to only be triggered a single time. After the first time // Bind an event to only be triggered a single time. After the first time
// the callback is invoked, it will be removed. // the callback is invoked, it will be removed.
once: function (name, callback, context) { once: function (name, callback, context) {
if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this; if (!eventsApi(this, "once", name, [callback, context]) || !callback) return this;
var self = this; var self = this;
var once = _.once(function () { var once = _.once(function () {
self.off(name, once); self.off(name, once);
@ -29,7 +29,7 @@
// callbacks for the event. If `name` is null, removes all bound // callbacks for the event. If `name` is null, removes all bound
// callbacks for all events. // callbacks for all events.
off: function (name, callback, context) { off: function (name, callback, context) {
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this; if (!this._events || !eventsApi(this, "off", name, [callback, context])) return this;
// Remove all callbacks for all events. // Remove all callbacks for all events.
if (!name && !callback && !context) { if (!name && !callback && !context) {
@ -86,7 +86,7 @@
trigger: function (name) { trigger: function (name) {
if (!this._events) return this; if (!this._events) return this;
var args = slice.call(arguments, 1); var args = slice.call(arguments, 1);
if (!eventsApi(this, 'trigger', name, args)) return this; if (!eventsApi(this, "trigger", name, args)) return this;
var events = this._events[name]; var events = this._events[name];
var allEvents = this._events.all; var allEvents = this._events.all;
if (events) triggerEvents(events, args); if (events) triggerEvents(events, args);
@ -103,15 +103,15 @@
// listening to. // listening to.
listenTo: function (obj, name, callback) { listenTo: function (obj, name, callback) {
var listeningTo = this._listeningTo || (this._listeningTo = {}); var listeningTo = this._listeningTo || (this._listeningTo = {});
var id = obj._listenId || (obj._listenId = _.uniqueId('l')); var id = obj._listenId || (obj._listenId = _.uniqueId("l"));
listeningTo[id] = obj; listeningTo[id] = obj;
if (!callback && typeof name === 'object') callback = this; if (!callback && typeof name === "object") callback = this;
obj.on(name, callback, this); obj.on(name, callback, this);
return this; return this;
}, },
listenToOnce: function (obj, name, callback) { listenToOnce: function (obj, name, callback) {
if (typeof name === 'object') { if (typeof name === "object") {
for (var event in name) this.listenToOnce(obj, event, name[event]); for (var event in name) this.listenToOnce(obj, event, name[event]);
return this; return this;
} }
@ -137,7 +137,7 @@
var listeningTo = this._listeningTo; var listeningTo = this._listeningTo;
if (!listeningTo) return this; if (!listeningTo) return this;
var remove = !name && !callback; var remove = !name && !callback;
if (!callback && typeof name === 'object') callback = this; if (!callback && typeof name === "object") callback = this;
if (obj) (listeningTo = {})[obj._listenId] = obj; if (obj) (listeningTo = {})[obj._listenId] = obj;
for (var id in listeningTo) { for (var id in listeningTo) {
obj = listeningTo[id]; obj = listeningTo[id];
@ -159,7 +159,7 @@
if (!name) return true; if (!name) return true;
// Handle event maps. // Handle event maps.
if (typeof name === 'object') { if (typeof name === "object") {
for (var key in name) { for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest)); obj[action].apply(obj, [key, name[key]].concat(rest));
} }
@ -239,16 +239,16 @@
if (!_.isRegExp(route)) route = this._routeToRegExp(route); if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) { if (_.isFunction(name)) {
callback = name; callback = name;
name = ''; name = "";
} }
if (!callback) callback = this[name]; if (!callback) callback = this[name];
var router = this; var router = this;
BI.history.route(route, function (fragment) { BI.history.route(route, function (fragment) {
var args = router._extractParameters(route, fragment); var args = router._extractParameters(route, fragment);
if (router.execute(callback, args, name) !== false) { if (router.execute(callback, args, name) !== false) {
router.trigger.apply(router, ['route:' + name].concat(args)); router.trigger.apply(router, ["route:" + name].concat(args));
router.trigger('route', name, args); router.trigger("route", name, args);
BI.history.trigger('route', router, name, args); BI.history.trigger("route", router, name, args);
} }
}); });
return this; return this;
@ -271,7 +271,7 @@
// routes can be defined at the bottom of the route map. // routes can be defined at the bottom of the route map.
_bindRoutes: function () { _bindRoutes: function () {
if (!this.routes) return; if (!this.routes) return;
this.routes = _.result(this, 'routes'); this.routes = _.result(this, "routes");
var route, routes = _.keys(this.routes); var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) { while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]); this.route(route, this.routes[route]);
@ -281,13 +281,13 @@
// Convert a route string into a regular expression, suitable for matching // Convert a route string into a regular expression, suitable for matching
// against the current location hash. // against the current location hash.
_routeToRegExp: function (route) { _routeToRegExp: function (route) {
route = route.replace(escapeRegExp, '\\$&') route = route.replace(escapeRegExp, "\\$&")
.replace(optionalParam, '(?:$1)?') .replace(optionalParam, "(?:$1)?")
.replace(namedParam, function (match, optional) { .replace(namedParam, function (match, optional) {
return optional ? match : '([^/?]+)'; return optional ? match : "([^/?]+)";
}) })
.replace(splatParam, '([^?]*?)'); .replace(splatParam, "([^?]*?)");
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$'); return new RegExp("^" + route + "(?:\\?([\\s\\S]*))?$");
}, },
// Given a route, and a URL fragment that it matches, return the array of // Given a route, and a URL fragment that it matches, return the array of
@ -314,10 +314,10 @@
// falls back to polling. // falls back to polling.
var History = function () { var History = function () {
this.handlers = []; this.handlers = [];
_.bindAll(this, 'checkUrl'); _.bindAll(this, "checkUrl");
// Ensure that `History` can be used outside of the browser. // Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') { if (typeof window !== "undefined") {
this.location = window.location; this.location = window.location;
this.history = window.history; this.history = window.history;
} }
@ -344,22 +344,22 @@
// Are we at the app root? // Are we at the app root?
atRoot: function () { atRoot: function () {
var path = this.location.pathname.replace(/[^\/]$/, '$&/'); var path = this.location.pathname.replace(/[^\/]$/, "$&/");
return path === this.root && !this.getSearch(); return path === this.root && !this.getSearch();
}, },
// In IE6, the hash fragment and search params are incorrect if the // In IE6, the hash fragment and search params are incorrect if the
// fragment contains `?`. // fragment contains `?`.
getSearch: function () { getSearch: function () {
var match = this.location.href.replace(/#.*/, '').match(/\?.+/); var match = this.location.href.replace(/#.*/, "").match(/\?.+/);
return match ? match[0] : ''; return match ? match[0] : "";
}, },
// Gets the true hash value. Cannot use location.hash directly due to bug // Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded. // in Firefox where location.hash will always be decoded.
getHash: function (window) { getHash: function (window) {
var match = (window || this).location.href.match(/#(.*)$/); var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : ''; return match ? match[1] : "";
}, },
// Get the pathname and search params, without the root. // Get the pathname and search params, without the root.
@ -367,7 +367,7 @@
var path = decodeURI(this.location.pathname + this.getSearch()); var path = decodeURI(this.location.pathname + this.getSearch());
var root = this.root.slice(0, -1); var root = this.root.slice(0, -1);
if (!path.indexOf(root)) path = path.slice(root.length); if (!path.indexOf(root)) path = path.slice(root.length);
return path.charAt(0) === '/' ? path.slice(1) : path; return path.charAt(0) === "/" ? path.slice(1) : path;
}, },
// Get the cross-browser normalized URL fragment from the path or hash. // Get the cross-browser normalized URL fragment from the path or hash.
@ -379,27 +379,27 @@
fragment = this.getHash(); fragment = this.getHash();
} }
} }
return fragment.replace(routeStripper, ''); return fragment.replace(routeStripper, "");
}, },
// Start the hash change handling, returning `true` if the current URL matches // Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise. // an existing route, and `false` otherwise.
start: function (options) { start: function (options) {
if (History.started) throw new Error('BI.history has already been started'); if (History.started) throw new Error("BI.history has already been started");
History.started = true; History.started = true;
// Figure out the initial configuration. Do we need an iframe? // Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available? // Is pushState desired ... is it available?
this.options = _.extend({root: '/'}, this.options, options); this.options = _.extend({root: "/"}, this.options, options);
this.root = this.options.root; this.root = this.options.root;
this._wantsHashChange = this.options.hashChange !== false; this._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = 'onhashchange' in window; this._hasHashChange = "onhashchange" in window;
this._wantsPushState = !!this.options.pushState; this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState);
this.fragment = this.getFragment(); this.fragment = this.getFragment();
// Normalize root to always include a leading and trailing slash. // Normalize root to always include a leading and trailing slash.
this.root = ('/' + this.root + '/').replace(rootStripper, '/'); this.root = ("/" + this.root + "/").replace(rootStripper, "/");
// Transition from hashChange to pushState or vice versa if both are // Transition from hashChange to pushState or vice versa if both are
// requested. // requested.
@ -408,8 +408,8 @@
// If we've started off with a route from a `pushState`-enabled // If we've started off with a route from a `pushState`-enabled
// browser, but we're currently in a browser that doesn't support it... // browser, but we're currently in a browser that doesn't support it...
if (!this._hasPushState && !this.atRoot()) { if (!this._hasPushState && !this.atRoot()) {
var root = this.root.slice(0, -1) || '/'; var root = this.root.slice(0, -1) || "/";
this.location.replace(root + '#' + this.getPath()); this.location.replace(root + "#" + this.getPath());
// Return immediately as browser will do redirect to new url // Return immediately as browser will do redirect to new url
return true; return true;
@ -425,28 +425,28 @@
// support the `hashchange` event, HTML5 history, or the user wants // support the `hashchange` event, HTML5 history, or the user wants
// `hashChange` but not `pushState`. // `hashChange` but not `pushState`.
if (!this._hasHashChange && this._wantsHashChange && (!this._wantsPushState || !this._hasPushState)) { if (!this._hasHashChange && this._wantsHashChange && (!this._wantsPushState || !this._hasPushState)) {
var iframe = document.createElement('iframe'); var iframe = document.createElement("iframe");
iframe.src = 'javascript:0'; iframe.src = "javascript:0";
iframe.style.display = 'none'; iframe.style.display = "none";
iframe.tabIndex = -1; iframe.tabIndex = -1;
var body = document.body; var body = document.body;
// Using `appendChild` will throw on IE < 9 if the document is not ready. // Using `appendChild` will throw on IE < 9 if the document is not ready.
this.iframe = body.insertBefore(iframe, body.firstChild).contentWindow; this.iframe = body.insertBefore(iframe, body.firstChild).contentWindow;
this.iframe.document.open().close(); this.iframe.document.open().close();
this.iframe.location.hash = '#' + this.fragment; this.iframe.location.hash = "#" + this.fragment;
} }
// Add a cross-platform `addEventListener` shim for older browsers. // Add a cross-platform `addEventListener` shim for older browsers.
var addEventListener = window.addEventListener || function (eventName, listener) { var addEventListener = window.addEventListener || function (eventName, listener) {
return attachEvent('on' + eventName, listener); return attachEvent("on" + eventName, listener);
}; };
// Depending on whether we're using pushState or hashes, and whether // Depending on whether we're using pushState or hashes, and whether
// 'onhashchange' is supported, determine how we check the URL state. // 'onhashchange' is supported, determine how we check the URL state.
if (this._hasPushState) { if (this._hasPushState) {
addEventListener('popstate', this.checkUrl, false); addEventListener("popstate", this.checkUrl, false);
} else if (this._wantsHashChange && this._hasHashChange && !this.iframe) { } else if (this._wantsHashChange && this._hasHashChange && !this.iframe) {
addEventListener('hashchange', this.checkUrl, false); addEventListener("hashchange", this.checkUrl, false);
} else if (this._wantsHashChange) { } else if (this._wantsHashChange) {
this._checkUrlInterval = setInterval(this.checkUrl, this.interval); this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
} }
@ -459,14 +459,14 @@
stop: function () { stop: function () {
// Add a cross-platform `removeEventListener` shim for older browsers. // Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function (eventName, listener) { var removeEventListener = window.removeEventListener || function (eventName, listener) {
return detachEvent('on' + eventName, listener); return detachEvent("on" + eventName, listener);
}; };
// Remove window listeners. // Remove window listeners.
if (this._hasPushState) { if (this._hasPushState) {
removeEventListener('popstate', this.checkUrl, false); removeEventListener("popstate", this.checkUrl, false);
} else if (this._wantsHashChange && this._hasHashChange && !this.iframe) { } else if (this._wantsHashChange && this._hasHashChange && !this.iframe) {
removeEventListener('hashchange', this.checkUrl, false); removeEventListener("hashchange", this.checkUrl, false);
} }
// Clean up the iframe if necessary. // Clean up the iframe if necessary.
@ -527,24 +527,24 @@
if (!options || options === true) options = {trigger: !!options}; if (!options || options === true) options = {trigger: !!options};
// Normalize the fragment. // Normalize the fragment.
fragment = this.getFragment(fragment || ''); fragment = this.getFragment(fragment || "");
// Don't include a trailing slash on the root. // Don't include a trailing slash on the root.
var root = this.root; var root = this.root;
if (fragment === '' || fragment.charAt(0) === '?') { if (fragment === "" || fragment.charAt(0) === "?") {
root = root.slice(0, -1) || '/'; root = root.slice(0, -1) || "/";
} }
var url = root + fragment; var url = root + fragment;
// Strip the hash and decode for matching. // Strip the hash and decode for matching.
fragment = decodeURI(fragment.replace(pathStripper, '')); fragment = decodeURI(fragment.replace(pathStripper, ""));
if (this.fragment === fragment) return; if (this.fragment === fragment) return;
this.fragment = fragment; this.fragment = fragment;
// If pushState is available, we use it to set the fragment as a real URL. // If pushState is available, we use it to set the fragment as a real URL.
if (this._hasPushState) { if (this._hasPushState) {
this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url); this.history[options.replace ? "replaceState" : "pushState"]({}, document.title, url);
// If hash changes haven't been explicitly disabled, update the hash // If hash changes haven't been explicitly disabled, update the hash
// fragment to store history. // fragment to store history.
@ -570,11 +570,11 @@
// a new one to the browser history. // a new one to the browser history.
_updateHash: function (location, fragment, replace) { _updateHash: function (location, fragment, replace) {
if (replace) { if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, ''); var href = location.href.replace(/(javascript:|#).*$/, "");
location.replace(href + '#' + fragment); location.replace(href + "#" + fragment);
} else { } else {
// Some browsers require that `hash` contains a leading #. // Some browsers require that `hash` contains a leading #.
location.hash = '#' + fragment; location.hash = "#" + fragment;
} }
} }

2250
dist/widget.js vendored

File diff suppressed because it is too large Load Diff

12
src/addons/chart/chart.combine.js

@ -14,14 +14,14 @@ BI.CombineChart = BI.inherit(BI.Widget, {
types: [[], []], types: [[], []],
popupItemsGetter: BI.emptyFn, popupItemsGetter: BI.emptyFn,
formatConfig: BI.emptyFn formatConfig: BI.emptyFn
}) });
}, },
_init: function () { _init: function () {
BI.CombineChart.superclass._init.apply(this, arguments); BI.CombineChart.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
//图可配置属性 // 图可配置属性
this.CombineChart = BI.createWidget({ this.CombineChart = BI.createWidget({
type: "bi.chart", type: "bi.chart",
element: this.element element: this.element
@ -44,7 +44,7 @@ BI.CombineChart = BI.inherit(BI.Widget, {
if (BI.isArray(axisItems)) { if (BI.isArray(axisItems)) {
result = BI.concat(result, axisItems); result = BI.concat(result, axisItems);
} else { } else {
result.push(BI.extend(axisItems, {"yAxis": yAxisIndex})); result.push(BI.extend(axisItems, {yAxis: yAxisIndex}));
} }
}); });
if (BI.isNotEmptyArray(combineItems)) { if (BI.isNotEmptyArray(combineItems)) {
@ -93,7 +93,7 @@ BI.CombineChart = BI.inherit(BI.Widget, {
}, },
hgap: 10 hgap: 10
}, item) }, item)
} };
}) })
}) })
}, },
@ -118,7 +118,7 @@ BI.CombineChart = BI.inherit(BI.Widget, {
this.combo.showView(); this.combo.showView();
this._debounce2Destroy(); this._debounce2Destroy();
function destroyCombo() { function destroyCombo () {
if (self._doDestroy) { if (self._doDestroy) {
this.destroy(); this.destroy();
} }
@ -153,4 +153,4 @@ BI.CombineChart = BI.inherit(BI.Widget, {
}); });
BI.CombineChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.CombineChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.CombineChart.EVENT_ITEM_CLICK = "EVENT_ITEM_CLICK"; BI.CombineChart.EVENT_ITEM_CLICK = "EVENT_ITEM_CLICK";
BI.shortcut('bi.combine_chart', BI.CombineChart); BI.shortcut("bi.combine_chart", BI.CombineChart);

6
src/addons/chart/chart.js

@ -8,7 +8,7 @@ BI.Chart = BI.inherit(BI.Pane, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Chart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Chart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-chart" baseCls: "bi-chart"
}) });
}, },
_init: function () { _init: function () {
@ -35,7 +35,7 @@ BI.Chart = BI.inherit(BI.Pane, {
}, },
magnify: function () { magnify: function () {
this.vanCharts.refreshRestore() this.vanCharts.refreshRestore();
}, },
populate: function (items, options) { populate: function (items, options) {
@ -52,4 +52,4 @@ BI.Chart = BI.inherit(BI.Pane, {
} }
}); });
BI.Chart.EVENT_CHANGE = "EVENT_CHANGE"; BI.Chart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.chart', BI.Chart); BI.shortcut("bi.chart", BI.Chart);

50
src/addons/chart/chart/chart.abstract.js

@ -41,9 +41,9 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
LINE_WIDTH: 1, LINE_WIDTH: 1,
NUM_SEPARATORS: false, NUM_SEPARATORS: false,
FONT_STYLE: { FONT_STYLE: {
"fontFamily": "inherit", fontFamily: "inherit",
"color": "inherit", color: "inherit",
"fontSize": "12px" fontSize: "12px"
} }
}, },
@ -51,7 +51,7 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
return BI.extend(BI.AbstractChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AbstractChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-abstract-chart", baseCls: "bi-abstract-chart",
popupItemsGetter: BI.emptyFn popupItemsGetter: BI.emptyFn
}) });
}, },
_init: function () { _init: function () {
@ -101,12 +101,12 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
da.x = BI.contentFormat(BI.parseFloat(da.x.div(magnify).toFixed(4)), "#.####;-#.####"); da.x = BI.contentFormat(BI.parseFloat(da.x.div(magnify).toFixed(4)), "#.####;-#.####");
} }
}); });
}) });
}, },
formatXYDataWithMagnify: function (number, magnify) { formatXYDataWithMagnify: function (number, magnify) {
if (BI.isNull(number)) { if (BI.isNull(number)) {
return null return null;
} }
if (!BI.isNumber(number)) { if (!BI.isNumber(number)) {
number = BI.parseFloat(number); number = BI.parseFloat(number);
@ -173,46 +173,46 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
}, },
formatTickInXYaxis: function (type, number_level, separators, isCompareBar) { formatTickInXYaxis: function (type, number_level, separators, isCompareBar) {
var formatter = '#.##'; var formatter = "#.##";
switch (type) { switch (type) {
case this.constants.NORMAL: case this.constants.NORMAL:
formatter = '#.##'; formatter = "#.##";
if (separators) { if (separators) {
formatter = '#,###.##' formatter = "#,###.##";
} }
break; break;
case this.constants.ZERO2POINT: case this.constants.ZERO2POINT:
formatter = '#0'; formatter = "#0";
if (separators) { if (separators) {
formatter = '#,###'; formatter = "#,###";
} }
break; break;
case this.constants.ONE2POINT: case this.constants.ONE2POINT:
formatter = '#0.0'; formatter = "#0.0";
if (separators) { if (separators) {
formatter = '#,###.0'; formatter = "#,###.0";
} }
break; break;
case this.constants.TWO2POINT: case this.constants.TWO2POINT:
formatter = '#0.00'; formatter = "#0.00";
if (separators) { if (separators) {
formatter = '#,###.00'; formatter = "#,###.00";
} }
break; break;
} }
if (number_level === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) { if (number_level === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
formatter += '%'; formatter += "%";
} }
formatter += ";-" + formatter; formatter += ";-" + formatter;
if(isCompareBar) { if(isCompareBar) {
return function () { return function () {
arguments[0] = arguments[0] > 0 ? arguments[0] : (-1) * arguments[0]; arguments[0] = arguments[0] > 0 ? arguments[0] : (-1) * arguments[0];
return BI.contentFormat(arguments[0], formatter); return BI.contentFormat(arguments[0], formatter);
} };
} }
return function () { return function () {
return BI.contentFormat(arguments[0], formatter) return BI.contentFormat(arguments[0], formatter);
} };
}, },
formatDataLabel: function (state, items, config, style) { formatDataLabel: function (state, items, config, style) {
@ -220,8 +220,8 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
if (state === true) { if (state === true) {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
item.dataLabels = { item.dataLabels = {
"align": "outside", align: "outside",
"autoAdjust": true, autoAdjust: true,
style: style, style: style,
enabled: true, enabled: true,
formatter: { formatter: {
@ -238,13 +238,13 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
if (state === true) { if (state === true) {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
item.dataLabels = { item.dataLabels = {
"align": "outside", align: "outside",
"autoAdjust": true, autoAdjust: true,
style: style, style: style,
enabled: true, enabled: true,
formatter: { formatter: {
identifier: "${VALUE}", identifier: "${VALUE}",
valueFormat: format, valueFormat: format
} }
}; };
if(isPercentChart) { if(isPercentChart) {
@ -265,7 +265,7 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
BI.each(config.yAxis, function (idx, axis) { BI.each(config.yAxis, function (idx, axis) {
axis.labelStyle = fontStyle; axis.labelStyle = fontStyle;
axis.title.style = fontStyle; axis.title.style = fontStyle;
}) });
}, },
_formatItems: function (items) { _formatItems: function (items) {

32
src/addons/chart/chart/chart.accumulatearea.js

@ -8,7 +8,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AccumulateAreaChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AccumulateAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-area-chart" baseCls: "bi-accumulate-area-chart"
}) });
}, },
_init: function () { _init: function () {
@ -35,7 +35,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateAreaChart.EVENT_CHANGE, obj); self.fireEvent(BI.AccumulateAreaChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -102,20 +102,20 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "area"; config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle(v) { function formatChartStyle (v) {
switch (v) { switch (v) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -125,7 +125,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatChartLineStyle(v) { function formatChartLineStyle (v) {
switch (v) { switch (v) {
case BICst.CHART_SHAPE.RIGHT_ANGLE: case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false; config.plotOptions.curve = false;
@ -143,7 +143,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon(cordon) { function formatCordon (cordon) {
BI.each(cordon, function (idx, cor) { BI.each(cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -152,9 +152,9 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -177,14 +177,14 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
}, },
@ -274,4 +274,4 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.AccumulateAreaChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.AccumulateAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_area_chart', BI.AccumulateAreaChart); BI.shortcut("bi.accumulate_area_chart", BI.AccumulateAreaChart);

38
src/addons/chart/chart/chart.accumulateaxis.js

@ -8,7 +8,7 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AccumulateAxisChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AccumulateAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-axis-chart" baseCls: "bi-accumulate-axis-chart"
}) });
}, },
_init: function () { _init: function () {
@ -33,7 +33,7 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateAxisChart.EVENT_CHANGE, obj); self.fireEvent(BI.AccumulateAxisChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -93,20 +93,20 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
enableTick: self.config.enableTick, enableTick: self.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "column"; config.chartType = "column";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -115,9 +115,9 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -140,17 +140,17 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -160,7 +160,7 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
} }
} }
function getTitleText(numberLevelType, position, show, title) { function getTitleText (numberLevelType, position, show, title) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
@ -178,13 +178,13 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
unit = unit === "" ? unit : "(" + unit + ")"; unit = unit === "" ? unit : "(" + unit + ")";
@ -277,4 +277,4 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.AccumulateAxisChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.AccumulateAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_axis_chart', BI.AccumulateAxisChart); BI.shortcut("bi.accumulate_axis_chart", BI.AccumulateAxisChart);

42
src/addons/chart/chart/chart.accumulatebar.js

@ -8,7 +8,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AccumulateBarChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AccumulateBarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-bar-chart" baseCls: "bi-accumulate-bar-chart"
}) });
}, },
_init: function () { _init: function () {
@ -21,7 +21,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
}, },
labelStyle: this.constants.FONT_STYLE, labelStyle: this.constants.FONT_STYLE,
formatter: function () { formatter: function () {
return this > 0 ? this : (-1) * this return this > 0 ? this : (-1) * this;
}, },
gridLineWidth: 0 gridLineWidth: 0
}]; }];
@ -45,7 +45,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateBarChart.EVENT_CHANGE, obj); self.fireEvent(BI.AccumulateBarChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -67,7 +67,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
lineWidth: this.config.lineWidth, lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
maxWidth: '40%' maxWidth: "40%"
}); });
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel); self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
@ -82,17 +82,17 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
enableMinorTick: this.config.enableMinorTick enableMinorTick: this.config.enableMinorTick
}); });
config.chartType = "bar"; config.chartType = "bar";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.xAxis[0].formatter, this.config.chartFont); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.xAxis[0].formatter, this.config.chartFont);
config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter; config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter;
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -102,7 +102,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel); var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
@ -111,9 +111,9 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -136,17 +136,17 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -163,13 +163,13 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -184,7 +184,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
var tmp = t.x; var tmp = t.x;
t.x = t.y; t.x = t.y;
t.y = tmp; t.y = tmp;
}) });
}); });
}); });
return items; return items;
@ -243,4 +243,4 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.AccumulateBarChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.AccumulateBarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_bar_chart', BI.AccumulateBarChart); BI.shortcut("bi.accumulate_bar_chart", BI.AccumulateBarChart);

28
src/addons/chart/chart/chart.accumulateradar.js

@ -8,7 +8,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AccumulateRadarChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AccumulateRadarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-radar-chart" baseCls: "bi-accumulate-radar-chart"
}) });
}, },
_init: function () { _init: function () {
@ -21,7 +21,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
}, },
labelStyle: this.constants.FONT_STYLE, labelStyle: this.constants.FONT_STYLE,
formatter: function () { formatter: function () {
return this > 0 ? this : (-1) * this return this > 0 ? this : (-1) * this;
}, },
gridLineWidth: 0, gridLineWidth: 0,
position: "bottom" position: "bottom"
@ -45,7 +45,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateRadarChart.EVENT_CHANGE, obj); self.fireEvent(BI.AccumulateRadarChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -81,17 +81,17 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
config.plotOptions.columnType = true; config.plotOptions.columnType = true;
delete config.xAxis; delete config.xAxis;
delete config.yAxis; delete config.yAxis;
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.radiusAxis[0].formatter, this.config.chartFont); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.radiusAxis[0].formatter, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
config.radiusAxis[0].labelStyle = config.radiusAxis[0].title.style = this.config.chartFont; config.radiusAxis[0].labelStyle = config.radiusAxis[0].title.style = this.config.chartFont;
config.angleAxis[0].labelStyle = config.angleAxis[0].title.style = this.config.chartFont; config.angleAxis[0].labelStyle = config.angleAxis[0].title.style = this.config.chartFont;
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -101,7 +101,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatChartRadarStyle() { function formatChartRadarStyle () {
switch (self.config.chartRadarType) { switch (self.config.chartRadarType) {
case BICst.CHART_SHAPE.POLYGON: case BICst.CHART_SHAPE.POLYGON:
config.plotOptions.shape = "polygon"; config.plotOptions.shape = "polygon";
@ -112,19 +112,19 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatNumberLevelInYaxis(type, position, formatter) { function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
} }
}) });
}); });
config.plotOptions.tooltip.formatter.valueFormat = formatter; config.plotOptions.tooltip.formatter.valueFormat = formatter;
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -141,13 +141,13 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -191,4 +191,4 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.AccumulateRadarChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.AccumulateRadarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_radar_chart', BI.AccumulateRadarChart); BI.shortcut("bi.accumulate_radar_chart", BI.AccumulateRadarChart);

40
src/addons/chart/chart/chart.area.js

@ -8,7 +8,7 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AreaChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-area-chart" baseCls: "bi-area-chart"
}) });
}, },
_init: function () { _init: function () {
@ -34,7 +34,7 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AreaChart.EVENT_CHANGE, obj); self.fireEvent(BI.AreaChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -99,20 +99,20 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "area"; config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -122,7 +122,7 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -131,9 +131,9 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -156,17 +156,17 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatChartLineStyle() { function formatChartLineStyle () {
switch (self.config.chartLineType) { switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE: case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false; config.plotOptions.curve = false;
@ -184,7 +184,7 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -201,13 +201,13 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -299,4 +299,4 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.AreaChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.AreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.area_chart', BI.AreaChart); BI.shortcut("bi.area_chart", BI.AreaChart);

38
src/addons/chart/chart/chart.axis.js

@ -11,7 +11,7 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.AxisChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.AxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-axis-chart" baseCls: "bi-axis-chart"
}) });
}, },
_init: function () { _init: function () {
@ -37,7 +37,7 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AxisChart.EVENT_CHANGE, obj); self.fireEvent(BI.AxisChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -102,7 +102,7 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick, enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
var lineItem = []; var lineItem = [];
@ -115,15 +115,15 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
} }
}); });
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [BI.concat(otherItem, lineItem), config]; return [BI.concat(otherItem, lineItem), config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -133,7 +133,7 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -142,9 +142,9 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -164,17 +164,17 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -191,13 +191,13 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -273,4 +273,4 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.AxisChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.AxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.axis_chart', BI.AxisChart); BI.shortcut("bi.axis_chart", BI.AxisChart);

42
src/addons/chart/chart/chart.bar.js

@ -8,7 +8,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BarChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bar-chart" baseCls: "bi-bar-chart"
}) });
}, },
_init: function () { _init: function () {
@ -21,7 +21,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
}, },
labelStyle: this.constants.FONT_STYLE, labelStyle: this.constants.FONT_STYLE,
formatter: function () { formatter: function () {
return this > 0 ? this : (-1) * this return this > 0 ? this : (-1) * this;
}, },
gridLineWidth: 0 gridLineWidth: 0
}]; }];
@ -48,7 +48,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.BarChart.EVENT_CHANGE, obj); self.fireEvent(BI.BarChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -60,7 +60,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
this.formatChartLegend(config, this.config.chartLegend); this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel; config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
//分类轴 // 分类轴
config.yAxis = this.yAxis; config.yAxis = this.yAxis;
config.yAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : ""; config.yAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
config.yAxis[0].title.rotation = this.constants.ROTATION; config.yAxis[0].title.rotation = this.constants.ROTATION;
@ -69,10 +69,10 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
lineWidth: this.config.lineWidth, lineWidth: this.config.lineWidth,
maxWidth: '40%' maxWidth: "40%"
}); });
//值轴 // 值轴
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel); self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
config.xAxis[0].title.text = getXAxisTitle(this.config.leftYAxisNumberLevel, this.constants.X_AXIS); config.xAxis[0].title.text = getXAxisTitle(this.config.leftYAxisNumberLevel, this.constants.X_AXIS);
config.xAxis[0].title.align = "center"; config.xAxis[0].title.align = "center";
@ -90,12 +90,12 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter; config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter;
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -105,7 +105,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel); var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
@ -114,9 +114,9 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -136,17 +136,17 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function getXAxisTitle(numberLevelType, position) { function getXAxisTitle (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -163,10 +163,10 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
unit = unit === "" ? unit : "(" + unit + ")"; unit = unit === "" ? unit : "(" + unit + ")";
@ -181,7 +181,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
var tmp = t.x; var tmp = t.x;
t.x = t.y; t.x = t.y;
t.y = tmp; t.y = tmp;
}) });
}); });
}); });
return items; return items;
@ -238,4 +238,4 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.BarChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.BarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.bar_chart', BI.BarChart); BI.shortcut("bi.bar_chart", BI.BarChart);

81
src/addons/chart/chart/chart.bubble.js

@ -8,7 +8,7 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.BubbleChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.BubbleChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bubble-chart" baseCls: "bi-bubble-chart"
}) });
}, },
_init: function () { _init: function () {
@ -43,7 +43,7 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.BubbleChart.EVENT_CHANGE, obj); self.fireEvent(BI.BubbleChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -66,7 +66,7 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
config.yAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0; config.yAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.yAxis[0].lineWidth = 1; config.yAxis[0].lineWidth = 1;
config.yAxis[0].title.rotation = this.constants.ROTATION; config.yAxis[0].title.rotation = this.constants.ROTATION;
config.yAxis[0].maxWidth = '40%'; config.yAxis[0].maxWidth = "40%";
config.xAxis[0].formatter = self.formatTickInXYaxis(this.config.xAxisStyle, this.config.xAxisNumberLevel, this.config.rightNumSeparators); config.xAxis[0].formatter = self.formatTickInXYaxis(this.config.xAxisStyle, this.config.xAxisNumberLevel, this.config.rightNumSeparators);
self.formatNumberLevelInXaxis(items, this.config.xAxisNumberLevel); self.formatNumberLevelInXaxis(items, this.config.xAxisNumberLevel);
@ -74,41 +74,42 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle + config.xAxis[0].title.text : config.xAxis[0].title.text; config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle + config.xAxis[0].title.text : config.xAxis[0].title.text;
config.xAxis[0].title.align = "center"; config.xAxis[0].title.align = "center";
config.xAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0; config.xAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.xAxis[0].maxHeith = '40%'; config.xAxis[0].maxHeith = "40%";
config.chartType = "bubble"; config.chartType = "bubble";
if (BI.isNotEmptyArray(this.config.tooltip)) { if (BI.isNotEmptyArray(this.config.tooltip)) {
config.plotOptions.bubble.tooltip = { config.plotOptions.bubble.tooltip = {
useHtml: true, useHtml: true,
style: { style: {
color: 'RGB(184, 184, 184)' color: "RGB(184, 184, 184)"
}, },
formatter: function () { formatter: function () {
var y = self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)(this.y); var y = self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)(this.y);
var x = self.formatTickInXYaxis(self.config.xAxisStyle, self.config.xAxisNumberLevel, self.config.rightNumSeparators)(this.x); var x = self.formatTickInXYaxis(self.config.xAxisStyle, self.config.xAxisNumberLevel, self.config.rightNumSeparators)(this.x);
return this.seriesName + '<div>(X)' + self.config.tooltip[0] + ':' + x + '</div><div>(Y)' + self.config.tooltip[1] return this.seriesName + "<div>(X)" + self.config.tooltip[0] + ":" + x + "</div><div>(Y)" + self.config.tooltip[1]
+ ':' + y + '</div><div>(' + BI.i18nText("BI-Size") + ')' + self.config.tooltip[2] + ':' + this.size + '</div>'} + ":" + y + "</div><div>(" + BI.i18nText("BI-Size") + ")" + self.config.tooltip[2] + ":" + this.size + "</div>";
}
}; };
} }
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
if (config.plotOptions.dataLabels.enabled === true) { if (config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
item.dataLabels = { item.dataLabels = {
"style" : self.config.chartFont, style: self.config.chartFont,
"align": "outside", align: "outside",
"autoAdjust": true, autoAdjust: true,
enabled: true, enabled: true,
formatter: { formatter: {
identifier: "${X}${Y}${SIZE}", identifier: "${X}${Y}${SIZE}",
"XFormat": function () { XFormat: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##') return BI.contentFormat(arguments[0], "#.##;-#.##");
}, },
"YFormat": function () { YFormat: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##') return BI.contentFormat(arguments[0], "#.##;-#.##");
}, },
"sizeFormat": function () { sizeFormat: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##') return BI.contentFormat(arguments[0], "#.##;-#.##");
} }
} }
}; };
@ -117,14 +118,14 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
}); });
} }
//全局样式图表文字 // 全局样式图表文字
config.yAxis[0].title.style = config.yAxis[0].labelStyle = this.config.chartFont; config.yAxis[0].title.style = config.yAxis[0].labelStyle = this.config.chartFont;
config.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont; config.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont;
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -134,7 +135,7 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -143,9 +144,9 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -168,31 +169,31 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatNumberLevelInYaxis(type, position) { function formatNumberLevelInYaxis (type, position) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
} }
}) });
}); });
if (type === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) { if (type === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
//config.plotOptions.tooltip.formatter.valueFormat = "function(){return window.FR ? FR.contentFormat(arguments[0], '#0%') : arguments[0]}"; // config.plotOptions.tooltip.formatter.valueFormat = "function(){return window.FR ? FR.contentFormat(arguments[0], '#0%') : arguments[0]}";
} }
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -209,13 +210,13 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -226,9 +227,9 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
BI.each(item, function (id, it) { BI.each(item, function (id, it) {
BI.each(it.data, function (i, da) { BI.each(it.data, function (i, da) {
var data = da.size; var data = da.size;
da.size = BI.contentFormat(data, '#.##;-#.##') da.size = BI.contentFormat(data, "#.##;-#.##");
}) });
}) });
}); });
return items; return items;
}, },
@ -279,4 +280,4 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.BubbleChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.BubbleChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.bubble_chart', BI.BubbleChart); BI.shortcut("bi.bubble_chart", BI.BubbleChart);

48
src/addons/chart/chart/chart.comparearea.js

@ -8,7 +8,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.CompareAreaChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.CompareAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-compare-area-chart" baseCls: "bi-compare-area-chart"
}) });
}, },
_init: function () { _init: function () {
@ -34,7 +34,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.CompareAreaChart.EVENT_CHANGE, obj); self.fireEvent(BI.CompareAreaChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -103,20 +103,20 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "area"; config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function _calculateValueNiceDomain(minValue, maxValue) { function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue); minValue = Math.min(0, minValue);
@ -125,7 +125,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
return _linearNiceDomain(minValue, maxValue, tickInterval); return _linearNiceDomain(minValue, maxValue, tickInterval);
} }
function _linearTickInterval(minValue, maxValue, m) { function _linearTickInterval (minValue, maxValue, m) {
m = m || 5; m = m || 5;
var span = maxValue - minValue; var span = maxValue - minValue;
@ -137,7 +137,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
return step; return step;
} }
function _linearNiceDomain(minValue, maxValue, tickInterval) { function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval); minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
@ -146,7 +146,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
return [minValue, maxValue]; return [minValue, maxValue];
} }
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -156,7 +156,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -165,9 +165,9 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -190,17 +190,17 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatChartLineStyle() { function formatChartLineStyle () {
switch (self.config.chartLineType) { switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE: case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.area = { config.plotOptions.area = {
@ -224,7 +224,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatNumberLevelInYaxis(type, position, formatter) { function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
var max = null; var max = null;
@ -246,7 +246,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
}); });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -263,13 +263,13 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -370,4 +370,4 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.CompareAreaChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.CompareAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.compare_area_chart', BI.CompareAreaChart); BI.shortcut("bi.compare_area_chart", BI.CompareAreaChart);

100
src/addons/chart/chart/chart.compareaxis.js

@ -8,7 +8,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.CompareAxisChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.CompareAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-compare-axis-chart" baseCls: "bi-compare-axis-chart"
}) });
}, },
_init: function () { _init: function () {
@ -43,11 +43,11 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.CompareAxisChart.EVENT_CHANGE, obj); self.fireEvent(BI.CompareAxisChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
_formatConfig: function(config, items){ _formatConfig: function (config, items) {
var self = this, o = this.options; var self = this, o = this.options;
config.colors = this.config.chartColor; config.colors = this.config.chartColor;
config.style = formatChartStyle(); config.style = formatChartStyle();
@ -58,15 +58,15 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
config.dataSheet.enabled = this.config.showDataTable; config.dataSheet.enabled = this.config.showDataTable;
config.xAxis[0].showLabel = !config.dataSheet.enabled; config.xAxis[0].showLabel = !config.dataSheet.enabled;
config.zoom.zoomTool.enabled = this.config.showZoom; config.zoom.zoomTool.enabled = this.config.showZoom;
if(this.config.showZoom === true){ if(this.config.showZoom === true) {
delete config.dataSheet; delete config.dataSheet;
delete config.zoom.zoomType; delete config.zoom.zoomType;
} }
config.yAxis = this.yAxis; config.yAxis = this.yAxis;
BI.each(config.yAxis, function(idx, axis){ BI.each(config.yAxis, function (idx, axis) {
var unit = ''; var unit = "";
switch (axis.axisIndex){ switch (axis.axisIndex) {
case self.constants.LEFT_AXIS: case self.constants.LEFT_AXIS:
unit = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS); unit = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.rotation = self.constants.ROTATION; axis.title.rotation = self.constants.ROTATION;
@ -112,7 +112,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick, enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
BI.extend(config.xAxis[1], { BI.extend(config.xAxis[1], {
@ -121,15 +121,15 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
enableMinorTick: this.config.enableMinorTick enableMinorTick: this.config.enableMinorTick
}); });
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle(){ function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -139,23 +139,23 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon(){ function formatCordon () {
BI.each(self.config.cordon, function(idx, cor){ BI.each(self.config.cordon, function (idx, cor) {
if(idx === 0 && self.xAxis.length > 0){ if(idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel); var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
self.xAxis[0].plotLines = BI.map(cor, function(i, t){ self.xAxis[0].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, { return BI.extend(t, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
} }
if(idx > 0 && self.yAxis.length >= idx){ if(idx > 0 && self.yAxis.length >= idx) {
var magnify = 1; var magnify = 1;
switch (idx - 1) { switch (idx - 1) {
case self.constants.LEFT_AXIS: case self.constants.LEFT_AXIS:
@ -168,22 +168,22 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel); magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break; break;
} }
self.yAxis[idx - 1].plotLines = BI.map(cor, function(i, t){ self.yAxis[idx - 1].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, { return BI.extend(t, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatChartLineStyle(){ function formatChartLineStyle () {
switch (self.config.chartLineType) { switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE: case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false; config.plotOptions.curve = false;
@ -201,29 +201,29 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatNumberLevelInYaxis(type, position, formatter){ function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
var max = null; var max = null;
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
if((BI.isNull(max) || BI.parseFloat(da.y) > BI.parseFloat(max))){ if((BI.isNull(max) || BI.parseFloat(da.y) > BI.parseFloat(max))) {
max = da.y; max = da.y;
} }
} }
}); });
if(position === item.yAxis){ if(position === item.yAxis) {
item.tooltip = BI.deepClone(config.plotOptions.tooltip); item.tooltip = BI.deepClone(config.plotOptions.tooltip);
item.tooltip.formatter.valueFormat = formatter; item.tooltip.formatter.valueFormat = formatter;
} }
if(BI.isNotNull(max)){ if(BI.isNotNull(max)) {
self.maxes.push(max); self.maxes.push(max);
} }
}); });
} }
function getXYAxisUnit(numberLevelType, position){ function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -239,19 +239,19 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
unit = BI.i18nText("BI-Yi"); unit = BI.i18nText("BI-Yi");
break; break;
} }
if(position === self.constants.X_AXIS){ if(position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if(position === self.constants.LEFT_AXIS){ if(position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if(position === self.constants.RIGHT_AXIS){ if(position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
function _calculateValueNiceDomain(minValue, maxValue){ function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue); minValue = Math.min(0, minValue);
@ -260,7 +260,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
return _linearNiceDomain(minValue, maxValue, tickInterval); return _linearNiceDomain(minValue, maxValue, tickInterval);
} }
function _linearTickInterval(minValue, maxValue, m){ function _linearTickInterval (minValue, maxValue, m) {
m = m || 5; m = m || 5;
var span = maxValue - minValue; var span = maxValue - minValue;
@ -272,7 +272,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
return step; return step;
} }
function _linearNiceDomain(minValue, maxValue, tickInterval){ function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval); minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
@ -282,12 +282,12 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
} }
}, },
_formatItems: function(items){ _formatItems: function (items) {
var self = this; var self = this;
this.maxes = []; this.maxes = [];
BI.each(items, function(idx, item){ BI.each(items, function (idx, item) {
BI.each(item, function(id, it){ BI.each(item, function (id, it) {
if(idx > 0){ if(idx > 0) {
BI.extend(it, {reversed: true, xAxis: 1}); BI.extend(it, {reversed: true, xAxis: 1});
}else{ }else{
BI.extend(it, {reversed: false, xAxis: 0}); BI.extend(it, {reversed: false, xAxis: 0});
@ -314,7 +314,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
leftYAxisReversed: options.leftYAxisReversed || false, leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false, rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL, leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL, rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "", xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "", leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "", rightYAxisUnit: options.rightYAxisUnit || "",
@ -339,16 +339,16 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
this.yAxis = []; this.yAxis = [];
var types = []; var types = [];
BI.each(items, function(idx, axisItems){ BI.each(items, function (idx, axisItems) {
var type = []; var type = [];
BI.each(axisItems, function(id, item){ BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AXIS); type.push(BICst.WIDGET.AXIS);
}); });
types.push(type); types.push(type);
}); });
BI.each(types, function(idx, type){ BI.each(types, function (idx, type) {
if(BI.isEmptyArray(type)){ if(BI.isEmptyArray(type)) {
return; return;
} }
var newYAxis = { var newYAxis = {
@ -373,9 +373,9 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize(); this.combineChart.resize();
}, },
magnify: function(){ magnify: function () {
this.combineChart.magnify(); this.combineChart.magnify();
} }
}); });
BI.CompareAxisChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.CompareAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.compare_axis_chart', BI.CompareAxisChart); BI.shortcut("bi.compare_axis_chart", BI.CompareAxisChart);

40
src/addons/chart/chart/chart.comparebar.js

@ -8,7 +8,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.CompareBarChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.CompareBarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-compare-bar-chart" baseCls: "bi-compare-bar-chart"
}) });
}, },
_init: function () { _init: function () {
@ -45,7 +45,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.CompareBarChart.EVENT_CHANGE, obj); self.fireEvent(BI.CompareBarChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -67,7 +67,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
lineWidth: this.config.lineWidth, lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
maxWidth: '40%' maxWidth: "40%"
}); });
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel); self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
@ -83,17 +83,17 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
}); });
config.chartType = "bar"; config.chartType = "bar";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.xAxis[0].formatter, this.config.chartFont); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.xAxis[0].formatter, this.config.chartFont);
config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter; config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter;
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -103,7 +103,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel); var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
@ -112,9 +112,9 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -137,17 +137,17 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -164,13 +164,13 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -190,7 +190,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
} }
}); });
it.stack = i; it.stack = i;
}) });
}); });
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
result = BI.concat(result, item); result = BI.concat(result, item);
@ -250,4 +250,4 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.CompareBarChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.CompareBarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.compare_bar_chart', BI.CompareBarChart); BI.shortcut("bi.compare_bar_chart", BI.CompareBarChart);

148
src/addons/chart/chart/chart.dashboard.js

@ -9,18 +9,18 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DashboardChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DashboardChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-dashboard-chart" baseCls: "bi-dashboard-chart"
}) });
}, },
_init: function () { _init: function () {
BI.DashboardChart.superclass._init.apply(this, arguments); BI.DashboardChart.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.gaugeAxis = [{ this.gaugeAxis = [{
"minorTickColor": "rgb(226,226,226)", minorTickColor: "rgb(226,226,226)",
"tickColor": "rgb(186,186,186)", tickColor: "rgb(186,186,186)",
labelStyle: this.constants.FONT_STYLE, labelStyle: this.constants.FONT_STYLE,
"step": 0, step: 0,
"showLabel": true showLabel: true
}]; }];
this.combineChart = BI.createWidget({ this.combineChart = BI.createWidget({
type: "bi.combine_chart", type: "bi.combine_chart",
@ -32,7 +32,7 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.DashboardChart.EVENT_CHANGE, obj); self.fireEvent(BI.DashboardChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -48,13 +48,13 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
if (isDashboard && !isMultiPointers) { if (isDashboard && !isMultiPointers) {
config.plotOptions.seriesLabel.enabled = false; config.plotOptions.seriesLabel.enabled = false;
if(BI.isNull(items[0].data[0].z)) { if(BI.isNull(items[0].data[0].z)) {
config.plotOptions.tooltip.formatter.identifier = "${SERIES}${X}${Y}${SIZE}${VALUE}" config.plotOptions.tooltip.formatter.identifier = "${SERIES}${X}${Y}${SIZE}${VALUE}";
} }
} }
config.gaugeAxis[0].labelStyle = this.config.chartFont; config.gaugeAxis[0].labelStyle = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartDashboardStyle() { function formatChartDashboardStyle () {
var bands = getBandsStyles(self.config.bandsStyles, self.config.autoCustomStyle); var bands = getBandsStyles(self.config.bandsStyles, self.config.autoCustomStyle);
var percentageLabel = BI.extend(config.plotOptions.percentageLabel, { var percentageLabel = BI.extend(config.plotOptions.percentageLabel, {
enabled: self.config.showPercentage === BICst.PERCENTAGE.SHOW enabled: self.config.showPercentage === BICst.PERCENTAGE.SHOW
@ -66,29 +66,29 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
formatter: function () { formatter: function () {
var value = this.value; var value = this.value;
if (self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT && self.config.numSeparators) { if (self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT && self.config.numSeparators) {
value = BI.contentFormat(this.value, "#,##0%;-#,##0%") value = BI.contentFormat(this.value, "#,##0%;-#,##0%");
} else if (self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT && !self.config.numSeparators) { } else if (self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT && !self.config.numSeparators) {
value = BI.contentFormat(this.value, "#0.00%"); value = BI.contentFormat(this.value, "#0.00%");
} else if (!(self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) && self.config.numSeparators) { } else if (!(self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) && self.config.numSeparators) {
value = BI.contentFormat(this.value, "#,###.##;-#,###.##") value = BI.contentFormat(this.value, "#,###.##;-#,###.##");
} else { } else {
value = BI.contentFormat(this.value, "#.##;-#.##"); value = BI.contentFormat(this.value, "#.##;-#.##");
} }
var label = '<div style="text-align: center">' + this.seriesName + '</div>' + '<div style="text-align: center">' + value + var label = "<div style=\"text-align: center\">" + this.seriesName + "</div>" + "<div style=\"text-align: center\">" + value +
getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + '</div>'; getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + "</div>";
if (isDashboard && items[0].data.length > 1) { if (isDashboard && items[0].data.length > 1) {
if (isMultiPointers) { if (isMultiPointers) {
return '<div style="text-align: center">' + this.seriesName + ':' + value + return "<div style=\"text-align: center\">" + this.seriesName + ":" + value +
getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + '</div>'; getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + "</div>";
} }
return label return label;
} else if (isDashboard && BI.isNull(items[0].data[0].z)) { } else if (isDashboard && BI.isNull(items[0].data[0].z)) {
return label return label;
} }
return '<div style="text-align: center">' + this.category + '</div>' + label; return "<div style=\"text-align: center\">" + this.category + "</div>" + label;
}, },
style: self.config.chartFont, style: self.config.chartFont,
useHtml: true useHtml: true
@ -132,9 +132,9 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
config.gaugeAxis[0].formatter = function () { config.gaugeAxis[0].formatter = function () {
var scaleValue = this; var scaleValue = this;
if (self.config.numSeparators) { if (self.config.numSeparators) {
scaleValue = BI.contentFormat(scaleValue, '#,##0%;-#,##0%') scaleValue = BI.contentFormat(scaleValue, "#,##0%;-#,##0%");
} else { } else {
scaleValue = BI.contentFormat(scaleValue, '#0.00%') scaleValue = BI.contentFormat(scaleValue, "#0.00%");
} }
return scaleValue + getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS); return scaleValue + getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS);
}; };
@ -142,14 +142,14 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
config.gaugeAxis[0].formatter = function () { config.gaugeAxis[0].formatter = function () {
var value = this; var value = this;
if (self.config.numSeparators) { if (self.config.numSeparators) {
value = BI.contentFormat(value, "#,###;-#,###") value = BI.contentFormat(value, "#,###;-#,###");
} }
return value + getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS); return value + getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS);
}; };
} }
} }
function setPlotOptions(style, bands, slotValueLAbel, percentageLabel, thermometerLayout, layout) { function setPlotOptions (style, bands, slotValueLAbel, percentageLabel, thermometerLayout, layout) {
config.style = style; config.style = style;
config.plotOptions.bands = bands; config.plotOptions.bands = bands;
config.plotOptions.valueLabel = slotValueLAbel; config.plotOptions.valueLabel = slotValueLAbel;
@ -158,44 +158,44 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
config.plotOptions.layout = layout; config.plotOptions.layout = layout;
} }
function changeMaxMinScale() { function changeMaxMinScale () {
self.gaugeAxis[0].min = BI.parseFloat(self.config.minScale) || null; self.gaugeAxis[0].min = BI.parseFloat(self.config.minScale) || null;
self.gaugeAxis[0].max = BI.parseFloat(self.config.maxScale) || null; self.gaugeAxis[0].max = BI.parseFloat(self.config.maxScale) || null;
} }
function formatNumberLevelInYaxis(type, position) { function formatNumberLevelInYaxis (type, position) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
} }
}) });
}); });
config.plotOptions.tooltip.formatter.valueFormat = function () { config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(this, '#.##;-#.##') + getXYAxisUnit(type, position) return BI.contentFormat(this, "#.##;-#.##") + getXYAxisUnit(type, position);
}; };
if (self.config.numSeparators) { if (self.config.numSeparators) {
config.plotOptions.tooltip.formatter.valueFormat = function () { config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], '#,###.##;-#,###.##') return BI.contentFormat(arguments[0], "#,###.##;-#,###.##");
}; };
} }
if (type === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) { if (type === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
config.plotOptions.tooltip.formatter.valueFormat = function () { config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], '#0.00%') return BI.contentFormat(arguments[0], "#0.00%");
}; };
if (self.config.numSeparators) { if (self.config.numSeparators) {
config.plotOptions.tooltip.formatter.valueFormat = function () { config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], '#,##0%;-#,##0%') return BI.contentFormat(arguments[0], "#,##0%;-#,##0%");
}; };
} }
} }
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -212,18 +212,18 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.DASHBOARD_AXIS) { if (position === self.constants.DASHBOARD_AXIS) {
self.config.dashboardUnit !== "" && (unit = unit + self.config.dashboardUnit) self.config.dashboardUnit !== "" && (unit = unit + self.config.dashboardUnit);
} }
return unit; return unit;
} }
function getBandsStyles(styles, change) { function getBandsStyles (styles, change) {
var min = 0, bands = [], color = null, max = null, conditionMax = null; var min = 0, bands = [], color = null, max = null, conditionMax = null;
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
var data = item.data[0]; var data = item.data[0];
if ((BI.isNull(max) || data.y > max)) { if ((BI.isNull(max) || data.y > max)) {
max = data.y max = data.y;
} }
}); });
@ -233,52 +233,52 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
break; break;
case BICst.SCALE_SETTING.CUSTOM: case BICst.SCALE_SETTING.CUSTOM:
if (styles.length === 0) { if (styles.length === 0) {
return bands return bands;
} else { }
var maxScale = _calculateValueNiceDomain(0, max)[1]; var maxScale = _calculateValueNiceDomain(0, max)[1];
BI.each(styles, function (idx, style) { BI.each(styles, function (idx, style) {
if(BI.parseFloat(style.range.min) > BI.parseFloat(style.range.max)) { if(BI.parseFloat(style.range.min) > BI.parseFloat(style.range.max)) {
return bands.push({ return bands.push({
color: color, color: color,
from: conditionMax, from: conditionMax,
to: maxScale to: maxScale
});
}
bands.push({
color: style.color,
from: style.range.min,
to: style.range.max
}); });
color = style.color; }
conditionMax = style.range.max
});
min = BI.parseInt(styles[0].range.min);
bands.push({ bands.push({
color: "#808080", color: style.color,
from: 0, from: style.range.min,
to: min to: style.range.max
}); });
color = style.color;
conditionMax = style.range.max;
});
min = BI.parseInt(styles[0].range.min);
bands.push({
color: "#808080",
from: 0,
to: min
});
bands.push({ bands.push({
color: color, color: color,
from: conditionMax, from: conditionMax,
to: maxScale to: maxScale
}); });
return bands; return bands;
}
} }
} }
function _calculateValueNiceDomain(minValue, maxValue) { function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue); minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue); var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval); return _linearNiceDomain(minValue, maxValue, tickInterval);
} }
function _linearTickInterval(minValue, maxValue, m) { function _linearTickInterval (minValue, maxValue, m) {
m = m || 5; m = m || 5;
var span = maxValue - minValue; var span = maxValue - minValue;
var step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)); var step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10));
@ -288,7 +288,7 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
return step; return step;
} }
function _linearNiceDomain(minValue, maxValue, tickInterval) { function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval); minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval); maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
@ -303,14 +303,14 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
var c = this.constants; var c = this.constants;
if (this.config.chartDashboardType === c.NORMAL || this.config.chartDashboardType === c.HALF_DASHBOARD) { if (this.config.chartDashboardType === c.NORMAL || this.config.chartDashboardType === c.HALF_DASHBOARD) {
var result = []; var result = [];
if (this.config.numberOfPointer === c.ONE_POINTER && items[0].length === 1) {//单个系列 if (this.config.numberOfPointer === c.ONE_POINTER && items[0].length === 1) {// 单个系列
BI.each(items[0][0].data, function (idx, da) { BI.each(items[0][0].data, function (idx, da) {
result.push({ result.push({
data: [BI.extend({}, da, { data: [BI.extend({}, da, {
x: items[0][0].name x: items[0][0].name
})], })],
name: da.x name: da.x
}) });
}); });
return [result]; return [result];
} else if(this.config.numberOfPointer === c.ONE_POINTER && items[0].length > 1) { } else if(this.config.numberOfPointer === c.ONE_POINTER && items[0].length > 1) {
@ -320,17 +320,17 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
x: item.name x: item.name
})], })],
name: BI.UUID() name: BI.UUID()
}) });
}); });
return [result] return [result];
} }
if (this.config.numberOfPointer === c.MULTI_POINTER && items[0].length > 1) {//多个系列 if (this.config.numberOfPointer === c.MULTI_POINTER && items[0].length > 1) {// 多个系列
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item, function (id, it) { BI.each(item, function (id, it) {
var data = it.data[0]; var data = it.data[0];
data.x = it.name; data.x = it.name;
result.push(data); result.push(data);
}) });
}); });
return [[{ return [[{
data: result, data: result,
@ -348,8 +348,8 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
y: da.y y: da.y
})], })],
name: da.x name: da.x
}) });
}) });
}); });
return [others]; return [others];
} }
@ -395,4 +395,4 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.DashboardChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.DashboardChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.dashboard_chart', BI.DashboardChart); BI.shortcut("bi.dashboard_chart", BI.DashboardChart);

18
src/addons/chart/chart/chart.donut.js

@ -8,7 +8,7 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DonutChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DonutChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-donut-chart" baseCls: "bi-donut-chart"
}) });
}, },
_init: function () { _init: function () {
@ -24,11 +24,11 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.DonutChart.EVENT_CHANGE, obj); self.fireEvent(BI.DonutChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
_formatConfig: function(config, items){ _formatConfig: function (config, items) {
var self = this; var self = this;
delete config.zoom; delete config.zoom;
config.colors = this.config.chartColor; config.colors = this.config.chartColor;
@ -49,13 +49,13 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1); da.y = self.formatXYDataWithMagnify(da.y, 1);
}) });
}); });
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartStyle(){ function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -80,9 +80,9 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
this.options.items = items; this.options.items = items;
var types = []; var types = [];
BI.each(items, function(idx, axisItems){ BI.each(items, function (idx, axisItems) {
var type = []; var type = [];
BI.each(axisItems, function(id, item){ BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.DONUT); type.push(BICst.WIDGET.DONUT);
}); });
types.push(type); types.push(type);
@ -95,9 +95,9 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize(); this.combineChart.resize();
}, },
magnify: function(){ magnify: function () {
this.combineChart.magnify(); this.combineChart.magnify();
} }
}); });
BI.DonutChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.DonutChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.donut_chart', BI.DonutChart); BI.shortcut("bi.donut_chart", BI.DonutChart);

102
src/addons/chart/chart/chart.fallaxis.js

@ -8,7 +8,7 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.FallAxisChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.FallAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-fall-axis-chart" baseCls: "bi-fall-axis-chart"
}) });
}, },
_init: function () { _init: function () {
@ -43,11 +43,11 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.FallAxisChart.EVENT_CHANGE, obj); self.fireEvent(BI.FallAxisChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
_formatConfig: function(config, items){ _formatConfig: function (config, items) {
var self = this, o = this.options; var self = this, o = this.options;
var yTitle = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS); var yTitle = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.colors = this.config.chartColor; config.colors = this.config.chartColor;
@ -56,11 +56,11 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
config.legend.enabled = false; config.legend.enabled = false;
config.plotOptions.dataLabels.enabled = this.config.showDataLabel; config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.dataSheet.enabled = this.config.showDataTable; config.dataSheet.enabled = this.config.showDataTable;
if(config.dataSheet.enabled === true){ if(config.dataSheet.enabled === true) {
config.xAxis[0].showLabel = false; config.xAxis[0].showLabel = false;
} }
config.zoom.zoomTool.enabled = this.config.showZoom; config.zoom.zoomTool.enabled = this.config.showZoom;
if(this.config.showZoom === true){ if(this.config.showZoom === true) {
delete config.dataSheet; delete config.dataSheet;
delete config.zoom.zoomType; delete config.zoom.zoomType;
} }
@ -86,20 +86,20 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
enableMinorTick: this.config.enableMinorTick, enableMinorTick: this.config.enableMinorTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
if(config.plotOptions.dataLabels.enabled === true){ if(config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function(idx, item){ BI.each(items, function (idx, item) {
if(idx === 0){ if(idx === 0) {
item.dataLabels = {}; item.dataLabels = {};
return; return;
} }
item.dataLabels = { item.dataLabels = {
"style": self.config.chartFont, style: self.config.chartFont,
"align": "outside", align: "outside",
"autoAdjust": true, autoAdjust: true,
enabled: true, enabled: true,
formatter: { formatter: {
identifier: "${VALUE}", identifier: "${VALUE}",
@ -109,12 +109,12 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
}); });
} }
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle(){ function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -124,23 +124,23 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon(){ function formatCordon () {
BI.each(self.config.cordon, function(idx, cor){ BI.each(self.config.cordon, function (idx, cor) {
if(idx === 0 && self.xAxis.length > 0){ if(idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
self.xAxis[0].plotLines = BI.map(cor, function(i, t){ self.xAxis[0].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, { return BI.extend(t, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
} }
if(idx > 0 && self.yAxis.length >= idx){ if(idx > 0 && self.yAxis.length >= idx) {
var magnify = 1; var magnify = 1;
switch (idx - 1) { switch (idx - 1) {
case self.constants.LEFT_AXIS: case self.constants.LEFT_AXIS:
@ -153,34 +153,34 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel); magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break; break;
} }
self.yAxis[idx - 1].plotLines = BI.map(cor, function(i, t){ self.yAxis[idx - 1].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, { return BI.extend(t, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatNumberLevelInYaxis(type, position, formatter){ function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
} }
}) });
}); });
config.plotOptions.tooltip.formatter.valueFormat = formatter; config.plotOptions.tooltip.formatter.valueFormat = formatter;
} }
function getXYAxisUnit(numberLevelType, position){ function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -196,33 +196,33 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
unit = BI.i18nText("BI-Yi"); unit = BI.i18nText("BI-Yi");
break; break;
} }
if(position === self.constants.X_AXIS){ if(position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if(position === self.constants.LEFT_AXIS){ if(position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if(position === self.constants.RIGHT_AXIS){ if(position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
}, },
_formatItems: function(items){ _formatItems: function (items) {
var o = this.options; var o = this.options;
if(BI.isEmptyArray(items)){ if(BI.isEmptyArray(items)) {
return []; return [];
} }
items = items[0]; items = items[0];
var tables = [], sum = 0; var tables = [], sum = 0;
var colors = this.config.chartColor || []; var colors = this.config.chartColor || [];
if(BI.isEmptyArray(colors)){ if(BI.isEmptyArray(colors)) {
colors = ["rgb(152, 118, 170)", "rgb(0, 157, 227)"]; colors = ["rgb(152, 118, 170)", "rgb(0, 157, 227)"];
} }
BI.each(items, function(idx, item){ BI.each(items, function (idx, item) {
BI.each(item.data, function(i, t){ BI.each(item.data, function (i, t) {
if(t.y < 0){ if(t.y < 0) {
tables.push([t.x, t.y, sum + t.y, t]); tables.push([t.x, t.y, sum + t.y, t]);
}else{ }else{
tables.push([t.x, t.y, sum, t]); tables.push([t.x, t.y, sum, t]);
@ -231,14 +231,14 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
}); });
}); });
return [BI.map(BI.makeArray(2, null), function(idx, item){ return [BI.map(BI.makeArray(2, null), function (idx, item) {
return { return {
"data": BI.map(tables, function(id, cell){ data: BI.map(tables, function (id, cell) {
var axis = BI.extend({}, cell[3], { var axis = BI.extend({}, cell[3], {
x: cell[0], x: cell[0],
y: Math.abs(cell[2 - idx]) y: Math.abs(cell[2 - idx])
}); });
if(idx === 1){ if(idx === 1) {
axis.color = cell[2 - idx] < 0 ? colors[1] : colors[0]; axis.color = cell[2 - idx] < 0 ? colors[1] : colors[0];
}else{ }else{
axis.color = "rgba(0,0,0,0)"; axis.color = "rgba(0,0,0,0)";
@ -248,7 +248,7 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
axis.mouseOverColor = "rgba(0,0,0,0)"; axis.mouseOverColor = "rgba(0,0,0,0)";
axis.tooltip = { axis.tooltip = {
enable: false enable: false
} };
} }
return axis; return axis;
}), }),
@ -287,9 +287,9 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
}; };
this.options.items = items; this.options.items = items;
var types = []; var types = [];
BI.each(items, function(idx, axisItems){ BI.each(items, function (idx, axisItems) {
var type = []; var type = [];
BI.each(axisItems, function(id, item){ BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AXIS); type.push(BICst.WIDGET.AXIS);
}); });
types.push(type); types.push(type);
@ -302,9 +302,9 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize(); this.combineChart.resize();
}, },
magnify: function(){ magnify: function () {
this.combineChart.magnify(); this.combineChart.magnify();
} }
}); });
BI.FallAxisChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.FallAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.fall_axis_chart', BI.FallAxisChart); BI.shortcut("bi.fall_axis_chart", BI.FallAxisChart);

10
src/addons/chart/chart/chart.forcebubble.js

@ -8,7 +8,7 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ForceBubbleChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ForceBubbleChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-force-bubble-chart" baseCls: "bi-force-bubble-chart"
}) });
}, },
_init: function () { _init: function () {
@ -24,13 +24,13 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.ForceBubbleChart.EVENT_CHANGE, obj); self.fireEvent(BI.ForceBubbleChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
_formatConfig: function (config, items) { _formatConfig: function (config, items) {
var self = this, o = this.options; var self = this, o = this.options;
config.chartType = 'forceBubble'; config.chartType = "forceBubble";
config.colors = this.config.chartColor; config.colors = this.config.chartColor;
this.formatChartLegend(config, this.config.chartLegend); this.formatChartLegend(config, this.config.chartLegend);
@ -46,7 +46,7 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1); da.y = self.formatXYDataWithMagnify(da.y, 1);
}) });
}); });
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
return [items, config]; return [items, config];
@ -84,4 +84,4 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.ForceBubbleChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.ForceBubbleChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.force_bubble_chart', BI.ForceBubbleChart); BI.shortcut("bi.force_bubble_chart", BI.ForceBubbleChart);

20
src/addons/chart/chart/chart.gismap.js

@ -8,7 +8,7 @@ BI.GISMapChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.GISMapChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.GISMapChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-gis-map-chart" baseCls: "bi-gis-map-chart"
}) });
}, },
_init: function () { _init: function () {
@ -24,7 +24,7 @@ BI.GISMapChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.GISMapChart.EVENT_CHANGE, obj); self.fireEvent(BI.GISMapChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -36,29 +36,29 @@ BI.GISMapChart = BI.inherit(BI.AbstractChart, {
config.plotOptions.dataLabels.useHtml = true; config.plotOptions.dataLabels.useHtml = true;
config.plotOptions.dataLabels.style = this.config.chartFont; config.plotOptions.dataLabels.style = this.config.chartFont;
config.plotOptions.dataLabels.formatter = function () { config.plotOptions.dataLabels.formatter = function () {
var name = (BI.isArray(this.name) ? '' : this.name + ',') + BI.contentFormat(this.value, '#.##;-#.##') ; var name = (BI.isArray(this.name) ? "" : this.name + ",") + BI.contentFormat(this.value, "#.##;-#.##");
var style = "padding: 5px; background-color: rgba(0,0,0,0.4980392156862745);border-color: rgb(0,0,0); border-radius:2px; border-width:0px;"; var style = "padding: 5px; background-color: rgba(0,0,0,0.4980392156862745);border-color: rgb(0,0,0); border-radius:2px; border-width:0px;";
var a = '<div style = ' + style + '>' + name + '</div>'; var a = "<div style = " + style + ">" + name + "</div>";
return a; return a;
}; };
config.plotOptions.tooltip.shared = true; config.plotOptions.tooltip.shared = true;
config.plotOptions.tooltip.formatter = function () { config.plotOptions.tooltip.formatter = function () {
var tip = BI.isArray(this.name) ? '' : this.name; var tip = BI.isArray(this.name) ? "" : this.name;
BI.each(this.points, function (idx, point) { BI.each(this.points, function (idx, point) {
tip += ('<div>' + point.seriesName + ':' + BI.contentFormat((point.size || point.y), '#.##;-#.##') + '</div>'); tip += ("<div>" + point.seriesName + ":" + BI.contentFormat((point.size || point.y), "#.##;-#.##") + "</div>");
}); });
return tip; return tip;
}; };
config.geo = { config.geo = {
"tileLayer": "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}", tileLayer: "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",
"attribution": "<a><img src='http://webapi.amap.com/theme/v1.3/mapinfo_05.png'>&copy; 2016 AutoNavi</a>" attribution: "<a><img src='http://webapi.amap.com/theme/v1.3/mapinfo_05.png'>&copy; 2016 AutoNavi</a>"
}; };
if (this.config.showBackgroundLayer === true && BI.isNotNull(this.config.backgroundLayerInfo)) { if (this.config.showBackgroundLayer === true && BI.isNotNull(this.config.backgroundLayerInfo)) {
config.geo = {}; config.geo = {};
if (this.config.backgroundLayerInfo.type === BICst.WMS_SERVER) { if (this.config.backgroundLayerInfo.type === BICst.WMS_SERVER) {
config.geo.tileLayer = false; config.geo.tileLayer = false;
config.geo.wmsUrl = this.config.backgroundLayerInfo.url; config.geo.wmsUrl = this.config.backgroundLayerInfo.url;
config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer;
} else { } else {
config.geo.tileLayer = this.config.backgroundLayerInfo.url; config.geo.tileLayer = this.config.backgroundLayerInfo.url;
} }
@ -157,4 +157,4 @@ BI.GISMapChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.GISMapChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.GISMapChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.gis_map_chart', BI.GISMapChart); BI.shortcut("bi.gis_map_chart", BI.GISMapChart);

40
src/addons/chart/chart/chart.line.js

@ -8,7 +8,7 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.LineChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.LineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-line-chart" baseCls: "bi-line-chart"
}) });
}, },
_init: function () { _init: function () {
@ -34,7 +34,7 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.LineChart.EVENT_CHANGE, obj); self.fireEvent(BI.LineChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -100,20 +100,20 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableMinorTick: self.config.enableMinorTick, enableMinorTick: self.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "line"; config.chartType = "line";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -123,7 +123,7 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -132,9 +132,9 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -157,17 +157,17 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatChartLineStyle() { function formatChartLineStyle () {
switch (self.config.chartLineType) { switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE: case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false; config.plotOptions.curve = false;
@ -185,7 +185,7 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
} }
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -202,13 +202,13 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -294,4 +294,4 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.LineChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.LineChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.line_chart', BI.LineChart); BI.shortcut("bi.line_chart", BI.LineChart);

66
src/addons/chart/chart/chart.map.js

@ -8,7 +8,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MapChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MapChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-map-chart" baseCls: "bi-map-chart"
}) });
}, },
_init: function () { _init: function () {
@ -24,7 +24,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.MapChart.EVENT_CHANGE, obj); self.fireEvent(BI.MapChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -46,7 +46,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
var tip = this.name; var tip = this.name;
var point = this.points[0]; var point = this.points[0];
var index = BI.isNull(point.size) ? 0 : 1; var index = BI.isNull(point.size) ? 0 : 1;
tip += ('<div>' + point.seriesName + ':' + BI.contentFormat(point.size || point.y, formatterArray[index]) + '</div>'); tip += ("<div>" + point.seriesName + ":" + BI.contentFormat(point.size || point.y, formatterArray[index]) + "</div>");
return tip; return tip;
}; };
config.plotOptions.dataLabels.formatter.valueFormat = function () { config.plotOptions.dataLabels.formatter.valueFormat = function () {
@ -64,7 +64,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
if (this.config.backgroundLayerInfo.type === BICst.WMS_SERVER) { if (this.config.backgroundLayerInfo.type === BICst.WMS_SERVER) {
config.geo.tileLayer = false; config.geo.tileLayer = false;
config.geo.wmsUrl = this.config.backgroundLayerInfo.url; config.geo.wmsUrl = this.config.backgroundLayerInfo.url;
config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer;
} else { } else {
config.geo.tileLayer = this.config.backgroundLayerInfo.url; config.geo.tileLayer = this.config.backgroundLayerInfo.url;
} }
@ -89,12 +89,12 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
items.push({ items.push({
type: "areaMap", type: "areaMap",
data: [] data: []
}) });
} }
return [items, config]; return [items, config];
function formatRangeLegend() { function formatRangeLegend () {
config.rangeLegend.enabled = true; config.rangeLegend.enabled = true;
switch (self.config.chartLegend) { switch (self.config.chartLegend) {
case BICst.CHART_LEGENDS.BOTTOM: case BICst.CHART_LEGENDS.BOTTOM:
@ -117,36 +117,36 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
var settings = items[0].settings; var settings = items[0].settings;
var legendFormat = formatToolTipAndDataLabel(settings.format || c.NORMAL, settings.num_level || c.NORMAL, var legendFormat = formatToolTipAndDataLabel(settings.format || c.NORMAL, settings.num_level || c.NORMAL,
settings.unit || "", settings.numSeparators || c.NUM_SEPARATORS); settings.unit || "", settings.numSeparators || c.NUM_SEPARATORS);
to = BI.contentFormat(to, legendFormat) to = BI.contentFormat(to, legendFormat);
} }
return to return to;
}; };
} }
function formatToolTipAndDataLabel(format, numberLevel, unit, numSeparators) { function formatToolTipAndDataLabel (format, numberLevel, unit, numSeparators) {
var formatter = '#.##'; var formatter = "#.##";
switch (format) { switch (format) {
case self.constants.NORMAL: case self.constants.NORMAL:
formatter = '#.##'; formatter = "#.##";
if (numSeparators) formatter = '#,###.##'; if (numSeparators) formatter = "#,###.##";
break; break;
case self.constants.ZERO2POINT: case self.constants.ZERO2POINT:
formatter = '#0'; formatter = "#0";
if (numSeparators) formatter = '#,###'; if (numSeparators) formatter = "#,###";
break; break;
case self.constants.ONE2POINT: case self.constants.ONE2POINT:
formatter = '#0.0'; formatter = "#0.0";
if (numSeparators) formatter = '#,###.0'; if (numSeparators) formatter = "#,###.0";
break; break;
case self.constants.TWO2POINT: case self.constants.TWO2POINT:
formatter = '#0.00'; formatter = "#0.00";
if (numSeparators) formatter = '#,###.00'; if (numSeparators) formatter = "#,###.00";
break; break;
} }
switch (numberLevel) { switch (numberLevel) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
formatter += ''; formatter += "";
break; break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND: case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
formatter += BI.i18nText("BI-Wan"); formatter += BI.i18nText("BI-Wan");
@ -158,23 +158,23 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
formatter += BI.i18nText("BI-Yi"); formatter += BI.i18nText("BI-Yi");
break; break;
case BICst.TARGET_STYLE.NUM_LEVEL.PERCENT: case BICst.TARGET_STYLE.NUM_LEVEL.PERCENT:
formatter += '%'; formatter += "%";
break; break;
} }
return formatter + unit; return formatter + unit;
} }
function getRangeStyle(styles, change, defaultColor) { function getRangeStyle (styles, change, defaultColor) {
var range = [], color = null, defaultStyle = {}; var range = [], color = null, defaultStyle = {};
var conditionMax = null, conditionMin = null, min = null; var conditionMax = null, conditionMin = null, min = null;
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, it) { BI.each(item.data, function (id, it) {
if (BI.isNull(min) || BI.parseFloat(min) > BI.parseFloat(it.y)) { if (BI.isNull(min) || BI.parseFloat(min) > BI.parseFloat(it.y)) {
min = it.y min = it.y;
} }
}) });
}); });
switch (change) { switch (change) {
@ -196,11 +196,11 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
range.push({ range.push({
color: style.color || "rgba(255,255,255,0)", color: style.color || "rgba(255,255,255,0)",
from: style.range.min, from: style.range.min,
to: to, to: to
}); });
} }
color = style.color; color = style.color;
conditionMax = style.range.max conditionMax = style.range.max;
}); });
conditionMin = BI.parseFloat(styles[0].range.min); conditionMin = BI.parseFloat(styles[0].range.min);
@ -220,21 +220,21 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
}); });
} }
return range; return range;
} else {
defaultStyle.color = defaultColor;
return defaultStyle;
} }
defaultStyle.color = defaultColor;
return defaultStyle;
} }
} }
function _calculateValueNiceDomain(minValue, maxValue) { function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue); minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue); var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval); return _linearNiceDomain(minValue, maxValue, tickInterval);
} }
function _linearTickInterval(minValue, maxValue, m) { function _linearTickInterval (minValue, maxValue, m) {
m = m || 5; m = m || 5;
var span = maxValue - minValue; var span = maxValue - minValue;
var step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)); var step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10));
@ -245,7 +245,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
return step; return step;
} }
function _linearNiceDomain(minValue, maxValue, tickInterval) { function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval); minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval); maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
@ -313,7 +313,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
self._formatDrillItems(da.drilldown); self._formatDrillItems(da.drilldown);
} }
}); });
}) });
}); });
return items; return items;
}, },
@ -358,4 +358,4 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
}); });
BI.MapChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.MapChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.MapChart.EVENT_CLICK_DTOOL = "EVENT_CLICK_DTOOL"; BI.MapChart.EVENT_CLICK_DTOOL = "EVENT_CLICK_DTOOL";
BI.shortcut('bi.map_chart', BI.MapChart); BI.shortcut("bi.map_chart", BI.MapChart);

58
src/addons/chart/chart/chart.multiaxis.js

@ -11,7 +11,7 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiAxisChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-axis-chart" baseCls: "bi-multi-axis-chart"
}) });
}, },
_init: function () { _init: function () {
@ -20,10 +20,10 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
this.xAxis = [{ this.xAxis = [{
type: "category", type: "category",
title: { title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""} style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
}, },
labelStyle: { labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px" fontFamily: "inherit", color: "#808080", fontSize: "12px"
}, },
position: "bottom", position: "bottom",
gridLineWidth: 0 gridLineWidth: 0
@ -39,7 +39,7 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.MultiAxisChart.EVENT_CHANGE, obj); self.fireEvent(BI.MultiAxisChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -120,13 +120,13 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick, enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
if (config.dataSheet) { if (config.dataSheet) {
config.dataSheet.style = this.config.chartFont; config.dataSheet.style = this.config.chartFont;
} }
@ -161,14 +161,14 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": { style: {
"fontFamily": "inherit", fontFamily: "inherit",
"color": "#808080", color: "#808080",
"fontSize": "12px", fontSize: "12px",
"fontWeight": "" fontWeight: ""
}, },
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -193,19 +193,19 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": { style: {
"fontFamily": "inherit", fontFamily: "inherit",
"color": "#808080", color: "#808080",
"fontSize": "12px", fontSize: "12px",
"fontWeight": "" fontWeight: ""
}, },
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
}, },
getXYAxisUnit: function (numberLevelType, position) { getXYAxisUnit: function (numberLevelType, position) {
@ -227,16 +227,16 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === this.constants.X_AXIS) { if (position === this.constants.X_AXIS) {
this.config.xAxisUnit !== "" && (unit = unit + this.config.xAxisUnit) this.config.xAxisUnit !== "" && (unit = unit + this.config.xAxisUnit);
} }
if (position === this.constants.LEFT_AXIS) { if (position === this.constants.LEFT_AXIS) {
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit) this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit);
} }
if (position === this.constants.RIGHT_AXIS) { if (position === this.constants.RIGHT_AXIS) {
this.config.rightYAxisUnit !== "" && (unit = unit + this.config.rightYAxisUnit) this.config.rightYAxisUnit !== "" && (unit = unit + this.config.rightYAxisUnit);
} }
if (position === this.constants.RIGHT_AXIS_SECOND) { if (position === this.constants.RIGHT_AXIS_SECOND) {
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit) this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
}, },
@ -294,10 +294,10 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
var newYAxis = { var newYAxis = {
type: "value", type: "value",
title: { title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""} style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
}, },
labelStyle: { labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px" fontFamily: "inherit", color: "#808080", fontSize: "12px"
}, },
position: idx > 0 ? "right" : "left", position: idx > 0 ? "right" : "left",
lineWidth: 1, lineWidth: 1,
@ -319,4 +319,4 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.MultiAxisChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.multi_axis_chart', BI.MultiAxisChart); BI.shortcut("bi.multi_axis_chart", BI.MultiAxisChart);

58
src/addons/chart/chart/chart.multiaxiscombine.js

@ -11,7 +11,7 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiAxisCombineChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiAxisCombineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-axis-combine-chart" baseCls: "bi-multi-axis-combine-chart"
}) });
}, },
_init: function () { _init: function () {
@ -20,10 +20,10 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
this.xAxis = [{ this.xAxis = [{
type: "category", type: "category",
title: { title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""} style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
}, },
labelStyle: { labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px" fontFamily: "inherit", color: "#808080", fontSize: "12px"
}, },
position: "bottom", position: "bottom",
gridLineWidth: 0 gridLineWidth: 0
@ -39,7 +39,7 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.MultiAxisCombineChart.EVENT_CHANGE, obj); self.fireEvent(BI.MultiAxisCombineChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -123,13 +123,13 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick, enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont); this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
if (config.dataSheet) { if (config.dataSheet) {
config.dataSheet.style = this.config.chartFont; config.dataSheet.style = this.config.chartFont;
} }
@ -164,14 +164,14 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": { style: {
"fontFamily": "inherit", fontFamily: "inherit",
"color": "#808080", color: "#808080",
"fontSize": "12px", fontSize: "12px",
"fontWeight": "" fontWeight: ""
}, },
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -196,19 +196,19 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": { style: {
"fontFamily": "inherit", fontFamily: "inherit",
"color": "#808080", color: "#808080",
"fontSize": "12px", fontSize: "12px",
"fontWeight": "" fontWeight: ""
}, },
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
}, },
getXYAxisUnit: function (numberLevelType, position) { getXYAxisUnit: function (numberLevelType, position) {
@ -230,16 +230,16 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === this.constants.X_AXIS) { if (position === this.constants.X_AXIS) {
this.config.xAxisUnit !== "" && (unit = unit + this.config.xAxisUnit) this.config.xAxisUnit !== "" && (unit = unit + this.config.xAxisUnit);
} }
if (position === this.constants.LEFT_AXIS) { if (position === this.constants.LEFT_AXIS) {
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit) this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit);
} }
if (position === this.constants.RIGHT_AXIS) { if (position === this.constants.RIGHT_AXIS) {
this.config.rightYAxisUnit !== "" && (unit = unit + this.config.rightYAxisUnit) this.config.rightYAxisUnit !== "" && (unit = unit + this.config.rightYAxisUnit);
} }
if (position === this.constants.RIGHT_AXIS_SECOND) { if (position === this.constants.RIGHT_AXIS_SECOND) {
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit) this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
}, },
@ -296,10 +296,10 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
var newYAxis = { var newYAxis = {
type: "value", type: "value",
title: { title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""} style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
}, },
labelStyle: { labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px" fontFamily: "inherit", color: "#808080", fontSize: "12px"
}, },
position: idx > 0 ? "right" : "left", position: idx > 0 ? "right" : "left",
lineWidth: 1, lineWidth: 1,
@ -321,4 +321,4 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.MultiAxisCombineChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiAxisCombineChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.multi_axis_combine_chart', BI.MultiAxisCombineChart); BI.shortcut("bi.multi_axis_combine_chart", BI.MultiAxisCombineChart);

38
src/addons/chart/chart/chart.percentaccumulatearea.js

@ -8,7 +8,7 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PercentAccumulateAreaChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.PercentAccumulateAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-percent-accumulate-area-chart" baseCls: "bi-percent-accumulate-area-chart"
}) });
}, },
_init: function () { _init: function () {
@ -43,7 +43,7 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.PercentAccumulateAreaChart.EVENT_CHANGE, obj); self.fireEvent(BI.PercentAccumulateAreaChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -84,20 +84,20 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "area"; config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont, true); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont, true);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -107,7 +107,7 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -116,9 +116,9 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -141,17 +141,17 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -168,15 +168,15 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
unit = unit === "" ? unit : "(" + unit + ")"; unit = unit === "" ? unit : "(" + unit + ")";
return self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + unit : unit return self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + unit : unit;
} }
}, },
@ -242,4 +242,4 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.PercentAccumulateAreaChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.PercentAccumulateAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.percent_accumulate_area_chart', BI.PercentAccumulateAreaChart); BI.shortcut("bi.percent_accumulate_area_chart", BI.PercentAccumulateAreaChart);

36
src/addons/chart/chart/chart.percentaccumulateaxis.js

@ -8,7 +8,7 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PercentAccumulateAxisChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.PercentAccumulateAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-percent-accumulate-axis-chart" baseCls: "bi-percent-accumulate-axis-chart"
}) });
}, },
_init: function () { _init: function () {
@ -43,7 +43,7 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.PercentAccumulateAxisChart.EVENT_CHANGE, obj); self.fireEvent(BI.PercentAccumulateAxisChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -85,18 +85,18 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick, enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont, true); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont, true);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -106,7 +106,7 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -115,9 +115,9 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -140,17 +140,17 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -167,10 +167,10 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -237,4 +237,4 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.PercentAccumulateAxisChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.PercentAccumulateAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.percent_accumulate_axis_chart', BI.PercentAccumulateAxisChart); BI.shortcut("bi.percent_accumulate_axis_chart", BI.PercentAccumulateAxisChart);

46
src/addons/chart/chart/chart.pie.js

@ -8,7 +8,7 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PieChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.PieChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-pie-chart" baseCls: "bi-pie-chart"
}) });
}, },
_init: function () { _init: function () {
@ -24,11 +24,11 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.PieChart.EVENT_CHANGE, obj); self.fireEvent(BI.PieChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
_formatConfig: function(config, items){ _formatConfig: function (config, items) {
var self = this, o = this.options; var self = this, o = this.options;
delete config.zoom; delete config.zoom;
config.colors = this.config.chartColor; config.colors = this.config.chartColor;
@ -50,14 +50,14 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1); da.y = self.formatXYDataWithMagnify(da.y, 1);
}) });
}); });
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartStyle(){ function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -67,8 +67,8 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatChartPieStyle(){ function formatChartPieStyle () {
switch (self.config.chartPieType){ switch (self.config.chartPieType) {
case BICst.CHART_SHAPE.EQUAL_ARC_ROSE: case BICst.CHART_SHAPE.EQUAL_ARC_ROSE:
config.plotOptions.roseType = "sameArc"; config.plotOptions.roseType = "sameArc";
break; break;
@ -86,31 +86,31 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
}, },
//目前饼图不会有多个系列,如果有多个就要把它们合并在一起 // 目前饼图不会有多个系列,如果有多个就要把它们合并在一起
_isNeedConvert: function(items){ _isNeedConvert: function (items) {
var result = BI.find(items, function(idx, item){ var result = BI.find(items, function (idx, item) {
return item.length > 1; return item.length > 1;
}); });
return BI.isNotNull(result); return BI.isNotNull(result);
}, },
_formatItems: function(items){ _formatItems: function (items) {
if(this._isNeedConvert(items)){ if(this._isNeedConvert(items)) {
//把每个坐标轴所有的多个系列合并成一个系列 // 把每个坐标轴所有的多个系列合并成一个系列
return BI.map(items, function(idx, item){ return BI.map(items, function (idx, item) {
var seriesItem = []; var seriesItem = [];
var obj = {data: [], name: ""}; var obj = {data: [], name: ""};
seriesItem.push(obj); seriesItem.push(obj);
BI.each(item, function(id, series){ BI.each(item, function (id, series) {
BI.each(series.data, function(i, da){ BI.each(series.data, function (i, da) {
obj.data.push(BI.extend({}, da, {x: series.name})); obj.data.push(BI.extend({}, da, {x: series.name}));
}); });
}); });
return seriesItem; return seriesItem;
}) });
}else{
return items;
} }
return items;
}, },
populate: function (items, options) { populate: function (items, options) {
@ -129,9 +129,9 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
this.options.items = items; this.options.items = items;
var types = []; var types = [];
BI.each(items, function(idx, axisItems){ BI.each(items, function (idx, axisItems) {
var type = []; var type = [];
BI.each(axisItems, function(id, item){ BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.PIE); type.push(BICst.WIDGET.PIE);
}); });
types.push(type); types.push(type);
@ -144,10 +144,10 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize(); this.combineChart.resize();
}, },
magnify: function(){ magnify: function () {
this.combineChart.magnify(); this.combineChart.magnify();
} }
}); });
BI.PieChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.PieChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.pie_chart', BI.PieChart); BI.shortcut("bi.pie_chart", BI.PieChart);

28
src/addons/chart/chart/chart.radar.js

@ -8,7 +8,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.RadarChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.RadarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-radar-chart" baseCls: "bi-radar-chart"
}) });
}, },
_init: function () { _init: function () {
@ -21,7 +21,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
}, },
labelStyle: this.constants.FONT_STYLE, labelStyle: this.constants.FONT_STYLE,
formatter: function () { formatter: function () {
return this > 0 ? this : (-1) * this return this > 0 ? this : (-1) * this;
}, },
gridLineWidth: 0, gridLineWidth: 0,
position: "bottom" position: "bottom"
@ -45,7 +45,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.RadarChart.EVENT_CHANGE, obj); self.fireEvent(BI.RadarChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -72,17 +72,17 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
config.chartType = "radar"; config.chartType = "radar";
delete config.xAxis; delete config.xAxis;
delete config.yAxis; delete config.yAxis;
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.radiusAxis[0].formatter, this.config.chartFont); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.radiusAxis[0].formatter, this.config.chartFont);
//全局样式 // 全局样式
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
config.radiusAxis[0].title.style = config.radiusAxis[0].labelStyle = this.config.chartFont; config.radiusAxis[0].title.style = config.radiusAxis[0].labelStyle = this.config.chartFont;
config.angleAxis[0].title.style = config.angleAxis[0].labelStyle = this.config.chartFont; config.angleAxis[0].title.style = config.angleAxis[0].labelStyle = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -92,7 +92,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatChartRadarStyle() { function formatChartRadarStyle () {
switch (self.config.chartRadarType) { switch (self.config.chartRadarType) {
case BICst.CHART_SHAPE.POLYGON: case BICst.CHART_SHAPE.POLYGON:
config.plotOptions.shape = "polygon"; config.plotOptions.shape = "polygon";
@ -103,19 +103,19 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatNumberLevelInYaxis(type, position, formatter) { function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
} }
}) });
}); });
config.plotOptions.tooltip.formatter.valueFormat = formatter; config.plotOptions.tooltip.formatter.valueFormat = formatter;
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -132,13 +132,13 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -182,4 +182,4 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.RadarChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.RadarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.radar_chart', BI.RadarChart); BI.shortcut("bi.radar_chart", BI.RadarChart);

40
src/addons/chart/chart/chart.rangearea.js

@ -9,7 +9,7 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.RangeAreaChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.RangeAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-range-area-chart" baseCls: "bi-range-area-chart"
}) });
}, },
_init: function () { _init: function () {
@ -44,7 +44,7 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.RangeAreaChart.EVENT_CHANGE, obj); self.fireEvent(BI.RangeAreaChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -79,21 +79,21 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
enableTick: this.config.enableTick, enableTick: this.config.enableTick,
labelRotation: this.config.textDirection, labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0, gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%' maxHeight: "40%"
}); });
config.chartType = "area"; config.chartType = "area";
config.plotOptions.tooltip.formatter.identifier = "${CATEGORY}${VALUE}"; config.plotOptions.tooltip.formatter.identifier = "${CATEGORY}${VALUE}";
//为了给数据标签加个%,还要遍历所有的系列,唉 // 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont); this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont);
//全局样式的图表文字 // 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config); this.setFontStyle(this.config.chartFont, config);
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -103,7 +103,7 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -112,9 +112,9 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -137,29 +137,29 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style" : self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatNumberLevelInYaxis(type, position, formatter) { function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
if (position === item.yAxis) { if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
} }
}) });
}); });
config.plotOptions.tooltip.formatter.valueFormat = formatter; config.plotOptions.tooltip.formatter.valueFormat = formatter;
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -176,10 +176,10 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -281,4 +281,4 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.RangeAreaChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.RangeAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.range_area_chart', BI.RangeAreaChart); BI.shortcut("bi.range_area_chart", BI.RangeAreaChart);

70
src/addons/chart/chart/chart.scatter.js

@ -8,7 +8,7 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ScatterChart.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ScatterChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-scatter-chart" baseCls: "bi-scatter-chart"
}) });
}, },
_init: function () { _init: function () {
@ -43,7 +43,7 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.ScatterChart.EVENT_CHANGE, obj); self.fireEvent(BI.ScatterChart.EVENT_CHANGE, obj);
}); });
this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) { this.combineChart.on(BI.CombineChart.EVENT_ITEM_CLICK, function (obj) {
self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj) self.fireEvent(BI.AbstractChart.EVENT_ITEM_CLICK, obj);
}); });
}, },
@ -53,7 +53,7 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
delete config.zoom; delete config.zoom;
config.colors = this.config.chartColor; config.colors = this.config.chartColor;
config.style = formatChartStyle(); config.style = formatChartStyle();
config.plotOptions.marker = {"symbol": "circle", "radius": 4.5, "enabled": true}; config.plotOptions.marker = {symbol: "circle", radius: 4.5, enabled: true};
formatCordon(); formatCordon();
this.formatChartLegend(config, this.config.chartLegend); this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel; config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
@ -68,7 +68,7 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
config.yAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + config.yAxis[0].title.text : config.yAxis[0].title.text; config.yAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + config.yAxis[0].title.text : config.yAxis[0].title.text;
config.yAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0; config.yAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.yAxis[0].title.rotation = this.constants.ROTATION; config.yAxis[0].title.rotation = this.constants.ROTATION;
config.yAxis[0].maxWidth = '40%'; config.yAxis[0].maxWidth = "40%";
config.xAxis[0].formatter = self.formatTickInXYaxis(this.config.xAxisStyle, this.config.xAxisNumberLevel, this.config.rightNumSeparators); config.xAxis[0].formatter = self.formatTickInXYaxis(this.config.xAxisStyle, this.config.xAxisNumberLevel, this.config.rightNumSeparators);
formatNumberLevelInXaxis(this.config.xAxisNumberLevel); formatNumberLevelInXaxis(this.config.xAxisNumberLevel);
@ -76,32 +76,32 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle + config.xAxis[0].title.text : config.xAxis[0].title.text; config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle + config.xAxis[0].title.text : config.xAxis[0].title.text;
config.xAxis[0].title.align = "center"; config.xAxis[0].title.align = "center";
config.xAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0; config.xAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.xAxis[0].maxHeight = '40%'; config.xAxis[0].maxHeight = "40%";
config.chartType = "scatter"; config.chartType = "scatter";
if (BI.isNotEmptyArray(this.config.tooltip)) { if (BI.isNotEmptyArray(this.config.tooltip)) {
config.plotOptions.tooltip.formatter = function () { config.plotOptions.tooltip.formatter = function () {
var y = self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)(this.y); var y = self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)(this.y);
var x = self.formatTickInXYaxis(self.config.xAxisStyle, self.config.xAxisNumberLevel, self.config.rightNumSeparators)(this.x); var x = self.formatTickInXYaxis(self.config.xAxisStyle, self.config.xAxisNumberLevel, self.config.rightNumSeparators)(this.x);
return this.seriesName + '<div>(X)' + self.config.tooltip[0] return this.seriesName + "<div>(X)" + self.config.tooltip[0]
+ ':' + x + '</div><div>(Y)' + self.config.tooltip[1] + ':' + y + '</div>' + ":" + x + "</div><div>(Y)" + self.config.tooltip[1] + ":" + y + "</div>";
}; };
} }
if (config.plotOptions.dataLabels.enabled === true) { if (config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
item.dataLabels = { item.dataLabels = {
"style": self.config.chartFont, style: self.config.chartFont,
"align": "outside", align: "outside",
"autoAdjust": true, autoAdjust: true,
enabled: true, enabled: true,
formatter: { formatter: {
identifier: "${X}${Y}", identifier: "${X}${Y}",
"XFormat": function () { XFormat: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##') return BI.contentFormat(arguments[0], "#.##;-#.##");
}, },
"YFormat": function () { YFormat: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##') return BI.contentFormat(arguments[0], "#.##;-#.##");
} }
} }
}; };
@ -110,14 +110,14 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
}); });
} }
//全局样式图表文字 // 全局样式图表文字
config.legend.style = this.config.chartFont; config.legend.style = this.config.chartFont;
config.yAxis[0].title.style = config.yAxis[0].labelStyle = this.config.chartFont; config.yAxis[0].title.style = config.yAxis[0].labelStyle = this.config.chartFont;
config.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont; config.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont;
return [items, config]; return [items, config];
function formatChartStyle() { function formatChartStyle () {
switch (self.config.chartStyle) { switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL: case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual"; return "gradual";
@ -127,7 +127,7 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
} }
} }
function formatCordon() { function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) { BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) { if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel); var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -136,9 +136,9 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "top" align: "top"
} }
}); });
}); });
@ -161,35 +161,35 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify), value: t.value.div(magnify),
width: 1, width: 1,
label: { label: {
"style": self.config.chartFont, style: self.config.chartFont,
"text": t.text, text: t.text,
"align": "left" align: "left"
} }
}); });
}); });
} }
}) });
} }
function formatNumberLevelInXaxis(type) { function formatNumberLevelInXaxis (type) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
da.x = self.formatXYDataWithMagnify(da.x, magnify); da.x = self.formatXYDataWithMagnify(da.x, magnify);
}) });
}) });
} }
function formatNumberLevelInYaxis(type) { function formatNumberLevelInYaxis (type) {
var magnify = self.calcMagnify(type); var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) { BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) { BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, magnify); da.y = self.formatXYDataWithMagnify(da.y, magnify);
}) });
}); });
} }
function getXYAxisUnit(numberLevelType, position) { function getXYAxisUnit (numberLevelType, position) {
var unit = ""; var unit = "";
switch (numberLevelType) { switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL: case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -206,13 +206,13 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
break; break;
} }
if (position === self.constants.X_AXIS) { if (position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit) self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
} }
if (position === self.constants.LEFT_AXIS) { if (position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit) self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
} }
if (position === self.constants.RIGHT_AXIS) { if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit) self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
} }
return unit === "" ? unit : "(" + unit + ")"; return unit === "" ? unit : "(" + unit + ")";
} }
@ -263,4 +263,4 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
} }
}); });
BI.ScatterChart.EVENT_CHANGE = "EVENT_CHANGE"; BI.ScatterChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.scatter_chart', BI.ScatterChart); BI.shortcut("bi.scatter_chart", BI.ScatterChart);

366
src/addons/chart/factory.charts.js

@ -12,55 +12,55 @@ BI.ChartCombineFormatItemFactory = {
case BICst.WIDGET.BAR: case BICst.WIDGET.BAR:
case BICst.WIDGET.ACCUMULATE_BAR: case BICst.WIDGET.ACCUMULATE_BAR:
case BICst.WIDGET.COMPARE_BAR: case BICst.WIDGET.COMPARE_BAR:
item = BI.extend({"type": "bar"}, items); item = BI.extend({type: "bar"}, items);
break; break;
case BICst.WIDGET.BUBBLE: case BICst.WIDGET.BUBBLE:
item = BI.extend({"type": "bubble"}, items); item = BI.extend({type: "bubble"}, items);
break; break;
case BICst.WIDGET.FORCE_BUBBLE: case BICst.WIDGET.FORCE_BUBBLE:
item = BI.extend({"type": "forceBubble"}, items); item = BI.extend({type: "forceBubble"}, items);
break; break;
case BICst.WIDGET.SCATTER: case BICst.WIDGET.SCATTER:
item = BI.extend({"type": "scatter"}, items); item = BI.extend({type: "scatter"}, items);
break; break;
case BICst.WIDGET.AXIS: case BICst.WIDGET.AXIS:
case BICst.WIDGET.ACCUMULATE_AXIS: case BICst.WIDGET.ACCUMULATE_AXIS:
case BICst.WIDGET.PERCENT_ACCUMULATE_AXIS: case BICst.WIDGET.PERCENT_ACCUMULATE_AXIS:
case BICst.WIDGET.COMPARE_AXIS: case BICst.WIDGET.COMPARE_AXIS:
case BICst.WIDGET.FALL_AXIS: case BICst.WIDGET.FALL_AXIS:
item = BI.extend({"type": "column"}, items); item = BI.extend({type: "column"}, items);
break; break;
case BICst.WIDGET.LINE: case BICst.WIDGET.LINE:
item = BI.extend({"type": "line"}, items); item = BI.extend({type: "line"}, items);
break; break;
case BICst.WIDGET.AREA: case BICst.WIDGET.AREA:
case BICst.WIDGET.ACCUMULATE_AREA: case BICst.WIDGET.ACCUMULATE_AREA:
case BICst.WIDGET.COMPARE_AREA: case BICst.WIDGET.COMPARE_AREA:
case BICst.WIDGET.RANGE_AREA: case BICst.WIDGET.RANGE_AREA:
case BICst.WIDGET.PERCENT_ACCUMULATE_AREA: case BICst.WIDGET.PERCENT_ACCUMULATE_AREA:
item = BI.extend({"type": "area"}, items); item = BI.extend({type: "area"}, items);
break; break;
case BICst.WIDGET.DONUT: case BICst.WIDGET.DONUT:
item = BI.extend({"type": "pie"}, items); item = BI.extend({type: "pie"}, items);
break; break;
case BICst.WIDGET.RADAR: case BICst.WIDGET.RADAR:
case BICst.WIDGET.ACCUMULATE_RADAR: case BICst.WIDGET.ACCUMULATE_RADAR:
item = BI.extend({"type": "radar"}, items); item = BI.extend({type: "radar"}, items);
break; break;
case BICst.WIDGET.PIE: case BICst.WIDGET.PIE:
item = BI.extend({"type": "pie"}, items); item = BI.extend({type: "pie"}, items);
break; break;
case BICst.WIDGET.DASHBOARD: case BICst.WIDGET.DASHBOARD:
item = BI.extend({"type": "gauge"}, items); item = BI.extend({type: "gauge"}, items);
break; break;
case BICst.WIDGET.MAP: case BICst.WIDGET.MAP:
item = BI.extend({"type": "areaMap"}, items); item = BI.extend({type: "areaMap"}, items);
break; break;
case BICst.WIDGET.GIS_MAP: case BICst.WIDGET.GIS_MAP:
item = BI.extend({"type": "pointMap"}, items); item = BI.extend({type: "pointMap"}, items);
break; break;
default: default:
item = BI.extend({"type": "column"}, items); item = BI.extend({type: "column"}, items);
break; break;
} }
return item; return item;
@ -68,177 +68,177 @@ BI.ChartCombineFormatItemFactory = {
combineConfig: function () { combineConfig: function () {
return { return {
"title": "", title: "",
"chartType": "column", chartType: "column",
"plotOptions": { plotOptions: {
"rotatable": false, rotatable: false,
"startAngle": 0, startAngle: 0,
"borderRadius": 0, borderRadius: 0,
"endAngle": 360, endAngle: 360,
"innerRadius": "0.0%", innerRadius: "0.0%",
"layout": "horizontal", layout: "horizontal",
"hinge": "rgb(101,107,109)", hinge: "rgb(101,107,109)",
"dataLabels": { dataLabels: {
"autoAdjust": true, autoAdjust: true,
"style": {"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"}, style: {fontFamily: "inherit", color: "inherit", fontSize: "12px"},
"formatter": { formatter: {
"identifier": "${VALUE}", identifier: "${VALUE}",
"valueFormat": this._contentFormat2Decimal, valueFormat: this._contentFormat2Decimal,
"seriesFormat": this._contentFormat, seriesFormat: this._contentFormat,
"percentFormat": this._contentFormatPercentage, percentFormat: this._contentFormatPercentage,
"categoryFormat": this._contentFormat, categoryFormat: this._contentFormat,
"XFormat": this._contentFormat2Decimal, XFormat: this._contentFormat2Decimal,
"YFormat": this._contentFormat2Decimal, YFormat: this._contentFormat2Decimal,
"sizeFormat": this._contentFormat2Decimal sizeFormat: this._contentFormat2Decimal
}, },
"align": "outside", align: "outside",
"enabled": false enabled: false
}, },
"percentageLabel": { percentageLabel: {
"formatter": { formatter: {
"identifier": "${PERCENT}", identifier: "${PERCENT}",
"valueFormat": this._contentFormat2Decimal, valueFormat: this._contentFormat2Decimal,
"seriesFormat": this._contentFormat, seriesFormat: this._contentFormat,
"percentFormat": this._contentFormatPercentage, percentFormat: this._contentFormatPercentage,
"categoryFormat": this._contentFormat categoryFormat: this._contentFormat
}, },
"style": { style: {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px" fontFamily: "inherit", color: "inherit", fontSize: "12px"
}, },
"align": "bottom", align: "bottom",
"enabled": true enabled: true
}, },
"valueLabel": { valueLabel: {
"formatter": { formatter: {
"identifier": "${SERIES}${VALUE}", identifier: "${SERIES}${VALUE}",
"valueFormat": this._contentFormat2Decimal, valueFormat: this._contentFormat2Decimal,
"seriesFormat": this._contentFormat, seriesFormat: this._contentFormat,
"percentFormat": this._contentFormatPercentage, percentFormat: this._contentFormatPercentage,
"categoryFormat": this._contentFormat categoryFormat: this._contentFormat
}, },
"backgroundColor": "rgb(255,255,0)", backgroundColor: "rgb(255,255,0)",
"style": { style: {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px" fontFamily: "inherit", color: "inherit", fontSize: "12px"
}, },
"align": "inside", align: "inside",
"enabled": true enabled: true
}, },
"hingeBackgroundColor": "rgb(220,242,249)", hingeBackgroundColor: "rgb(220,242,249)",
"seriesLabel": { seriesLabel: {
"formatter": { formatter: {
"identifier": "${CATEGORY}", identifier: "${CATEGORY}",
"valueFormat": this._contentFormat2Decimal, valueFormat: this._contentFormat2Decimal,
"seriesFormat": this._contentFormat, seriesFormat: this._contentFormat,
"percentFormat": this._contentFormatPercentage, percentFormat: this._contentFormatPercentage,
"categoryFormat": this._contentFormat categoryFormat: this._contentFormat
}, },
"style": { style: {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px" fontFamily: "inherit", color: "inherit", fontSize: "12px"
}, },
"align": "bottom", align: "bottom",
"enabled": true enabled: true
}, },
"paneBackgroundColor": "rgb(252,252,252)", paneBackgroundColor: "rgb(252,252,252)",
"needle": "rgb(229,113,90)", needle: "rgb(229,113,90)",
"large": false, large: false,
"connectNulls": false, connectNulls: false,
"shadow": true, shadow: true,
"curve": false, curve: false,
"sizeBy": "area", sizeBy: "area",
"tooltip": { tooltip: {
"formatter": { formatter: {
"identifier": "${SERIES}${X}${Y}${SIZE}{CATEGORY}${SERIES}${VALUE}", identifier: "${SERIES}${X}${Y}${SIZE}{CATEGORY}${SERIES}${VALUE}",
"valueFormat": this._contentFormat2Decimal, valueFormat: this._contentFormat2Decimal,
"seriesFormat": this._contentFormat, seriesFormat: this._contentFormat,
"percentFormat": this._contentFormatPercentage, percentFormat: this._contentFormatPercentage,
"categoryFormat": this._contentFormat, categoryFormat: this._contentFormat,
"XFormat": this._contentFormat2Decimal, XFormat: this._contentFormat2Decimal,
"sizeFormat": this._contentFormat2Decimal, sizeFormat: this._contentFormat2Decimal,
"YFormat": this._contentFormat2Decimal YFormat: this._contentFormat2Decimal
}, },
"shared": false, shared: false,
"padding": 5, padding: 5,
"backgroundColor": "rgba(0,0,0,0.4980392156862745)", backgroundColor: "rgba(0,0,0,0.4980392156862745)",
"borderColor": "rgb(0,0,0)", borderColor: "rgb(0,0,0)",
"shadow": false, shadow: false,
"borderRadius": 2, borderRadius: 2,
"borderWidth": 0, borderWidth: 0,
"follow": false, follow: false,
"enabled": true, enabled: true,
"animation": true, animation: true,
"style": { style: {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", fontFamily: "Microsoft YaHei, Hiragino Sans GB W3",
"color": "#c4c6c6", color: "#c4c6c6",
"fontSize": "12px", fontSize: "12px",
"fontWeight": "" fontWeight: ""
} }
}, },
"maxSize": 80, maxSize: 80,
"fillColorOpacity": 0.5, fillColorOpacity: 0.5,
"step": false, step: false,
"force": false, force: false,
"minSize": 15, minSize: 15,
"displayNegative": true, displayNegative: true,
"categoryGap": "16.0%", categoryGap: "16.0%",
"borderColor": "rgb(255,255,255)", borderColor: "rgb(255,255,255)",
"borderWidth": 1, borderWidth: 1,
"gap": "22.0%", gap: "22.0%",
"animation": true, animation: true,
"lineWidth": 2, lineWidth: 2,
"bubble": { bubble: {
"large": false, large: false,
"connectNulls": false, connectNulls: false,
"shadow": true, shadow: true,
"curve": false, curve: false,
"sizeBy": "area", sizeBy: "area",
"maxSize": 80, maxSize: 80,
"minSize": 15, minSize: 15,
"lineWidth": 0, lineWidth: 0,
"animation": true, animation: true,
"fillColorOpacity": 0.699999988079071, fillColorOpacity: 0.699999988079071,
"marker": { marker: {
"symbol": "circle", symbol: "circle",
"radius": 28.39695010101295, radius: 28.39695010101295,
"enabled": true enabled: true
} }
} }
}, },
"dTools": { dTools: {
"enabled": false, enabled: false,
"style": { style: {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3", fontFamily: "Microsoft YaHei, Hiragino Sans GB W3",
"color": "#1a1a1a", color: "#1a1a1a",
"fontSize": "12px" fontSize: "12px"
}, },
"backgroundColor": 'white' backgroundColor: "white"
}, },
"dataSheet": { dataSheet: {
"enabled": false, enabled: false,
"borderColor": "rgb(0,0,0)", borderColor: "rgb(0,0,0)",
"borderWidth": 1, borderWidth: 1,
"formatter": this._contentFormat2Decimal, formatter: this._contentFormat2Decimal,
"style": { style: {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px" fontFamily: "inherit", color: "inherit", fontSize: "12px"
} }
}, },
"borderColor": "rgb(238,238,238)", borderColor: "rgb(238,238,238)",
"shadow": false, shadow: false,
"legend": { legend: {
"borderColor": "rgb(204,204,204)", borderColor: "rgb(204,204,204)",
"borderRadius": 0, borderRadius: 0,
"shadow": false, shadow: false,
"borderWidth": 0, borderWidth: 0,
"visible": true, visible: true,
"style": { style: {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px" fontFamily: "inherit", color: "inherit", fontSize: "12px"
}, },
"position": "right", position: "right",
"enabled": false enabled: false
}, },
"rangeLegend": { rangeLegend: {
"range": { range: {
"min": 0, min: 0,
"color": [ color: [
[ [
0, 0,
"rgb(182,226,255)" "rgb(182,226,255)"
@ -252,40 +252,40 @@ BI.ChartCombineFormatItemFactory = {
"rgb(36,167,255)" "rgb(36,167,255)"
] ]
], ],
"max": 266393 max: 266393
}, },
"enabled": false enabled: false
}, },
"zoom": {"zoomType": "xy", "zoomTool": {"visible": false, "resize": true, "from": "", "to": ""}}, zoom: {zoomType: "xy", zoomTool: {visible: false, resize: true, from: "", to: ""}},
"plotBorderColor": "rgba(255,255,255,0)", plotBorderColor: "rgba(255,255,255,0)",
"tools": { tools: {
"hidden": false, hidden: false,
"toImage": {"enabled": false}, toImage: {enabled: false},
"sort": {"enabled": false}, sort: {enabled: false},
"fullScreen": {"enabled": false}, fullScreen: {enabled: false},
"refresh": { refresh: {
"enabled": false enabled: false
} }
}, },
"plotBorderWidth": 0, plotBorderWidth: 0,
"style": "normal", style: "normal",
"colors": ["rgb(99,178,238)", "rgb(118,218,145)"], colors: ["rgb(99,178,238)", "rgb(118,218,145)"],
"borderRadius": 0, borderRadius: 0,
"borderWidth": 0, borderWidth: 0,
"plotShadow": false, plotShadow: false,
"plotBorderRadius": 0 plotBorderRadius: 0
}; };
}, },
_contentFormat: function () { _contentFormat: function () {
return BI.contentFormat(arguments[0], '') return BI.contentFormat(arguments[0], "");
}, },
_contentFormat2Decimal: function () { _contentFormat2Decimal: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##') return BI.contentFormat(arguments[0], "#.##;-#.##");
}, },
_contentFormatPercentage: function () { _contentFormatPercentage: function () {
return BI.contentFormat(arguments[0], '#.##%;-#.##%') return BI.contentFormat(arguments[0], "#.##%;-#.##%");
} }
}; };

8
src/base/canvas/canvas.js

@ -10,14 +10,14 @@ BI.Canvas = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Canvas.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Canvas.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-canvas" baseCls: "bi-canvas"
}) });
}, },
_init: function () { _init: function () {
BI.Canvas.superclass._init.apply(this, arguments); BI.Canvas.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
if (!document.createElement('canvas').getContext) { if (!document.createElement("canvas").getContext) {
canvas = window.G_vmlCanvasManager.initElement(canvas); canvas = window.G_vmlCanvasManager.initElement(canvas);
} }
this.element.append(canvas); this.element.append(canvas);
@ -35,7 +35,7 @@ BI.Canvas = BI.inherit(BI.Widget, {
_getContext: function () { _getContext: function () {
if (!this.ctx) { if (!this.ctx) {
this.ctx = this.canvas.getContext('2d'); this.ctx = this.canvas.getContext("2d");
} }
return this.ctx; return this.ctx;
}, },
@ -119,7 +119,7 @@ BI.Canvas = BI.inherit(BI.Widget, {
stroke: function () { stroke: function () {
var ctx = this._getContext(); var ctx = this._getContext();
if(!ctx){ if(!ctx) {
return false; return false;
} }
BI.each(this._queue, function (i, q) { BI.each(this._queue, function (i, q) {

28
src/base/collection/collection.js

@ -100,7 +100,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
_cellRenderers: function (height, width, x, y) { _cellRenderers: function (height, width, x, y) {
this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y); this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y);
return this._cellGroupRenderer() return this._cellGroupRenderer();
}, },
_cellGroupRenderer: function () { _cellGroupRenderer: function () {
@ -122,13 +122,13 @@ BI.CollectionView = BI.inherit(BI.Widget, {
var right = Math.min(this._width, scrollLeft + o.width + o.horizontalOverscanSize); var right = Math.min(this._width, scrollLeft + o.width + o.horizontalOverscanSize);
var bottom = Math.min(this._height, scrollTop + o.height + o.verticalOverscanSize); var bottom = Math.min(this._height, scrollTop + o.height + o.verticalOverscanSize);
if (right > 0 && bottom > 0) { if (right > 0 && bottom > 0) {
//如果滚动的区间并没有超出渲染的范围 // 如果滚动的区间并没有超出渲染的范围
if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) { if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) {
return; return;
} }
var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top); var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top);
var renderedCells = [], renderedKeys = {}, renderedWidgets = {}; var renderedCells = [], renderedKeys = {}, renderedWidgets = {};
//存储所有的left和top // 存储所有的left和top
var lefts = {}, tops = {}; var lefts = {}, tops = {};
for (var i = 0, len = childrenToDisplay.length; i < len; i++) { for (var i = 0, len = childrenToDisplay.length; i < len; i++) {
var datum = childrenToDisplay[i]; var datum = childrenToDisplay[i];
@ -141,7 +141,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
tops = BI.toArray(tops); tops = BI.toArray(tops);
var leftMap = BI.invert(lefts); var leftMap = BI.invert(lefts);
var topMap = BI.invert(tops); var topMap = BI.invert(tops);
//存储上下左右四个边界 // 存储上下左右四个边界
var leftBorder = {}, rightBorder = {}, topBorder = {}, bottomBorder = {}; var leftBorder = {}, rightBorder = {}, topBorder = {}, bottomBorder = {};
var assertMinBorder = function (border, offset) { var assertMinBorder = function (border, offset) {
if (border[offset] == null) { if (border[offset] == null) {
@ -215,7 +215,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
renderedKeys[datum.index] = [datum.index, i]; renderedKeys[datum.index] = [datum.index, i];
renderedWidgets[i] = child; renderedWidgets[i] = child;
} }
//已存在的, 需要添加的和需要删除的 // 已存在的, 需要添加的和需要删除的
var existSet = {}, addSet = {}, deleteArray = []; var existSet = {}, addSet = {}, deleteArray = [];
BI.each(renderedKeys, function (i, key) { BI.each(renderedKeys, function (i, key) {
if (self.renderedKeys[i]) { if (self.renderedKeys[i]) {
@ -234,21 +234,21 @@ BI.CollectionView = BI.inherit(BI.Widget, {
deleteArray.push(key[1]); deleteArray.push(key[1]);
}); });
BI.each(deleteArray, function (i, index) { BI.each(deleteArray, function (i, index) {
//性能优化,不调用destroy方法防止触发destroy事件 // 性能优化,不调用destroy方法防止触发destroy事件
self.renderedCells[index].el._destroy(); self.renderedCells[index].el._destroy();
}); });
var addedItems = []; var addedItems = [];
BI.each(addSet, function (index, key) { BI.each(addSet, function (index, key) {
addedItems.push(renderedCells[key[1]]) addedItems.push(renderedCells[key[1]]);
}); });
this.container.addItems(addedItems); this.container.addItems(addedItems);
//拦截父子级关系 // 拦截父子级关系
this.container._children = renderedWidgets; this.container._children = renderedWidgets;
this.container.attr("items", renderedCells); this.container.attr("items", renderedCells);
this.renderedCells = renderedCells; this.renderedCells = renderedCells;
this.renderedKeys = renderedKeys; this.renderedKeys = renderedKeys;
//Todo 左右比较特殊 // Todo 左右比较特殊
var minX = BI.min(leftBorder); var minX = BI.min(leftBorder);
var maxX = BI.max(rightBorder); var maxX = BI.max(rightBorder);
@ -279,7 +279,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.container.setHeight(this._height); this.container.setHeight(this._height);
this._calculateChildrenToRender(); this._calculateChildrenToRender();
//元素未挂载时不能设置scrollTop // 元素未挂载时不能设置scrollTop
try { try {
this.element.scrollTop(o.scrollTop); this.element.scrollTop(o.scrollTop);
this.element.scrollLeft(o.scrollLeft); this.element.scrollLeft(o.scrollLeft);
@ -315,7 +315,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
if (this.options.overflowX !== !!b) { if (this.options.overflowX !== !!b) {
this.options.overflowX = !!b; this.options.overflowX = !!b;
BI.nextTick(function () { BI.nextTick(function () {
self.element.css({overflowX: !!b ? "auto" : "hidden"}); self.element.css({overflowX: b ? "auto" : "hidden"});
}); });
} }
}, },
@ -325,7 +325,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
if (this.options.overflowY !== !!b) { if (this.options.overflowY !== !!b) {
this.options.overflowY = !!b; this.options.overflowY = !!b;
BI.nextTick(function () { BI.nextTick(function () {
self.element.css({overflowY: !!b ? "auto" : "hidden"}); self.element.css({overflowY: b ? "auto" : "hidden"});
}); });
} }
}, },
@ -346,7 +346,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
return this._getMaxScrollTop(); return this._getMaxScrollTop();
}, },
//重新计算children // 重新计算children
_reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },
@ -375,4 +375,4 @@ BI.CollectionView = BI.inherit(BI.Widget, {
} }
}); });
BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL"; BI.CollectionView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut('bi.collection_view', BI.CollectionView); BI.shortcut("bi.collection_view", BI.CollectionView);

36
src/base/combination/combo.js

@ -9,24 +9,24 @@ BI.Combo = BI.inherit(BI.Widget, {
baseCls: (conf.baseCls || "") + " bi-combo", baseCls: (conf.baseCls || "") + " bi-combo",
trigger: "click", trigger: "click",
toggle: true, toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
container: null,//popupview放置的容器,默认为this.element container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false, isDefaultInit: false,
destroyWhenHide: false, destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整 isNeedAdjustHeight: true, // 是否需要高度调整
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
stopEvent: false, stopEvent: false,
stopPropagation: false, stopPropagation: false,
adjustLength: 0,//调整的距离 adjustLength: 0, // 调整的距离
adjustXOffset: 0, adjustXOffset: 0,
adjustYOffset: 0, adjustYOffset: 0,
hideChecker: BI.emptyFn, hideChecker: BI.emptyFn,
offsetStyle: "left", //left,right,center offsetStyle: "left", // left,right,center
el: {}, el: {},
popup: {}, popup: {},
comboClass: "bi-combo-popup", comboClass: "bi-combo-popup",
hoverClass: "bi-combo-hover" hoverClass: "bi-combo-hover"
}) });
}, },
_init: function () { _init: function () {
@ -108,7 +108,7 @@ BI.Combo = BI.inherit(BI.Widget, {
var enterPopup = false; var enterPopup = false;
function hide() { function hide () {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
@ -251,8 +251,8 @@ BI.Combo = BI.inherit(BI.Widget, {
// if (this.element.__isMouseInBounds__(e) || (this.popupView && this.popupView.element.__isMouseInBounds__(e))) { // if (this.element.__isMouseInBounds__(e) || (this.popupView && this.popupView.element.__isMouseInBounds__(e))) {
// return; // return;
// } // }
//BI-10290 公式combo双击公式内容会收起 // BI-10290 公式combo双击公式内容会收起
if (this.element.find(e.target).length > 0 || e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {//BI-9887 CodeMirror的公式弹框需要特殊处理下 if (this.element.find(e.target).length > 0 || e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下
return; return;
} }
var isHide = this.options.hideChecker.apply(this, [e]); var isHide = this.options.hideChecker.apply(this, [e]);
@ -319,31 +319,31 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (o.direction) { switch (o.direction) {
case "bottom": case "bottom":
case "bottom,right": case "bottom,right":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['bottom', 'top', 'right', 'left'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle);
break; break;
case "top": case "top":
case "top,right": case "top,right":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'right', 'left'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle);
break; break;
case "left": case "left":
case "left,bottom": case "left,bottom":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ['left', 'right', 'bottom', 'top'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle);
break; break;
case "right": case "right":
case "right,bottom": case "right,bottom":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ['right', 'left', 'bottom', 'top'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle);
break; break;
case "top,left": case "top,left":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['top', 'bottom', 'left', 'right'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle);
break; break;
case "bottom,left": case "bottom,left":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ['bottom', 'top', 'left', 'right'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle);
break; break;
case "left,top": case "left,top":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ['left', 'right', 'top', 'bottom'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle);
break; break;
case "right,top": case "right,top":
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ['right', 'left', 'top', 'bottom'], o.offsetStyle); p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
break; break;
case "top,custom": case "top,custom":
case "custom,top": case "custom,top":
@ -368,7 +368,7 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
if ("adaptHeight" in p) { if ("adaptHeight" in p) {
this.resetListHeight(p['adaptHeight']); this.resetListHeight(p["adaptHeight"]);
} }
if ("left" in p) { if ("left" in p) {
this.popupView.element.css({ this.popupView.element.css({

22
src/base/combination/expander.js

@ -12,13 +12,13 @@ BI.Expander = BI.inherit(BI.Widget, {
baseCls: "bi-expander", baseCls: "bi-expander",
trigger: "click", trigger: "click",
toggle: true, toggle: true,
//direction: "bottom", //top,bottom四个方向 // direction: "bottom", //top,bottom四个方向
isDefaultInit: false, //是否默认初始化子节点 isDefaultInit: false, // 是否默认初始化子节点
el: {}, el: {},
popup: {}, popup: {},
expanderClass: "bi-expander-popup", expanderClass: "bi-expander-popup",
hoverClass: "bi-expander-hover" hoverClass: "bi-expander-hover"
}) });
}, },
_init: function () { _init: function () {
@ -92,13 +92,13 @@ BI.Expander = BI.inherit(BI.Widget, {
self.element[e](function (e) { self.element[e](function (e) {
if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} }
}, function () { }, function () {
if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid() && o.toggle) { if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid() && o.toggle) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.fireEvent(BI.Expander.EVENT_COLLAPSE);
} }
}); });
@ -113,7 +113,7 @@ BI.Expander = BI.inherit(BI.Widget, {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND); self.fireEvent(BI.Expander.EVENT_EXPAND);
} else { } else {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.expander); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.expander);
self.fireEvent(BI.Expander.EVENT_COLLAPSE); self.fireEvent(BI.Expander.EVENT_COLLAPSE);
} }
} }
@ -122,7 +122,7 @@ BI.Expander = BI.inherit(BI.Widget, {
} }
break; break;
} }
}) });
}, },
_initExpander: function () { _initExpander: function () {
@ -144,7 +144,7 @@ BI.Expander = BI.inherit(BI.Widget, {
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
//self.setValue(self.getValue()); // self.setValue(self.getValue());
self.fireEvent(BI.Expander.EVENT_CHANGE, value, obj); self.fireEvent(BI.Expander.EVENT_CHANGE, value, obj);
} }
}); });
@ -191,7 +191,7 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
populate: function (items) { populate: function (items) {
//this._assertPopupView(); // this._assertPopupView();
this.popupView && this.popupView.populate.apply(this.popupView, arguments); this.popupView && this.popupView.populate.apply(this.popupView, arguments);
this.expander.populate.apply(this.expander, arguments); this.expander.populate.apply(this.expander, arguments);
}, },
@ -203,13 +203,13 @@ BI.Expander = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
//this._assertPopupView(); // this._assertPopupView();
this.expander.setValue(v); this.expander.setValue(v);
this.popupView && this.popupView.setValue(v); this.popupView && this.popupView.setValue(v);
}, },
getValue: function () { getValue: function () {
//this._assertPopupView(); // this._assertPopupView();
return this.popupView ? this.popupView.getValue() : []; return this.popupView ? this.popupView.getValue() : [];
}, },

22
src/base/combination/group.button.js

@ -16,7 +16,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }]
}) });
}, },
_init: function () { _init: function () {
@ -25,7 +25,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
BI.each(this.options.behaviors, function (key, rule) { BI.each(this.options.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, { behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule rule: rule
}) });
}); });
this.behaviors = behaviors; this.behaviors = behaviors;
this.populate(this.options.items); this.populate(this.options.items);
@ -65,7 +65,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}); });
btn.on(BI.Events.DESTROY, function () { btn.on(BI.Events.DESTROY, function () {
BI.remove(self.buttons, btn); BI.remove(self.buttons, btn);
}) });
}); });
return buttons; return buttons;
@ -81,8 +81,8 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
el: it el: it
}) })
] ]
}) });
}) });
} }
return btns; return btns;
}, },
@ -95,8 +95,8 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
} }
return BI.extend({}, item, { return BI.extend({}, item, {
el: btns[i] el: btns[i]
}) });
}) });
}, },
_packageItems: function (items, packBtns) { _packageItems: function (items, packBtns) {
@ -114,10 +114,10 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout; return layout;
}, },
//如果是一个简单的layout // 如果是一个简单的layout
_isSimpleLayout: function () { _isSimpleLayout: function () {
var o = this.options; var o = this.options;
return o.layouts.length === 1 && !BI.isArray(o.items[0]) return o.layouts.length === 1 && !BI.isArray(o.items[0]);
}, },
doBehavior: function () { doBehavior: function () {
@ -125,7 +125,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
args.unshift(this.buttons); args.unshift(this.buttons);
BI.each(this.behaviors, function (i, behavior) { BI.each(this.behaviors, function (i, behavior) {
behavior.doBehavior.apply(behavior, args); behavior.doBehavior.apply(behavior, args);
}) });
}, },
prependItems: function (items) { prependItems: function (items) {
@ -147,7 +147,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments); var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(this.buttons, btns); this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout // 如果是一个简单的layout
if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) { if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns); this.layouts.addItems(btns);
return; return;

10
src/base/combination/group.combo.js

@ -7,7 +7,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
return BI.extend(BI.ComboGroup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ComboGroup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-combo-group bi-list-item", baseCls: "bi-combo-group bi-list-item",
//以下这些属性对每一个combo都是公用的 // 以下这些属性对每一个combo都是公用的
trigger: "click,hover", trigger: "click,hover",
direction: "right", direction: "right",
adjustLength: 0, adjustLength: 0,
@ -27,7 +27,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
}] }]
} }
} }
}) });
}, },
_init: function () { _init: function () {
@ -57,7 +57,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
ch.adjustLength = o.adjustLength; ch.adjustLength = o.adjustLength;
ch.popup = o.popup; ch.popup = o.popup;
} }
}) });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this, element: this,
@ -74,13 +74,13 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
items: children items: children
}, o.popup.el) }, o.popup.el)
}) })
}) });
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.fireEvent(BI.ComboGroup.EVENT_CHANGE, obj); self.fireEvent(BI.ComboGroup.EVENT_CHANGE, obj);
} }
}) });
}, },
getValue: function () { getValue: function () {

6
src/base/combination/group.virtual.js

@ -8,7 +8,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
hgap: 0, hgap: 0,
vgap: 0 vgap: 0
}] }]
}) });
}, },
render: function () { render: function () {
@ -26,8 +26,8 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
el: BI.stripEL(it) el: BI.stripEL(it)
}) })
] ]
}) });
}) });
} }
return items; return items;
}, },

14
src/base/combination/loader.js

@ -11,13 +11,13 @@ BI.Loader = BI.inherit(BI.Widget, {
baseCls: "bi-loader", baseCls: "bi-loader",
direction: "top", direction: "top",
isDefaultInit: true,//是否默认初始化数据 isDefaultInit: true, // 是否默认初始化数据
logic: { logic: {
dynamic: true, dynamic: true,
scrolly: true scrolly: true
}, },
//下面是button_group的属性 // 下面是button_group的属性
el: { el: {
type: "bi.button_group" type: "bi.button_group"
}, },
@ -26,13 +26,13 @@ BI.Loader = BI.inherit(BI.Widget, {
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
onLoaded: BI.emptyFn, onLoaded: BI.emptyFn,
//下面是分页信息 // 下面是分页信息
count: false, count: false,
prev: false, prev: false,
next: {}, next: {},
hasPrev: BI.emptyFn, hasPrev: BI.emptyFn,
hasNext: BI.emptyFn hasNext: BI.emptyFn
}) });
}, },
_prevLoad: function () { _prevLoad: function () {
@ -95,7 +95,7 @@ BI.Loader = BI.inherit(BI.Widget, {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self._nextLoad(); self._nextLoad();
} }
}) });
} }
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
@ -122,7 +122,7 @@ BI.Loader = BI.inherit(BI.Widget, {
return !!o.hasPrev.apply(this, [{ return !!o.hasPrev.apply(this, [{
times: this.times, times: this.times,
count: this.count count: this.count
}]) }]);
}, },
hasNext: function () { hasNext: function () {
@ -133,7 +133,7 @@ BI.Loader = BI.inherit(BI.Widget, {
return !!o.hasNext.apply(this, [{ return !!o.hasNext.apply(this, [{
times: this.times, times: this.times,
count: this.count count: this.count
}]) }]);
}, },
prependItems: function (items) { prependItems: function (items) {

4
src/base/combination/navigation.js

@ -5,7 +5,7 @@
BI.Navigation = BI.inherit(BI.Widget, { BI.Navigation = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this, arguments), {
direction: "bottom",//top, bottom, left, right, custom direction: "bottom", // top, bottom, left, right, custom
logic: { logic: {
dynamic: false dynamic: false
}, },
@ -18,7 +18,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.emptyFn, afterCardCreated: BI.emptyFn,
afterCardShow: BI.emptyFn afterCardShow: BI.emptyFn
}) });
}, },
render: function () { render: function () {

24
src/base/combination/searcher.js

@ -18,13 +18,13 @@ BI.Searcher = BI.inherit(BI.Widget, {
hgap: 0, hgap: 0,
isDefaultInit: false, isDefaultInit: false,
isAutoSearch: true, //是否自动搜索 isAutoSearch: true, // 是否自动搜索
isAutoSync: true, //是否自动同步数据, 即是否保持搜索面板和adapter面板状态值的统一 isAutoSync: true, // 是否自动同步数据, 即是否保持搜索面板和adapter面板状态值的统一
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
//isAutoSearch为false时启用 // isAutoSearch为false时启用
onSearch: function (op, callback) { onSearch: function (op, callback) {
callback([]) callback([]);
}, },
el: { el: {
@ -36,10 +36,10 @@ BI.Searcher = BI.inherit(BI.Widget, {
}, },
adapter: null, adapter: null,
masker: { //masker层 masker: { // masker层
offset: {} offset: {}
} }
}) });
}, },
_init: function () { _init: function () {
@ -79,7 +79,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
self._pauseSearch(); self._pauseSearch();
break; break;
} }
}) });
}, },
_assertPopupView: function () { _assertPopupView: function () {
@ -129,7 +129,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
this._isSearching = true; this._isSearching = true;
this.fireEvent(BI.Searcher.EVENT_START); this.fireEvent(BI.Searcher.EVENT_START);
this.popupView.startSearch && this.popupView.startSearch(); this.popupView.startSearch && this.popupView.startSearch();
//搜索前先清空dom // 搜索前先清空dom
// BI.Maskers.get(this.getName()).empty(); // BI.Maskers.get(this.getName()).empty();
BI.nextTick(function (name) { BI.nextTick(function (name) {
BI.Maskers.show(name); BI.Maskers.show(name);
@ -206,8 +206,8 @@ BI.Searcher = BI.inherit(BI.Widget, {
}, },
stopSearch: function () { stopSearch: function () {
this._stopSearch();//先停止搜索,然后再去设置editor为空 this._stopSearch();// 先停止搜索,然后再去设置editor为空
//important:停止搜索必须退出编辑状态,这里必须加上try(input框不显示时blur会抛异常) // important:停止搜索必须退出编辑状态,这里必须加上try(input框不显示时blur会抛异常)
try { try {
this.editor.blur(); this.editor.blur();
} catch (e) { } catch (e) {
@ -268,9 +268,9 @@ BI.Searcher = BI.inherit(BI.Widget, {
return this.popupView.getValue(); return this.popupView.getValue();
} else if (o.adapter && o.adapter.getValue) { } else if (o.adapter && o.adapter.getValue) {
return o.adapter.getValue(); return o.adapter.getValue();
} else {
return this.popupView.getValue();
} }
return this.popupView.getValue();
}, },
populate: function (result, searchResult, keyword) { populate: function (result, searchResult, keyword) {

12
src/base/combination/switcher.js

@ -19,7 +19,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
masker: {}, masker: {},
switcherClass: "bi-switcher-popup", switcherClass: "bi-switcher-popup",
hoverClass: "bi-switcher-hover" hoverClass: "bi-switcher-hover"
}) });
}, },
_init: function () { _init: function () {
@ -89,13 +89,13 @@ BI.Switcher = BI.inherit(BI.Widget, {
self.element[e](function (e) { self.element[e](function (e) {
if (self.isEnabled() && self.switcher.isEnabled()) { if (self.isEnabled() && self.switcher.isEnabled()) {
self._popupView(); self._popupView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.switcher); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.switcher);
self.fireEvent(BI.Switcher.EVENT_EXPAND); self.fireEvent(BI.Switcher.EVENT_EXPAND);
} }
}, function () { }, function () {
if (self.isEnabled() && self.switcher.isEnabled() && o.toggle) { if (self.isEnabled() && self.switcher.isEnabled() && o.toggle) {
self._hideView(); self._hideView();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.switcher); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.switcher);
self.fireEvent(BI.Switcher.EVENT_COLLAPSE); self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
} }
}); });
@ -107,10 +107,10 @@ BI.Switcher = BI.inherit(BI.Widget, {
if (self.isEnabled() && self.switcher.isEnabled()) { if (self.isEnabled() && self.switcher.isEnabled()) {
o.toggle ? self._toggle() : self._popupView(); o.toggle ? self._toggle() : self._popupView();
if (self.isExpanded()) { if (self.isExpanded()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, '', self.switcher); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.switcher);
self.fireEvent(BI.Switcher.EVENT_EXPAND); self.fireEvent(BI.Switcher.EVENT_EXPAND);
} else { } else {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, '', self.switcher); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.switcher);
self.fireEvent(BI.Switcher.EVENT_COLLAPSE); self.fireEvent(BI.Switcher.EVENT_COLLAPSE);
} }
} }
@ -119,7 +119,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
} }
break; break;
} }
}) });
}, },
_initSwitcher: function () { _initSwitcher: function () {

8
src/base/combination/tab.js

@ -6,8 +6,8 @@ BI.Tab = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Tab.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Tab.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tab", baseCls: "bi-tab",
direction: "top",//top, bottom, left, right, custom direction: "top", // top, bottom, left, right, custom
single: false, //是不是单页面 single: false, // 是不是单页面
logic: { logic: {
dynamic: false dynamic: false
}, },
@ -16,7 +16,7 @@ BI.Tab = BI.inherit(BI.Widget, {
cardCreator: function (v) { cardCreator: function (v) {
return BI.createWidget(); return BI.createWidget();
} }
}) });
}, },
render: function () { render: function () {
@ -25,7 +25,7 @@ BI.Tab = BI.inherit(BI.Widget, {
this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"}); this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"});
this.tab.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.tab.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}) });
} }
this.cardMap = {}; this.cardMap = {};
this.layout = BI.createWidget({ this.layout = BI.createWidget({

4
src/base/combination/tree.button.js

@ -8,7 +8,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.ButtonTree.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.ButtonTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-button-tree" baseCls: "bi-button-tree"
}) });
}, },
_init: function () { _init: function () {
@ -116,7 +116,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
return btns; return btns;
}, },
//获取所有的叶子节点 // 获取所有的叶子节点
getAllLeaves: function () { getAllLeaves: function () {
var leaves = []; var leaves = [];
BI.each(this.buttons, function (i, item) { BI.each(this.buttons, function (i, item) {

4
src/base/el.js

@ -24,7 +24,7 @@ BI.EL = BI.inherit(BI.Widget, {
}); });
this.ele.on(BI.Controller.EVENT_CHANGE, function () { this.ele.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}) });
}, },
setValue: function (v) { setValue: function (v) {
@ -39,4 +39,4 @@ BI.EL = BI.inherit(BI.Widget, {
this.ele.populate.apply(this, arguments); this.ele.populate.apply(this, arguments);
} }
}); });
BI.shortcut('bi.el', BI.EL); BI.shortcut("bi.el", BI.EL);

17050
src/base/formula/codemirror/codemirror.js

File diff suppressed because it is too large Load Diff

16
src/base/formula/codemirror/formula-hint.js

@ -3,11 +3,11 @@
})(function (CodeMirror) { })(function (CodeMirror) {
var Pos = CodeMirror.Pos; var Pos = CodeMirror.Pos;
function forEach(arr, f) { function forEach (arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
} }
function arrayContains(arr, item) { function arrayContains (arr, item) {
if (!Array.prototype.indexOf) { if (!Array.prototype.indexOf) {
var i = arr.length; var i = arr.length;
while (i--) { while (i--) {
@ -20,7 +20,7 @@
return arr.indexOf(item) != -1; return arr.indexOf(item) != -1;
} }
function scriptHint(editor, keywords, getToken, options) { function scriptHint (editor, keywords, getToken, options) {
// Find the token at the cursor // Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur); var cur = editor.getCursor(), token = getToken(editor, cur);
if (/\b(?:string)\b/.test(token.type)) { if (/\b(?:string)\b/.test(token.type)) {
@ -54,25 +54,25 @@
}; };
} }
function getFormulaKeywords() { function getFormulaKeywords () {
return BI.FormulaCollections; return BI.FormulaCollections;
} }
function formulaHint(editor, options) { function formulaHint (editor, options) {
return scriptHint(editor, getFormulaKeywords(), return scriptHint(editor, getFormulaKeywords(),
function (e, cur) { function (e, cur) {
return e.getTokenAt(cur); return e.getTokenAt(cur);
}, },
options); options);
}; }
CodeMirror.registerHelper("hint", "formula", formulaHint); CodeMirror.registerHelper("hint", "formula", formulaHint);
function getCompletions(token, context, keywords, options) { function getCompletions (token, context, keywords, options) {
var found = [], start = token.string; var found = [], start = token.string;
if (!start) { if (!start) {
return found; return found;
} }
function maybeAdd(str) { function maybeAdd (str) {
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) { if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) {
found.push(str); found.push(str);
} }

26
src/base/formula/codemirror/formula-mode.js

@ -3,44 +3,44 @@
})(function (CodeMirror) { })(function (CodeMirror) {
"use strict"; "use strict";
CodeMirror.defineMode('formula', function () { CodeMirror.defineMode("formula", function () {
function wordObj(words) { function wordObj (words) {
var o = {}; var o = {};
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
return o; return o;
} }
var atoms = wordObj(['false', 'true']); var atoms = wordObj(["false", "true"]);
var keywords = wordObj(BI.FormulaCollections); var keywords = wordObj(BI.FormulaCollections);
function tokenBase(stream, state) { function tokenBase (stream, state) {
if (stream.eatSpace()) { if (stream.eatSpace()) {
return null; return null;
} }
var ch = stream.next(); var ch = stream.next();
if (ch === '"' || ch === '\'') { if (ch === "\"" || ch === "'") {
nextUntilUnescaped(stream, ch); nextUntilUnescaped(stream, ch);
return "string"; return "string";
} }
if (ch === '\u200b') { if (ch === "\u200b") {
nextUntilUnescaped(stream, ch); nextUntilUnescaped(stream, ch);
return "field"; return "field";
} }
if (/[\[\],\(\)]/.test(ch)) { if (/[\[\],\(\)]/.test(ch)) {
return 'bracket'; return "bracket";
} }
// richie:暂时不需要解析操作符号 // richie:暂时不需要解析操作符号
//if (/[+\-*\/=<>!&|]/.test(ch)) { // if (/[+\-*\/=<>!&|]/.test(ch)) {
// return 'operator'; // return 'operator';
//} // }
//if (/\d|\d./.test(ch)) { // if (/\d|\d./.test(ch)) {
// stream.eatWhile(/\d|\./); // stream.eatWhile(/\d|\./);
// if (stream.eol() || !/\w/.test(stream.peek())) { // if (stream.eol() || !/\w/.test(stream.peek())) {
// return 'number'; // return 'number';
// } // }
//} // }
@ -55,7 +55,7 @@
return null; return null;
} }
function nextUntilUnescaped(stream, end) { function nextUntilUnescaped (stream, end) {
var escaped = false, next; var escaped = false, next;
while ((next = stream.next()) != null) { while ((next = stream.next()) != null) {
if (next === end && !escaped) { if (next === end && !escaped) {
@ -66,7 +66,7 @@
return escaped; return escaped;
} }
function tokenize(stream, state) { function tokenize (stream, state) {
return (state.tokens[0] || tokenBase)(stream, state); return (state.tokens[0] || tokenBase)(stream, state);
} }

99
src/base/formula/codemirror/show-hint.js

@ -31,7 +31,7 @@
completion.update(true); completion.update(true);
}); });
function Completion(cm, options) { function Completion (cm, options) {
this.cm = cm; this.cm = cm;
this.options = this.buildOptions(options); this.options = this.buildOptions(options);
this.widget = null; this.widget = null;
@ -47,8 +47,8 @@
} }
var requestAnimationFrame = window.requestAnimationFrame || function (fn) { var requestAnimationFrame = window.requestAnimationFrame || function (fn) {
return setTimeout(fn, 1000 / 60); return setTimeout(fn, 1000 / 60);
}; };
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
Completion.prototype = { Completion.prototype = {
@ -73,16 +73,16 @@
else { else {
this.cm.replaceRange(getText(completion), completion.from || data.from, this.cm.replaceRange(getText(completion), completion.from || data.from,
completion.to || data.to, "complete"); completion.to || data.to, "complete");
if(completion.isKeyword === true){ if(completion.isKeyword === true) {
}else{ }else{
var to = this.cm.getCursor(); var to = this.cm.getCursor();
this.cm.markText(completion.from || data.from, to, {className: "#function", atomic: true}); this.cm.markText(completion.from || data.from, to, {className: "#function", atomic: true});
this.cm.replaceSelection("() "); this.cm.replaceSelection("() ");
to = this.cm.getCursor(); to = this.cm.getCursor();
to.ch = to.ch - 2; to.ch = to.ch - 2;
this.cm.setCursor(to); this.cm.setCursor(to);
this.cm.focus(); this.cm.focus();
} }
} }
CodeMirror.signal(data, "pick", completion); CodeMirror.signal(data, "pick", completion);
this.close(); this.close();
@ -140,20 +140,22 @@
var editor = this.cm.options.hintOptions; var editor = this.cm.options.hintOptions;
var out = {}; var out = {};
for (var prop in defaultOptions) out[prop] = defaultOptions[prop]; for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
if (editor) for (var prop in editor) if (editor) {
if (editor[prop] !== undefined) out[prop] = editor[prop]; for (var prop in editor) {if (editor[prop] !== undefined) out[prop] = editor[prop];}
if (options) for (var prop in options) }
if (options[prop] !== undefined) out[prop] = options[prop]; if (options) {
for (var prop in options) {if (options[prop] !== undefined) out[prop] = options[prop];}
}
return out; return out;
} }
}; };
function getText(completion) { function getText (completion) {
if (typeof completion == "string") return completion; if (typeof completion === "string") return completion;
else return completion.text; return completion.text;
} }
function buildKeyMap(completion, handle) { function buildKeyMap (completion, handle) {
var baseMap = { var baseMap = {
Up: function () { Up: function () {
handle.moveFocus(-1); handle.moveFocus(-1);
@ -180,38 +182,40 @@
var custom = completion.options.customKeys; var custom = completion.options.customKeys;
var ourMap = custom ? {} : baseMap; var ourMap = custom ? {} : baseMap;
function addBinding(key, val) { function addBinding (key, val) {
var bound; var bound;
if (typeof val != "string") if (typeof val !== "string") {
bound = function (cm) { bound = function (cm) {
return val(cm, handle); return val(cm, handle);
}; };
}
// This mechanism is deprecated // This mechanism is deprecated
else if (baseMap.hasOwnProperty(val)) else if (baseMap.hasOwnProperty(val)) {bound = baseMap[val];} else {bound = val;}
bound = baseMap[val];
else
bound = val;
ourMap[key] = bound; ourMap[key] = bound;
} }
if (custom) if (custom) {
for (var key in custom) if (custom.hasOwnProperty(key)) for (var key in custom) {
addBinding(key, custom[key]); if (custom.hasOwnProperty(key)) {addBinding(key, custom[key]);}
}
}
var extra = completion.options.extraKeys; var extra = completion.options.extraKeys;
if (extra) if (extra) {
for (var key in extra) if (extra.hasOwnProperty(key)) for (var key in extra) {
addBinding(key, extra[key]); if (extra.hasOwnProperty(key)) {addBinding(key, extra[key]);}
}
}
return ourMap; return ourMap;
} }
function getHintElement(hintsElement, el) { function getHintElement (hintsElement, el) {
while (el && el != hintsElement) { while (el && el != hintsElement) {
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el; if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
el = el.parentNode; el = el.parentNode;
} }
} }
function Widget(completion, data) { function Widget (completion, data) {
this.completion = completion; this.completion = completion;
this.data = data; this.data = data;
this.picked = false; this.picked = false;
@ -366,19 +370,13 @@
}, },
changeActive: function (i, avoidWrap) { changeActive: function (i, avoidWrap) {
if (i >= this.data.list.length) if (i >= this.data.list.length) {i = avoidWrap ? this.data.list.length - 1 : 0;} else if (i < 0) {i = avoidWrap ? 0 : this.data.list.length - 1;}
i = avoidWrap ? this.data.list.length - 1 : 0;
else if (i < 0)
i = avoidWrap ? 0 : this.data.list.length - 1;
if (this.selectedHint == i) return; if (this.selectedHint == i) return;
var node = this.hints.childNodes[this.selectedHint]; var node = this.hints.childNodes[this.selectedHint];
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
node = this.hints.childNodes[this.selectedHint = i]; node = this.hints.childNodes[this.selectedHint = i];
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
if (node.offsetTop < this.hints.scrollTop) if (node.offsetTop < this.hints.scrollTop) {this.hints.scrollTop = node.offsetTop - 3;} else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) {this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;}
this.hints.scrollTop = node.offsetTop - 3;
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
}, },
@ -406,15 +404,16 @@
var found = []; var found = [];
for (var i = 0; i < options.words.length; i++) { for (var i = 0; i < options.words.length; i++) {
var word = options.words[i]; var word = options.words[i];
if (word.slice(0, token.string.length) == token.string) if (word.slice(0, token.string.length) == token.string) {found.push(word);}
found.push(word);
} }
if (found.length) return { if (found.length) {
list: found, return {
from: CodeMirror.Pos(cur.line, token.start), list: found,
to: CodeMirror.Pos(cur.line, token.end) from: CodeMirror.Pos(cur.line, token.start),
}; to: CodeMirror.Pos(cur.line, token.end)
};
}
}); });
CodeMirror.commands.autocomplete = CodeMirror.showHint; CodeMirror.commands.autocomplete = CodeMirror.showHint;

4
src/base/formula/config.js

File diff suppressed because one or more lines are too long

20
src/base/formula/formulaeditor.js

@ -6,9 +6,9 @@
BI.FormulaEditor = BI.inherit(BI.Single, { BI.FormulaEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
return $.extend(BI.FormulaEditor.superclass._defaultConfig.apply(), { return $.extend(BI.FormulaEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-formula-editor bi-card', baseCls: "bi-formula-editor bi-card",
watermark: '', watermark: "",
value: '', value: "",
fieldTextValueMap: {}, fieldTextValueMap: {},
showHint: true, showHint: true,
lineHeight: 2 lineHeight: 2
@ -21,8 +21,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
textWrapping: true, textWrapping: true,
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
mode: 'formula', mode: "formula",
//解决插入字段由括号或其他特殊字符包围时分裂的bug // 解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
@ -32,7 +32,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
CodeMirror.showHint(cm, CodeMirror.formulaHint, {completeSingle: false}); CodeMirror.showHint(cm, CodeMirror.formulaHint, {completeSingle: false});
} }
BI.nextTick(function () { BI.nextTick(function () {
self.fireEvent(BI.FormulaEditor.EVENT_CHANGE) self.fireEvent(BI.FormulaEditor.EVENT_CHANGE);
}); });
}); });
@ -114,10 +114,10 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
*/ */
insertField: function (field) { insertField: function (field) {
var from = this.editor.getCursor(); var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下 // 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + field + '\u200b'); this.editor.replaceSelection("\u200b" + field + "\u200b");
var to = this.editor.getCursor(); var to = this.editor.getCursor();
this.editor.markText(from, to, {className: 'fieldName', atomic: true, startStyle: "start", endStyle: "end"}); this.editor.markText(from, to, {className: "fieldName", atomic: true, startStyle: "start", endStyle: "end"});
this.editor.replaceSelection(" "); this.editor.replaceSelection(" ");
this.editor.focus(); this.editor.focus();
}, },
@ -166,7 +166,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
_.forEach(line.markedSpans, function (i, ms) { _.forEach(line.markedSpans, function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "fieldName": case "fieldName":
//因为插入字段的时候首尾加了不可见字符,所以首尾缩进一个字符 // 因为插入字段的时候首尾加了不可见字符,所以首尾缩进一个字符
var dId = fieldMap[value.substr(i.from + 1, i.to - i.from - 2)]; var dId = fieldMap[value.substr(i.from + 1, i.to - i.from - 2)];
if (!fields.contains(dId)) { if (!fields.contains(dId)) {
fields.push(dId); fields.push(dId);

56
src/base/foundation/message.js

@ -43,28 +43,28 @@ $.extend(BI, {
BI.delay(function () { BI.delay(function () {
toast.element.slideUp(500, function () { toast.element.slideUp(500, function () {
toast.destroy(); toast.destroy();
}) });
}, 5000) }, 5000);
}) });
}, },
_show: function (hasCancel, title, message, callback) { _show: function (hasCancel, title, message, callback) {
$mask = $('<div class="bi-z-index-mask">').css({ $mask = $("<div class=\"bi-z-index-mask\">").css({
position: 'absolute', position: "absolute",
'zIndex': BI.zIndex_tip - 2, zIndex: BI.zIndex_tip - 2,
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,
opacity: 0.5 opacity: 0.5
}).appendTo('body'); }).appendTo("body");
$pop = $('<div class="bi-message-depend">').css({ $pop = $("<div class=\"bi-message-depend\">").css({
position: 'absolute', position: "absolute",
'zIndex': BI.zIndex_tip - 1, zIndex: BI.zIndex_tip - 1,
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 0 bottom: 0
}).appendTo('body'); }).appendTo("body");
var close = function () { var close = function () {
messageShow.destroy(); messageShow.destroy();
$mask.remove(); $mask.remove();
@ -73,10 +73,10 @@ $.extend(BI, {
if (hasCancel === true) { if (hasCancel === true) {
controlItems.push({ controlItems.push({
el: { el: {
type: 'bi.button', type: "bi.button",
text: BI.i18nText("BI-Basic_Cancel"), text: BI.i18nText("BI-Basic_Cancel"),
height: 30, height: 30,
level: 'ignore', level: "ignore",
handler: function () { handler: function () {
close(); close();
if (BI.isFunction(callback)) { if (BI.isFunction(callback)) {
@ -88,7 +88,7 @@ $.extend(BI, {
} }
controlItems.push({ controlItems.push({
el: { el: {
type: 'bi.button', type: "bi.button",
text: BI.i18nText("BI-Basic_OK"), text: BI.i18nText("BI-Basic_OK"),
height: 30, height: 30,
handler: function () { handler: function () {
@ -101,31 +101,31 @@ $.extend(BI, {
}); });
var conf = { var conf = {
element: $pop, element: $pop,
type: 'bi.center_adapt', type: "bi.center_adapt",
items: [ items: [
{ {
type: 'bi.border', type: "bi.border",
cls: 'bi-message-content bi-card', cls: "bi-message-content bi-card",
items: { items: {
'north': { north: {
el: { el: {
type: 'bi.border', type: "bi.border",
cls: 'bi-message-title bi-background', cls: "bi-message-title bi-background",
items: { items: {
center: { center: {
el: { el: {
type: 'bi.label', type: "bi.label",
text: title || BI.i18nText("BI-Basic_Prompt"), text: title || BI.i18nText("BI-Basic_Prompt"),
textAlign: 'left', textAlign: "left",
hgap: 20, hgap: 20,
height: 50 height: 50
} }
}, },
east: { east: {
el: { el: {
type: 'bi.icon_button', type: "bi.icon_button",
cls: 'bi-message-close close-font', cls: "bi-message-close close-font",
// height: 50, // height: 50,
handler: function () { handler: function () {
close(); close();
} }
@ -136,7 +136,7 @@ $.extend(BI, {
}, },
height: 50 height: 50
}, },
'center': { center: {
el: { el: {
type: "bi.text", type: "bi.text",
cls: "bi-message-text", cls: "bi-message-text",
@ -147,12 +147,12 @@ $.extend(BI, {
text: message text: message
} }
}, },
'south': { south: {
el: { el: {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
type: 'bi.right_vertical_adapt', type: "bi.right_vertical_adapt",
hgap: 5, hgap: 5,
items: controlItems items: controlItems
}, },

34
src/base/grid/grid.js

@ -15,8 +15,8 @@ BI.GridView = BI.inherit(BI.Widget, {
overflowY: true, overflowY: true,
overscanColumnCount: 0, overscanColumnCount: 0,
overscanRowCount: 0, overscanRowCount: 0,
rowHeightGetter: BI.emptyFn, //number类型或function类型 rowHeightGetter: BI.emptyFn, // number类型或function类型
columnWidthGetter: BI.emptyFn, //number类型或function类型 columnWidthGetter: BI.emptyFn, // number类型或function类型
// estimatedColumnSize: 100, //columnWidthGetter为function时必设 // estimatedColumnSize: 100, //columnWidthGetter为function时必设
// estimatedRowSize: 30, //rowHeightGetter为function时必设 // estimatedRowSize: 30, //rowHeightGetter为function时必设
scrollLeft: 0, scrollLeft: 0,
@ -73,7 +73,7 @@ BI.GridView = BI.inherit(BI.Widget, {
return { return {
overscanStartIndex: Math.max(0, startIndex - overscanCellsCount), overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount) overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
} };
}, },
_calculateChildrenToRender: function () { _calculateChildrenToRender: function () {
@ -98,7 +98,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this._renderedRowStartIndex = visibleRowIndices.start; this._renderedRowStartIndex = visibleRowIndices.start;
this._renderedRowStopIndex = visibleRowIndices.stop; this._renderedRowStopIndex = visibleRowIndices.stop;
var overscanColumnIndices = this._getOverscanIndices(this.columnCount, overscanColumnCount, this._renderedColumnStartIndex, this._renderedColumnStopIndex) var overscanColumnIndices = this._getOverscanIndices(this.columnCount, overscanColumnCount, this._renderedColumnStartIndex, this._renderedColumnStopIndex);
var overscanRowIndices = this._getOverscanIndices(this.rowCount, overscanRowCount, this._renderedRowStartIndex, this._renderedRowStopIndex); var overscanRowIndices = this._getOverscanIndices(this.rowCount, overscanRowCount, this._renderedRowStartIndex, this._renderedRowStopIndex);
@ -107,7 +107,7 @@ BI.GridView = BI.inherit(BI.Widget, {
var rowStartIndex = overscanRowIndices.overscanStartIndex; var rowStartIndex = overscanRowIndices.overscanStartIndex;
var rowStopIndex = overscanRowIndices.overscanStopIndex; var rowStopIndex = overscanRowIndices.overscanStopIndex;
//算区间size // 算区间size
var minRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStartIndex); var minRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStartIndex);
var minColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStartIndex); var minColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStartIndex);
var maxRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStopIndex); var maxRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStopIndex);
@ -116,7 +116,7 @@ BI.GridView = BI.inherit(BI.Widget, {
var left = minColumnDatum.offset + horizontalOffsetAdjustment; var left = minColumnDatum.offset + horizontalOffsetAdjustment;
var bottom = maxRowDatum.offset + verticalOffsetAdjustment + maxRowDatum.size; var bottom = maxRowDatum.offset + verticalOffsetAdjustment + maxRowDatum.size;
var right = maxColumnDatum.offset + horizontalOffsetAdjustment + maxColumnDatum.size; var right = maxColumnDatum.offset + horizontalOffsetAdjustment + maxColumnDatum.size;
//如果滚动的区间并没有超出渲染的范围 // 如果滚动的区间并没有超出渲染的范围
if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) { if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) {
return; return;
} }
@ -180,7 +180,7 @@ BI.GridView = BI.inherit(BI.Widget, {
count++; count++;
} }
} }
//已存在的, 需要添加的和需要删除的 // 已存在的, 需要添加的和需要删除的
var existSet = {}, addSet = {}, deleteArray = []; var existSet = {}, addSet = {}, deleteArray = [];
BI.each(renderedKeys, function (i, key) { BI.each(renderedKeys, function (i, key) {
if (self.renderedKeys[i]) { if (self.renderedKeys[i]) {
@ -199,15 +199,15 @@ BI.GridView = BI.inherit(BI.Widget, {
deleteArray.push(key[2]); deleteArray.push(key[2]);
}); });
BI.each(deleteArray, function (i, index) { BI.each(deleteArray, function (i, index) {
//性能优化,不调用destroy方法防止触发destroy事件 // 性能优化,不调用destroy方法防止触发destroy事件
self.renderedCells[index].el._destroy(); self.renderedCells[index].el._destroy();
}); });
var addedItems = []; var addedItems = [];
BI.each(addSet, function (index, key) { BI.each(addSet, function (index, key) {
addedItems.push(renderedCells[key[2]]) addedItems.push(renderedCells[key[2]]);
}); });
this.container.addItems(addedItems); this.container.addItems(addedItems);
//拦截父子级关系 // 拦截父子级关系
this.container._children = renderedWidgets; this.container._children = renderedWidgets;
this.container.attr("items", renderedCells); this.container.attr("items", renderedCells);
this.renderedCells = renderedCells; this.renderedCells = renderedCells;
@ -249,7 +249,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize);
this._calculateChildrenToRender(); this._calculateChildrenToRender();
//元素未挂载时不能设置scrollTop // 元素未挂载时不能设置scrollTop
try { try {
this.element.scrollTop(o.scrollTop); this.element.scrollTop(o.scrollTop);
this.element.scrollLeft(o.scrollLeft); this.element.scrollLeft(o.scrollLeft);
@ -280,11 +280,11 @@ BI.GridView = BI.inherit(BI.Widget, {
}, },
setColumnCount: function (columnCount) { setColumnCount: function (columnCount) {
this.options.columnCount = columnCount this.options.columnCount = columnCount;
}, },
setRowCount: function (rowCount) { setRowCount: function (rowCount) {
this.options.rowCount = rowCount this.options.rowCount = rowCount;
}, },
setOverflowX: function (b) { setOverflowX: function (b) {
@ -292,7 +292,7 @@ BI.GridView = BI.inherit(BI.Widget, {
if (this.options.overflowX !== !!b) { if (this.options.overflowX !== !!b) {
this.options.overflowX = !!b; this.options.overflowX = !!b;
BI.nextTick(function () { BI.nextTick(function () {
self.element.css({overflowX: !!b ? "auto" : "hidden"}); self.element.css({overflowX: b ? "auto" : "hidden"});
}); });
} }
}, },
@ -302,7 +302,7 @@ BI.GridView = BI.inherit(BI.Widget, {
if (this.options.overflowY !== !!b) { if (this.options.overflowY !== !!b) {
this.options.overflowY = !!b; this.options.overflowY = !!b;
BI.nextTick(function () { BI.nextTick(function () {
self.element.css({overflowY: !!b ? "auto" : "hidden"}); self.element.css({overflowY: b ? "auto" : "hidden"});
}); });
} }
}, },
@ -331,7 +331,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this.options.estimatedRowSize = height; this.options.estimatedRowSize = height;
}, },
//重新计算children // 重新计算children
_reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },
@ -360,4 +360,4 @@ BI.GridView = BI.inherit(BI.Widget, {
} }
}); });
BI.GridView.EVENT_SCROLL = "EVENT_SCROLL"; BI.GridView.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut('bi.grid_view', BI.GridView); BI.shortcut("bi.grid_view", BI.GridView);

24
src/base/layer/layer.floatbox.js

@ -9,7 +9,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
baseCls: "bi-float-box bi-card", baseCls: "bi-float-box bi-card",
width: 600, width: 600,
height: 500 height: 500
}) });
}, },
_init: function () { _init: function () {
BI.FloatBox.superclass._init.apply(this, arguments); BI.FloatBox.superclass._init.apply(this, arguments);
@ -35,19 +35,19 @@ BI.FloatBox = BI.inherit(BI.Widget, {
if (ui.position.top < 0) { if (ui.position.top < 0) {
ui.position.top = 0; ui.position.top = 0;
} }
//BI-12134 没有什么特别好的方法 // BI-12134 没有什么特别好的方法
BI.Resizers._resize(); BI.Resizers._resize();
} }
}); });
this._south = BI.createWidget(); this._south = BI.createWidget();
BI.createWidget({ BI.createWidget({
type: 'bi.border', type: "bi.border",
element: this, element: this,
items: { items: {
'north': { north: {
el: { el: {
type: 'bi.border', type: "bi.border",
cls: 'bi-message-title bi-background', cls: "bi-message-title bi-background",
items: { items: {
center: { center: {
el: { el: {
@ -63,8 +63,8 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}, },
east: { east: {
el: { el: {
type: 'bi.icon_button', type: "bi.icon_button",
cls: 'bi-message-close close-font', cls: "bi-message-close close-font",
height: 50, height: 50,
handler: function () { handler: function () {
self.currentSectionProvider.close(); self.currentSectionProvider.close();
@ -76,7 +76,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}, },
height: 50 height: 50
}, },
'center': { center: {
el: { el: {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -88,7 +88,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}] }]
} }
}, },
'south': { south: {
el: { el: {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
@ -102,7 +102,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
height: 60 height: 60
} }
} }
}) });
}, },
populate: function (sectionProvider) { populate: function (sectionProvider) {
@ -116,7 +116,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
sectionProvider.rebuildSouth(this._south); sectionProvider.rebuildSouth(this._south);
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close(); self.close();
}) });
}, },
show: function () { show: function () {

42
src/base/layer/layer.popup.js

@ -7,9 +7,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PopupView.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.PopupView.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-popup-view", baseCls: "bi-popup-view",
maxWidth: 'auto', maxWidth: "auto",
minWidth: 100, minWidth: 100,
//maxHeight: 200, // maxHeight: 200,
minHeight: 25, minHeight: 25,
lgap: 0, lgap: 0,
rgap: 0, rgap: 0,
@ -17,16 +17,16 @@ BI.PopupView = BI.inherit(BI.Widget, {
bgap: 0, bgap: 0,
vgap: 0, vgap: 0,
hgap: 0, hgap: 0,
direction: BI.Direction.Top, //工具栏的方向 direction: BI.Direction.Top, // 工具栏的方向
stopEvent: false,//是否停止mousedown、mouseup事件 stopEvent: false, // 是否停止mousedown、mouseup事件
stopPropagation: false, //是否停止mousedown、mouseup向上冒泡 stopPropagation: false, // 是否停止mousedown、mouseup向上冒泡
logic: { logic: {
dynamic: true dynamic: true
}, },
tool: false, //自定义工具栏 tool: false, // 自定义工具栏
tabs: [], //导航栏 tabs: [], // 导航栏
buttons: [], //toolbar栏 buttons: [], // toolbar栏
el: { el: {
type: "bi.button_group", type: "bi.button_group",
@ -37,28 +37,28 @@ BI.PopupView = BI.inherit(BI.Widget, {
type: "bi.vertical" type: "bi.vertical"
}] }]
} }
}) });
}, },
_init: function () { _init: function () {
BI.PopupView.superclass._init.apply(this, arguments); BI.PopupView.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var fn = function (e) { var fn = function (e) {
e.stopPropagation(); e.stopPropagation();
}, stop = function (e) { }, stop = function (e) {
e.stopEvent(); e.stopEvent();
return false; return false;
}; };
this.element.css({ this.element.css({
"z-index": BI.zIndex_popup, "z-index": BI.zIndex_popup,
"min-width": o.minWidth + "px", "min-width": o.minWidth + "px",
"max-width": o.maxWidth + "px" "max-width": o.maxWidth + "px"
}).bind({"click": fn}); }).bind({click: fn});
this.element.bind("mousewheel", fn); this.element.bind("mousewheel", fn);
o.stopPropagation && this.element.bind({"mousedown": fn, "mouseup": fn, "mouseover": fn}); o.stopPropagation && this.element.bind({mousedown: fn, mouseup: fn, mouseover: fn});
o.stopEvent && this.element.bind({"mousedown": stop, "mouseup": stop, "mouseover": stop}); o.stopEvent && this.element.bind({mousedown: stop, mouseup: stop, mouseover: stop});
this.tool = this._createTool(); this.tool = this._createTool();
this.tab = this._createTab(); this.tab = this._createTab();
this.view = this._createView(); this.view = this._createView();
@ -103,7 +103,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
if (false === o.tool) { if (false === o.tool) {
return; return;
} }
return BI.createWidget(o.tool) return BI.createWidget(o.tool);
}, },
_createTab: function () { _createTab: function () {
@ -116,7 +116,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
cls: "list-view-tab", cls: "list-view-tab",
height: 25, height: 25,
items: o.tabs items: o.tabs
}) });
}, },
_createToolBar: function () { _createToolBar: function () {
@ -134,7 +134,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}) });
}, },
getView: function () { getView: function () {
@ -155,7 +155,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
tabHeight = this.tab ? (this.tab.attr("height") || 25) : 0, tabHeight = this.tab ? (this.tab.attr("height") || 25) : 0,
toolHeight = ((this.tool && this.tool.attr("height")) || 25) * ((this.tool && this.tool.isVisible()) ? 1 : 0); toolHeight = ((this.tool && this.tool.attr("height")) || 25) * ((this.tool && this.tool.isVisible()) ? 1 : 0);
this.view.resetHeight ? this.view.resetHeight(h - tbHeight - tabHeight - toolHeight - 2) : this.view.resetHeight ? this.view.resetHeight(h - tbHeight - tabHeight - toolHeight - 2) :
this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"}) this.view.element.css({"max-height": (h - tbHeight - tabHeight - toolHeight - 2) + "px"});
}, },
setValue: function (selectedValues) { setValue: function (selectedValues) {

4
src/base/layer/layer.searcher.js

@ -14,7 +14,7 @@ BI.SearcherView = BI.inherit(BI.Pane, {
tipText: BI.i18nText("BI-No_Select"), tipText: BI.i18nText("BI-No_Select"),
chooseType: BI.Selection.Single, chooseType: BI.Selection.Single,
matcher: {//完全匹配的构造器 matcher: {// 完全匹配的构造器
type: "bi.button_group", type: "bi.button_group",
behaviors: { behaviors: {
redmark: function () { redmark: function () {
@ -38,7 +38,7 @@ BI.SearcherView = BI.inherit(BI.Pane, {
type: "bi.vertical" type: "bi.vertical"
}] }]
} }
}) });
}, },
_init: function () { _init: function () {

4
src/base/list/listview.js

@ -35,7 +35,7 @@ BI.ListView = BI.inherit(BI.Widget, {
} }
}, o.el)], }, o.el)],
element: this element: this
} };
}, },
mounted: function () { mounted: function () {
@ -106,5 +106,5 @@ BI.ListView = BI.inherit(BI.Widget, {
this.restore(); this.restore();
} }
}); });
BI.shortcut('bi.list_view', BI.ListView); BI.shortcut("bi.list_view", BI.ListView);

4
src/base/list/virtuallist.js

@ -44,7 +44,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
} }
}], }],
element: this element: this
} };
}, },
mounted: function () { mounted: function () {
@ -175,5 +175,5 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.restore(); this.restore();
} }
}); });
BI.shortcut('bi.virtual_list', BI.VirtualList); BI.shortcut("bi.virtual_list", BI.VirtualList);

66
src/base/pager/pager.js

@ -16,35 +16,35 @@ BI.Pager = BI.inherit(BI.Widget, {
vgap: 0 vgap: 0
}], }],
dynamicShow: true, //是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态 dynamicShow: true, // 是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态
//dynamicShow为false时以下两个有用 // dynamicShow为false时以下两个有用
dynamicShowFirstLast: false,//是否动态显示首页、尾页 dynamicShowFirstLast: false, // 是否动态显示首页、尾页
dynamicShowPrevNext: false,//是否动态显示上一页、下一页 dynamicShowPrevNext: false, // 是否动态显示上一页、下一页
pages: false, //总页数 pages: false, // 总页数
curr: function () { curr: function () {
return 1; return 1;
}, //初始化当前页 }, // 初始化当前页
groups: 0, //连续显示分页数 groups: 0, // 连续显示分页数
jump: BI.emptyFn, //分页的回调函数 jump: BI.emptyFn, // 分页的回调函数
first: false, //是否显示首页 first: false, // 是否显示首页
last: false, //是否显示尾页 last: false, // 是否显示尾页
prev: "上一页", prev: "上一页",
next: "下一页", next: "下一页",
firstPage: 1, firstPage: 1,
lastPage: function () { //在万不得已时才会调用这个函数获取最后一页的页码, 主要作用于setValue方法 lastPage: function () { // 在万不得已时才会调用这个函数获取最后一页的页码, 主要作用于setValue方法
return 1; return 1;
}, },
hasPrev: BI.emptyFn, //pages不可用时有效 hasPrev: BI.emptyFn, // pages不可用时有效
hasNext: BI.emptyFn //pages不可用时有效 hasNext: BI.emptyFn // pages不可用时有效
}) });
}, },
_init: function () { _init: function () {
BI.Pager.superclass._init.apply(this, arguments); BI.Pager.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.currPage = BI.result(this.options, "curr"); this.currPage = BI.result(this.options, "curr");
//翻页太灵敏 // 翻页太灵敏
// this._lock = false; // this._lock = false;
// this._debouce = BI.debounce(function () { // this._debouce = BI.debounce(function () {
// self._lock = false; // self._lock = false;
@ -71,17 +71,17 @@ BI.Pager = BI.inherit(BI.Widget, {
groups > pages && (groups = pages); groups > pages && (groups = pages);
} }
//计算当前组 // 计算当前组
dict.index = Math.ceil((curr + ((groups > 1 && groups !== pages) ? 1 : 0)) / (groups === 0 ? 1 : groups)); dict.index = Math.ceil((curr + ((groups > 1 && groups !== pages) ? 1 : 0)) / (groups === 0 ? 1 : groups));
//当前页非首页,则输出上一页 // 当前页非首页,则输出上一页
if (((!o.dynamicShow && !o.dynamicShowPrevNext) || curr > 1) && prev !== false) { if (((!o.dynamicShow && !o.dynamicShowPrevNext) || curr > 1) && prev !== false) {
if (BI.isKey(prev)) { if (BI.isKey(prev)) {
view.push({ view.push({
text: prev, text: prev,
value: "prev", value: "prev",
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false)
}) });
} else { } else {
view.push(BI.extend({ view.push(BI.extend({
disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false)
@ -89,7 +89,7 @@ BI.Pager = BI.inherit(BI.Widget, {
} }
} }
//当前组非首组,则输出首页 // 当前组非首组,则输出首页
if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (dict.index > 1 && groups !== 0)) && first) { if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (dict.index > 1 && groups !== 0)) && first) {
view.push({ view.push({
text: first, text: first,
@ -105,14 +105,14 @@ BI.Pager = BI.inherit(BI.Widget, {
} }
} }
//输出当前页组 // 输出当前页组
dict.poor = Math.floor((groups - 1) / 2); dict.poor = Math.floor((groups - 1) / 2);
dict.start = dict.index > 1 ? curr - dict.poor : 1; dict.start = dict.index > 1 ? curr - dict.poor : 1;
dict.end = dict.index > 1 ? (function () { dict.end = dict.index > 1 ? (function () {
var max = curr + (groups - dict.poor - 1); var max = curr + (groups - dict.poor - 1);
return max > pages ? pages : max; return max > pages ? pages : max;
}()) : groups; }()) : groups;
if (dict.end - dict.start < groups - 1) { //最后一组状态 if (dict.end - dict.start < groups - 1) { // 最后一组状态
dict.start = dict.end - groups + 1; dict.start = dict.end - groups + 1;
} }
var s = dict.start, e = dict.end; var s = dict.start, e = dict.end;
@ -126,16 +126,16 @@ BI.Pager = BI.inherit(BI.Widget, {
text: s, text: s,
value: s, value: s,
selected: true selected: true
}) });
} else { } else {
view.push({ view.push({
text: s, text: s,
value: s value: s
}) });
} }
} }
//总页数大于连续分页数,且当前组最大页小于总页,输出尾页 // 总页数大于连续分页数,且当前组最大页小于总页,输出尾页
if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (pages > groups && dict.end < pages && groups !== 0)) && last) { if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (pages > groups && dict.end < pages && groups !== 0)) && last) {
if (pages > groups && dict.end < pages && groups !== 0) { if (pages > groups && dict.end < pages && groups !== 0) {
view.push({ view.push({
@ -148,27 +148,27 @@ BI.Pager = BI.inherit(BI.Widget, {
text: last, text: last,
value: "last", value: "last",
disabled: !(pages > groups && dict.end < pages && groups !== 0) disabled: !(pages > groups && dict.end < pages && groups !== 0)
}) });
} }
//当前页不为尾页时,输出下一页 // 当前页不为尾页时,输出下一页
dict.flow = !prev && groups === 0; dict.flow = !prev && groups === 0;
if (((!o.dynamicShow && !o.dynamicShowPrevNext) && next) || (curr !== pages && next || dict.flow)) { if (((!o.dynamicShow && !o.dynamicShowPrevNext) && next) || (curr !== pages && next || dict.flow)) {
view.push((function () { view.push((function () {
if (BI.isKey(next)) { if (BI.isKey(next)) {
if (pages === false) { if (pages === false) {
return {text: next, value: "next", disabled: o.hasNext(curr) === false} return {text: next, value: "next", disabled: o.hasNext(curr) === false};
} }
return (dict.flow && curr === pages) return (dict.flow && curr === pages)
? ?
{text: next, value: "next", disabled: true} {text: next, value: "next", disabled: true}
: :
{text: next, value: "next", disabled: !(curr !== pages && next || dict.flow)}; {text: next, value: "next", disabled: !(curr !== pages && next || dict.flow)};
} else {
return BI.extend({
disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow)
}, next);
} }
return BI.extend({
disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow)
}, next);
}())); }()));
} }

6
src/base/pane.js

@ -14,7 +14,7 @@ BI.Pane = BI.inherit(BI.Widget, {
tipText: BI.i18nText("BI-No_Selected_Item"), tipText: BI.i18nText("BI-No_Selected_Item"),
overlap: true, overlap: true,
onLoaded: BI.emptyFn onLoaded: BI.emptyFn
}) });
}, },
_init: function () { _init: function () {
@ -44,7 +44,7 @@ BI.Pane = BI.inherit(BI.Widget, {
if (o.overlap === true) { if (o.overlap === true) {
if (!BI.Layers.has(this.getName())) { if (!BI.Layers.has(this.getName())) {
BI.createWidget({ BI.createWidget({
type: 'bi.vtape', type: "bi.vtape",
items: [{ items: [{
el: { el: {
type: "bi.layout", type: "bi.layout",
@ -72,7 +72,7 @@ BI.Pane = BI.inherit(BI.Widget, {
right: 0, right: 0,
top: 0 top: 0
}] }]
}) });
} }
}, },

2
src/base/single/a/a.js

@ -15,7 +15,7 @@ BI.A = BI.inherit(BI.Text, {
target: "_blank", target: "_blank",
el: null, el: null,
element: "<a/>" element: "<a/>"
}) });
}, },
_init: function () { _init: function () {
var o = this.options; var o = this.options;

32
src/base/single/bar/bar.loading.js

@ -4,15 +4,15 @@
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.LoadingBar = BI.inherit(BI.Single, { BI.LoadingBar = BI.inherit(BI.Single, {
_defaultConfig: function() { _defaultConfig: function () {
var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments); var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, { return BI.extend( conf, {
baseCls : (conf.baseCls ||"")+' bi-loading-bar bi-tips', baseCls: (conf.baseCls || "") + " bi-loading-bar bi-tips",
height: 30, height: 30,
handler: BI.emptyFn handler: BI.emptyFn
}) });
}, },
_init : function() { _init: function () {
BI.LoadingBar.superclass._init.apply(this, arguments); BI.LoadingBar.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.loaded = BI.createWidget({ this.loaded = BI.createWidget({
@ -21,25 +21,25 @@ BI.LoadingBar = BI.inherit(BI.Single, {
text: BI.i18nText("BI-Load_More"), text: BI.i18nText("BI-Load_More"),
width: 120, width: 120,
handler: this.options.handler handler: this.options.handler
}) });
this.loaded.on(BI.Controller.EVENT_CHANGE, function(type){ this.loaded.on(BI.Controller.EVENT_CHANGE, function (type) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}) });
this.loading = BI.createWidget({ this.loading = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: this.options.height, width: this.options.height,
height:this.options.height, height: this.options.height,
cls: "loading-background cursor-default" cls: "loading-background cursor-default"
}) });
var loaded = BI.createWidget({ var loaded = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.loaded] items: [this.loaded]
}) });
var loading = BI.createWidget({ var loading = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.loading] items: [this.loading]
}) });
this.cardLayout = BI.createWidget({ this.cardLayout = BI.createWidget({
type: "bi.card", type: "bi.card",
element: this, element: this,
@ -50,28 +50,28 @@ BI.LoadingBar = BI.inherit(BI.Single, {
el: loading, el: loading,
cardName: "loading" cardName: "loading"
}] }]
}) });
this.invisible(); this.invisible();
}, },
_reset: function(){ _reset: function () {
this.visible(); this.visible();
this.loaded.setText(BI.i18nText("BI-Load_More")); this.loaded.setText(BI.i18nText("BI-Load_More"));
this.loaded.enable(); this.loaded.enable();
}, },
setLoaded: function(){ setLoaded: function () {
this._reset(); this._reset();
this.cardLayout.showCardByName("loaded"); this.cardLayout.showCardByName("loaded");
}, },
setEnd: function(){ setEnd: function () {
this.setLoaded(); this.setLoaded();
this.loaded.setText(BI.i18nText("BI-No_More_Data")); this.loaded.setText(BI.i18nText("BI-No_More_Data"));
this.loaded.disable(); this.loaded.disable();
}, },
setLoading: function(){ setLoading: function () {
this._reset(); this._reset();
this.cardLayout.showCardByName("loading"); this.cardLayout.showCardByName("loading");
} }

18
src/base/single/button/button.basic.js

@ -15,16 +15,16 @@ BI.BasicButton = BI.inherit(BI.Single, {
stopEvent: false, stopEvent: false,
stopPropagation: false, stopPropagation: false,
selected: false, selected: false,
once: false, //点击一次选中有效,再点无效 once: false, // 点击一次选中有效,再点无效
forceSelected: false, //点击即选中, 选中了就不会被取消,与once的区别是forceSelected不影响事件的触发 forceSelected: false, // 点击即选中, 选中了就不会被取消,与once的区别是forceSelected不影响事件的触发
forceNotSelected: false, //无论怎么点击都不会被选中 forceNotSelected: false, // 无论怎么点击都不会被选中
disableSelected: false, //使能选中 disableSelected: false, // 使能选中
shadow: false, shadow: false,
isShadowShowingOnSelected: false, //选中状态下是否显示阴影 isShadowShowingOnSelected: false, // 选中状态下是否显示阴影
trigger: null, trigger: null,
handler: BI.emptyFn handler: BI.emptyFn
}) });
}, },
_init: function () { _init: function () {
BI.BasicButton.superclass._init.apply(this, arguments); BI.BasicButton.superclass._init.apply(this, arguments);
@ -195,10 +195,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
}); });
//之后的300ms点击无效 // 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true);
function ev(e) { function ev (e) {
if (o.stopEvent) { if (o.stopEvent) {
e.stopEvent(); e.stopEvent();
} }
@ -207,7 +207,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
} }
function clk(e) { function clk (e) {
ev(e); ev(e);
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return; return;

22
src/base/single/button/button.node.js

@ -7,47 +7,47 @@
* @abstract * @abstract
*/ */
BI.NodeButton = BI.inherit(BI.BasicButton, { BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function() { _defaultConfig: function () {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, { return BI.extend( conf, {
baseCls: (conf.baseCls || "") + " bi-node", baseCls: (conf.baseCls || "") + " bi-node",
open: false open: false
}) });
}, },
_init:function() { _init: function () {
BI.NodeButton.superclass._init.apply(this, arguments); BI.NodeButton.superclass._init.apply(this, arguments);
var self = this; var self = this;
BI.nextTick(function(){ BI.nextTick(function () {
self.setOpened(self.isOpened()); self.setOpened(self.isOpened());
}) });
}, },
doClick: function(){ doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments); BI.NodeButton.superclass.doClick.apply(this, arguments);
this.setOpened(!this.isOpened()); this.setOpened(!this.isOpened());
}, },
isOnce: function(){ isOnce: function () {
return false; return false;
}, },
isOpened: function(){ isOpened: function () {
return !!this.options.open; return !!this.options.open;
}, },
setOpened: function(b){ setOpened: function (b) {
this.options.open = !!b; this.options.open = !!b;
}, },
triggerCollapse: function(){ triggerCollapse: function () {
if(this.isOpened()) { if(this.isOpened()) {
this.setOpened(false); this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
} }
}, },
triggerExpand: function(){ triggerExpand: function () {
if(!this.isOpened()) { if(!this.isOpened()) {
this.setOpened(true); this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);

10
src/base/single/button/buttons/button.icon.js

@ -10,17 +10,17 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
baseCls: (conf.baseCls || "") + " bi-icon-button horizon-center", baseCls: (conf.baseCls || "") + " bi-icon-button horizon-center",
iconWidth: null, iconWidth: null,
iconHeight: null iconHeight: null
}) });
}, },
_init: function () { _init: function () {
BI.IconButton.superclass._init.apply(this, arguments); BI.IconButton.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
this.element.css({ this.element.css({
textAlign: 'center' textAlign: "center"
}); });
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: 'bi.icon', type: "bi.icon",
width: o.iconWidth, width: o.iconWidth,
height: o.iconHeight height: o.iconHeight
}); });
@ -30,11 +30,11 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
type: "bi.default", type: "bi.default",
element: this, element: this,
items: [this.icon] items: [this.icon]
}) });
} else { } else {
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: 'bi.center_adapt', type: "bi.center_adapt",
items: [this.icon] items: [this.icon]
}); });
} }

6
src/base/single/button/buttons/button.image.js

@ -13,7 +13,7 @@ BI.ImageButton = BI.inherit(BI.BasicButton, {
src: "", src: "",
iconWidth: "100%", iconWidth: "100%",
iconHeight: "100%" iconHeight: "100%"
}) });
}, },
_init: function () { _init: function () {
@ -30,14 +30,14 @@ BI.ImageButton = BI.inherit(BI.BasicButton, {
type: "bi.center_adapt", type: "bi.center_adapt",
element: this, element: this,
items: [this.image] items: [this.image]
}) });
} else { } else {
BI.createWidget({ BI.createWidget({
type: "bi.adaptive", type: "bi.adaptive",
element: this, element: this,
items: [this.image], items: [this.image],
scrollable: false scrollable: false
}) });
} }
}, },

14
src/base/single/button/buttons/button.js

@ -13,15 +13,15 @@
_defaultConfig: function (props) { _defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments); var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + ' bi-button', baseCls: (conf.baseCls || "") + " bi-button",
minWidth: (props.block === true || props.clear === true) ? 0 : 90, minWidth: (props.block === true || props.clear === true) ? 0 : 90,
shadow: props.clear !== true, shadow: props.clear !== true,
isShadowShowingOnSelected: true, isShadowShowingOnSelected: true,
readonly: true, readonly: true,
iconClass: "", iconClass: "",
level: 'common', level: "common",
block: false, //是否块状显示,即不显示边框,没有最小宽度的限制 block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, //是否去掉边框和背景 clear: false, // 是否去掉边框和背景
textAlign: "center", textAlign: "center",
whiteSpace: "nowrap", whiteSpace: "nowrap",
forceCenter: false, forceCenter: false,
@ -33,7 +33,7 @@
bgap: 0, bgap: 0,
lgap: 0, lgap: 0,
rgap: 0 rgap: 0
}) });
}, },
_init: function () { _init: function () {
@ -68,7 +68,7 @@
type: "bi.horizontal", type: "bi.horizontal",
items: [this.icon, this.text] items: [this.icon, this.text]
}] }]
}) });
} else { } else {
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -139,6 +139,6 @@
BI.Button.superclass.destroy.apply(this, arguments); BI.Button.superclass.destroy.apply(this, arguments);
} }
}); });
BI.shortcut('bi.button', BI.Button); BI.shortcut("bi.button", BI.Button);
BI.Button.EVENT_CHANGE = "EVENT_CHANGE"; BI.Button.EVENT_CHANGE = "EVENT_CHANGE";
})(jQuery); })(jQuery);

2
src/base/single/button/buttons/button.text.js

@ -20,7 +20,7 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
rgap: 0, rgap: 0,
text: "", text: "",
py: "" py: ""
}) });
}, },
_init: function () { _init: function () {

4
src/base/single/button/listitem/blankiconicontextitem.js

@ -26,7 +26,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.BlankIconIconTextItem.superclass._init.apply(this, arguments); BI.BlankIconIconTextItem.superclass._init.apply(this, arguments);
@ -35,7 +35,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
type: "bi.layout", type: "bi.layout",
width: o.blankWidth, width: o.blankWidth,
height: o.height height: o.height
}) });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "list-item-text", cls: "list-item-text",

8
src/base/single/button/listitem/blankicontexticonitem.js

@ -27,7 +27,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.BlankIconTextIconItem.superclass._init.apply(this, arguments); BI.BlankIconTextIconItem.superclass._init.apply(this, arguments);
@ -43,7 +43,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}) });
var icon1 = BI.createWidget({ var icon1 = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
@ -57,7 +57,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
height: o.iconHeight height: o.iconHeight
} }
}] }]
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -79,7 +79,7 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
bottom: 0, bottom: 0,
right: 0 right: 0
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this

6
src/base/single/button/listitem/blankicontextitem.js

@ -25,7 +25,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.BlankIconTextItem.superclass._init.apply(this, arguments); BI.BlankIconTextItem.superclass._init.apply(this, arguments);
@ -33,7 +33,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: o.blankWidth width: o.blankWidth
}) });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "list-item-text", cls: "list-item-text",
@ -46,7 +46,7 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}) });
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: c.commonWidth, width: c.commonWidth,

10
src/base/single/button/listitem/icontexticonitem.js

@ -26,7 +26,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.IconTextIconItem.superclass._init.apply(this, arguments); BI.IconTextIconItem.superclass._init.apply(this, arguments);
@ -42,7 +42,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}) });
var icon1 = BI.createWidget({ var icon1 = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
@ -56,11 +56,11 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
height: o.iconHeight height: o.iconHeight
} }
}] }]
}) });
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: c.commonWidth width: c.commonWidth
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -81,7 +81,7 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
bottom: 0, bottom: 0,
right: 0 right: 0
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this

2
src/base/single/button/listitem/icontextitem.js

@ -24,7 +24,7 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.IconTextItem.superclass._init.apply(this, arguments); BI.IconTextItem.superclass._init.apply(this, arguments);

2
src/base/single/button/listitem/texticonitem.js

@ -25,7 +25,7 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.TextIconItem.superclass._init.apply(this, arguments); BI.TextIconItem.superclass._init.apply(this, arguments);

2
src/base/single/button/listitem/textitem.js

@ -18,7 +18,7 @@ BI.TextItem = BI.inherit(BI.BasicButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.TextItem.superclass._init.apply(this, arguments); BI.TextItem.superclass._init.apply(this, arguments);

10
src/base/single/button/node/icontexticonnode.js

@ -24,7 +24,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.IconTextIconNode.superclass._init.apply(this, arguments); BI.IconTextIconNode.superclass._init.apply(this, arguments);
@ -40,7 +40,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}) });
var icon1 = BI.createWidget({ var icon1 = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
@ -54,12 +54,12 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
height: o.iconHeight height: o.iconHeight
} }
}] }]
}) });
var blank = BI.createWidget({ var blank = BI.createWidget({
type: "bi.layout", type: "bi.layout",
width: c.commonWidth, width: c.commonWidth,
height: o.height height: o.height
}) });
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -80,7 +80,7 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
bottom: 0, bottom: 0,
right: 0 right: 0
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this

6
src/base/single/button/node/icontextnode.js

@ -23,7 +23,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.IconTextNode.superclass._init.apply(this, arguments); BI.IconTextNode.superclass._init.apply(this, arguments);
@ -40,7 +40,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}) });
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: c.commonWidth, width: c.commonWidth,
@ -52,7 +52,7 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
height: o.iconHeight height: o.iconHeight
} }
}] }]
}) });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this

4
src/base/single/button/node/texticonnode.js

@ -22,7 +22,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.TextIconNode.superclass._init.apply(this, arguments); BI.TextIconNode.superclass._init.apply(this, arguments);
@ -39,7 +39,7 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}) });
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: c.commonWidth, width: c.commonWidth,

2
src/base/single/button/node/textnode.js

@ -17,7 +17,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
textVgap: 0, textVgap: 0,
textLgap: 0, textLgap: 0,
textRgap: 0 textRgap: 0
}) });
}, },
_init: function () { _init: function () {
BI.TextNode.superclass._init.apply(this, arguments); BI.TextNode.superclass._init.apply(this, arguments);

28
src/base/single/editor/editor.code.js

@ -7,12 +7,12 @@
BI.CodeEditor = BI.inherit(BI.Single, { BI.CodeEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), { return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor', baseCls: "bi-code-editor",
value: '', value: "",
watermark: "", watermark: "",
lineHeight: 2, lineHeight: 2,
readOnly: false, readOnly: false,
//参数显示值构造函数 // 参数显示值构造函数
paramFormatter: function (v) { paramFormatter: function (v) {
return v; return v;
} }
@ -26,13 +26,13 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
readOnly: o.readOnly, readOnly: o.readOnly,
//解决插入字段由括号或其他特殊字符包围时分裂的bug // 解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) { this.editor.on("change", function (cm, change) {
BI.nextTick(function () { BI.nextTick(function () {
self.fireEvent(BI.CodeEditor.EVENT_CHANGE) self.fireEvent(BI.CodeEditor.EVENT_CHANGE);
}); });
}); });
@ -58,7 +58,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
// self.editor.execCommand("goLineEnd"); // self.editor.execCommand("goLineEnd");
// }); // });
//水印 // 水印
this.watermark = BI.createWidget({ this.watermark = BI.createWidget({
type: "bi.label", type: "bi.label",
text: o.watermark, text: o.watermark,
@ -96,7 +96,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
_setEnable: function (b) { _setEnable: function (b) {
BI.CodeEditor.superclass._setEnable.apply(this, arguments); BI.CodeEditor.superclass._setEnable.apply(this, arguments);
this.editor.setOption("readOnly", b === true ? false : "nocursor") this.editor.setOption("readOnly", b === true ? false : "nocursor");
}, },
_checkWaterMark: function () { _checkWaterMark: function () {
@ -112,12 +112,12 @@ BI.CodeEditor = BI.inherit(BI.Single, {
var value = param; var value = param;
param = this.options.paramFormatter(param); param = this.options.paramFormatter(param);
var from = this.editor.getCursor(); var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下 // 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + param + '\u200b'); this.editor.replaceSelection("\u200b" + param + "\u200b");
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: "param", atomic: true};
if (BI.isNotNull(param.match(/^<!.*!>$/))) { if (BI.isNotNull(param.match(/^<!.*!>$/))) {
options.className = 'error-param'; options.className = "error-param";
} }
options.value = value; options.value = value;
this.editor.markText(from, to, options); this.editor.markText(from, to, options);
@ -134,16 +134,16 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return this.editor.getValue("\n", function (line) { return this.editor.getValue("\n", function (line) {
var rawText = line.text, value = line.text, num = 0; var rawText = line.text, value = line.text, num = 0;
value.text = rawText; value.text = rawText;
//根据插入位置不同,line.markedSpan可能是乱序的 // 根据插入位置不同,line.markedSpan可能是乱序的
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) { _.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "param": case "param":
case "error-param": case "error-param":
var fieldNameLength = i.to - i.from; var fieldNameLength = i.to - i.from;
value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length); value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length);
//加上${}的偏移 // 加上${}的偏移
num += 3; num += 3;
//加上实际值和显示值的长度差的偏移 // 加上实际值和显示值的长度差的偏移
num += (i.marker.value.length - fieldNameLength); num += (i.marker.value.length - fieldNameLength);
break; break;
} }

16
src/base/single/editor/editor.js

@ -14,7 +14,7 @@ BI.Editor = BI.inherit(BI.Single, {
rgap: 0, rgap: 0,
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
//title,warningTitle这两个属性没用 // title,warningTitle这两个属性没用
tipType: "warning", tipType: "warning",
inputType: "text", inputType: "text",
validationChecker: BI.emptyFn, validationChecker: BI.emptyFn,
@ -22,7 +22,7 @@ BI.Editor = BI.inherit(BI.Single, {
allowBlank: false, allowBlank: false,
watermark: "", watermark: "",
errorText: "" errorText: ""
}) });
}, },
_init: function () { _init: function () {
@ -38,12 +38,12 @@ BI.Editor = BI.inherit(BI.Single, {
allowBlank: o.allowBlank allowBlank: o.allowBlank
})); }));
this.editor.element.css({ this.editor.element.css({
"width": "100%", width: "100%",
"height": "100%", height: "100%",
"border": "none", border: "none",
"outline": "none", outline: "none",
"padding": "0", padding: "0",
"margin": "0" margin: "0"
}); });
if (BI.isKey(this.options.watermark)) { if (BI.isKey(this.options.watermark)) {
this.watermark = BI.createWidget({ this.watermark = BI.createWidget({

4
src/base/single/editor/editor.multifile.js

@ -12,10 +12,10 @@ BI.MultifileEditor = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor", baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false, multiple: false,
maxSize: -1,//1024 * 1024 maxSize: -1, // 1024 * 1024
accept: "", accept: "",
url: "" url: ""
}) });
}, },
_init: function () { _init: function () {

12
src/base/single/editor/editor.textarea.js

@ -7,8 +7,8 @@
BI.TextAreaEditor = BI.inherit(BI.Single, { BI.TextAreaEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
return $.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(), { return $.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-textarea-editor bi-card', baseCls: "bi-textarea-editor bi-card",
value: '' value: ""
}); });
}, },
_init: function () { _init: function () {
@ -21,7 +21,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
height: "100%", height: "100%",
cls: "bi-textarea textarea-editor-content display-block" cls: "bi-textarea textarea-editor-content display-block"
}); });
this.content.element.css({"resize": "none"}); this.content.element.css({resize: "none"});
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
@ -92,7 +92,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
self.focus(); self.focus();
}); });
BI.createWidget({ BI.createWidget({
type: 'bi.absolute', type: "bi.absolute",
element: this, element: this,
items: [{ items: [{
el: this.watermark, el: this.watermark,
@ -100,7 +100,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
top: 0, top: 0,
right: 0 right: 0
}] }]
}) });
} else { } else {
this.watermark.setText(o.watermark); this.watermark.setText(o.watermark);
this.watermark.setValid(!o.invalid); this.watermark.setValid(!o.invalid);
@ -144,7 +144,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
this.element.css(style); this.element.css(style);
this.content.element.css(BI.extend({}, style, { this.content.element.css(BI.extend({}, style, {
color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor) color: style.color || BI.DOM.getContrastColor(BI.DOM.isRGBColor(style.backgroundColor) ? BI.DOM.rgb2hex(style.backgroundColor) : style.backgroundColor)
})) }));
}, },
getStyle: function () { getStyle: function () {

2
src/base/single/icon/icon.js

@ -9,7 +9,7 @@ BI.Icon = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
tagName: "i", tagName: "i",
baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block" baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block"
}) });
}, },
_init: function () { _init: function () {
BI.Icon.superclass._init.apply(this, arguments); BI.Icon.superclass._init.apply(this, arguments);

6
src/base/single/iframe/iframe.js

@ -12,7 +12,7 @@ BI.Iframe = BI.inherit(BI.Single, {
src: "", src: "",
width: "100%", width: "100%",
height: "100%" height: "100%"
}) });
}, },
_init: function () { _init: function () {
@ -40,11 +40,11 @@ BI.Iframe = BI.inherit(BI.Single, {
}, },
getWidth: function () { getWidth: function () {
return this.options.width return this.options.width;
}, },
getHeight: function () { getHeight: function () {
return this.options.height return this.options.height;
} }
}); });

2
src/base/single/img/img.js

@ -14,7 +14,7 @@ BI.Img = BI.inherit(BI.Single, {
src: "", src: "",
width: "100%", width: "100%",
height: "100%" height: "100%"
}) });
}, },
_init: function () { _init: function () {

12
src/base/single/input/checkbox.js

@ -4,8 +4,8 @@
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.Checkbox = BI.inherit(BI.IconButton, { BI.Checkbox = BI.inherit(BI.IconButton, {
_defaultConfig: function() { _defaultConfig: function () {
var conf = BI.Checkbox.superclass._defaultConfig.apply(this,arguments); var conf = BI.Checkbox.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-checkbox check-box-icon", baseCls: (conf.baseCls || "") + " bi-checkbox check-box-icon",
selected: false, selected: false,
@ -14,16 +14,16 @@ BI.Checkbox = BI.inherit(BI.IconButton, {
height: 16, height: 16,
iconWidth: 16, iconWidth: 16,
iconHeight: 16 iconHeight: 16
}) });
}, },
_init : function() { _init: function () {
BI.Checkbox.superclass._init.apply(this, arguments); BI.Checkbox.superclass._init.apply(this, arguments);
}, },
doClick: function(){ doClick: function () {
BI.Checkbox.superclass.doClick.apply(this, arguments); BI.Checkbox.superclass.doClick.apply(this, arguments);
if(this.isValid()){ if(this.isValid()) {
this.fireEvent(BI.Checkbox.EVENT_CHANGE); this.fireEvent(BI.Checkbox.EVENT_CHANGE);
} }
} }

14
src/base/single/input/input.js

@ -11,9 +11,9 @@ BI.Input = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " bi-input display-block", baseCls: (conf.baseCls || "") + " bi-input display-block",
element: "<input/>", element: "<input/>",
validationChecker: BI.emptyFn, validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,//按确定键能否退出编辑 quitChecker: BI.emptyFn, // 按确定键能否退出编辑
allowBlank: false allowBlank: false
}) });
}, },
_init: function () { _init: function () {
@ -40,8 +40,8 @@ BI.Input = BI.inherit(BI.Single, {
} }
}) })
.on("input propertychange", function (e) { .on("input propertychange", function (e) {
//这个事件在input的属性发生改变的时候就会触发(class的变化也算) // 这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)){ if(BI.isNotNull(e.keyCode)) {
inputEventValid = true; inputEventValid = true;
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
@ -77,7 +77,7 @@ BI.Input = BI.inherit(BI.Single, {
} else { } else {
blur(); blur();
} }
function blur() { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange(); self._checkValidationOnValueChange();
@ -119,7 +119,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_START); this.fireEvent(BI.Input.EVENT_START);
} }
} }
if (ctrlKey === true && keyCode === 86) {//ctrlKey+V if (ctrlKey === true && keyCode === 86) {// ctrlKey+V
this._valueChange(); this._valueChange();
} else { } else {
if (keyCode == BI.KeyCode.ENTER) { if (keyCode == BI.KeyCode.ENTER) {
@ -157,7 +157,7 @@ BI.Input = BI.inherit(BI.Single, {
} }
}, },
//初始状态 // 初始状态
_defaultState: function () { _defaultState: function () {
if (this.getValue() == "") { if (this.getValue() == "") {
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this);

12
src/base/single/input/radio.js

@ -4,8 +4,8 @@
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.Radio = BI.inherit(BI.IconButton, { BI.Radio = BI.inherit(BI.IconButton, {
_defaultConfig: function() { _defaultConfig: function () {
var conf = BI.Radio.superclass._defaultConfig.apply(this,arguments); var conf = BI.Radio.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-radio radio-icon", baseCls: (conf.baseCls || "") + " bi-radio radio-icon",
selected: false, selected: false,
@ -14,16 +14,16 @@ BI.Radio = BI.inherit(BI.IconButton, {
height: 16, height: 16,
iconWidth: 16, iconWidth: 16,
iconHeight: 16 iconHeight: 16
}) });
}, },
_init : function() { _init: function () {
BI.Radio.superclass._init.apply(this, arguments); BI.Radio.superclass._init.apply(this, arguments);
}, },
doClick: function(){ doClick: function () {
BI.Radio.superclass.doClick.apply(this, arguments); BI.Radio.superclass.doClick.apply(this, arguments);
if(this.isValid()){ if(this.isValid()) {
this.fireEvent(BI.Radio.EVENT_CHANGE); this.fireEvent(BI.Radio.EVENT_CHANGE);
} }
} }

14
src/base/single/label/label.js

@ -8,8 +8,8 @@ BI.Label = BI.inherit(BI.Single, {
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-label", baseCls: (conf.baseCls || "") + " bi-label",
textAlign: "center", textAlign: "center",
whiteSpace: "nowrap", //normal or nowrap whiteSpace: "nowrap", // normal or nowrap
forceCenter: false, //是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效 forceCenter: false, // 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
textWidth: null, textWidth: null,
textHeight: null, textHeight: null,
hgap: 0, hgap: 0,
@ -21,7 +21,7 @@ BI.Label = BI.inherit(BI.Single, {
text: "", text: "",
py: "", py: "",
keyword: "" keyword: ""
}) });
}, },
_createJson: function () { _createJson: function () {
@ -226,7 +226,7 @@ BI.Label = BI.inherit(BI.Single, {
type: "bi.layout", type: "bi.layout",
element: this.text, element: this.text,
scrollable: o.whiteSpace === "normal" scrollable: o.whiteSpace === "normal"
}) });
}, },
_createNotCenterEl: function () { _createNotCenterEl: function () {
@ -344,7 +344,7 @@ BI.Label = BI.inherit(BI.Single, {
return; return;
} }
if (o.whiteSpace == "normal") { if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json) this.text = BI.createWidget(json);
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
@ -424,7 +424,7 @@ BI.Label = BI.inherit(BI.Single, {
type: "bi.layout", type: "bi.layout",
element: this.text, element: this.text,
scrollable: o.whiteSpace === "normal" scrollable: o.whiteSpace === "normal"
}) });
}, },
doRedMark: function () { doRedMark: function () {
@ -453,7 +453,7 @@ BI.Label = BI.inherit(BI.Single, {
}, },
setStyle: function (css) { setStyle: function (css) {
this.text.setStyle(css) this.text.setStyle(css);
}, },
setValue: function (v) { setValue: function (v) {

10
src/base/single/link/link.js

@ -4,19 +4,19 @@
* @extends BI.Text * @extends BI.Text
*/ */
BI.Link = BI.inherit(BI.Label, { BI.Link = BI.inherit(BI.Label, {
_defaultConfig: function() { _defaultConfig: function () {
var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); var conf = BI.Link.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-link", baseCls: (conf.baseCls || "") + " bi-link",
href: "", href: "",
target: "_blank" target: "_blank"
}) });
}, },
_createJson: function(){ _createJson: function () {
var o = this.options; var o = this.options;
return { return {
type:"bi.a", type: "bi.a",
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: o.whiteSpace, whiteSpace: o.whiteSpace,
lineHeight: o.textHeight, lineHeight: o.textHeight,
@ -29,7 +29,7 @@ BI.Link = BI.inherit(BI.Label, {
}; };
}, },
_init : function() { _init: function () {
BI.Link.superclass._init.apply(this, arguments); BI.Link.superclass._init.apply(this, arguments);
} }
}); });

6
src/base/single/single.js

@ -19,7 +19,7 @@ BI.Single = BI.inherit(BI.Widget, {
warningTitle: null, warningTitle: null,
tipType: null, // success或warning tipType: null, // success或warning
value: null value: null
}) });
}, },
_showToolTip: function (e, opt) { _showToolTip: function (e, opt) {
@ -88,7 +88,7 @@ BI.Single = BI.inherit(BI.Widget, {
}, },
disabledHover: function () { disabledHover: function () {
//取消hover事件 // 取消hover事件
if (BI.isNotNull(this.timeout)) { if (BI.isNotNull(this.timeout)) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
@ -103,7 +103,7 @@ BI.Single = BI.inherit(BI.Widget, {
this.items = items || []; this.items = items || [];
}, },
//opt: {container: '', belowMouse: false} // opt: {container: '', belowMouse: false}
setTitle: function (title, opt) { setTitle: function (title, opt) {
this.options.title = title; this.options.title = title;
if (BI.isKey(title)) { if (BI.isKey(title)) {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save