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: {}}}
*/
;
(function () {
var Buffer = {};
var MODE = false;//设置缓存模式为关闭
var MODE = false;// 设置缓存模式为关闭
Data.BufferPool = {
put: function (name, cache) {
@ -25736,7 +25736,7 @@ Data.Constant = BICst = {};
* 共享池
* @type {{Shared: {}}}
*/
;
(function () {
var _Shared = {};
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
// the this value as the argument.
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);
@ -60,8 +60,8 @@ if (!Array.prototype.indexOf) {
};
}
if (!Array.prototype.lastIndexOf) {
Array.prototype.lastIndexOf = function (searchElement /*, fromIndex*/) {
'use strict';
Array.prototype.lastIndexOf = function (searchElement /* , fromIndex*/) {
"use strict";
if (this === void 0 || this === null) {
throw new TypeError();
@ -79,8 +79,7 @@ if (!Array.prototype.lastIndexOf) {
n = Number(arguments[1]);
if (n != n) {
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));
}
}
@ -99,14 +98,14 @@ if (!Array.prototype.lastIndexOf) {
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
// 解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
var c = {};
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 () {
};
return c;
})();
return c;
})();
/*
* 前端缓存
*/
@ -127,29 +126,29 @@ window.localStorage || (window.localStorage = {
clear: function () {
this.items = {};
}
});if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
});if (typeof Set !== "undefined" && Set.toString().match(/native code/)) {
} else {
Set = function () {
this.set = {}
this.set = {};
};
Set.prototype.has = function (key) {
return this.set[key] !== undefined;
};
Set.prototype.add = function (key) {
this.set[key] = 1
this.set[key] = 1;
};
Set.prototype.clear = function () {
this.set = {}
this.set = {};
};
}//修复ie9下sort方法的bug
;!function (window) {
}// 修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (!!fn && typeof fn === "function") {
if (this.length < 2) {
return this;
}
@ -157,8 +156,8 @@ window.localStorage || (window.localStorage = {
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
r = (typeof t === "number" ? t :
t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
@ -167,9 +166,9 @@ window.localStorage || (window.localStorage = {
}
}
return this;
} else {
return _sort.call(this);
}
return _sort.call(this);
};
}
}(window);

104
dist/router.js vendored

@ -1,10 +1,10 @@
;(function(){
(function () {
var Events = {
// Bind an event to a `callback` function. Passing `"all"` will bind
// the callback to all events fired.
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 = {});
var events = this._events[name] || (this._events[name] = []);
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
// the callback is invoked, it will be removed.
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 once = _.once(function () {
self.off(name, once);
@ -29,7 +29,7 @@
// callbacks for the event. If `name` is null, removes all bound
// callbacks for all events.
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.
if (!name && !callback && !context) {
@ -86,7 +86,7 @@
trigger: function (name) {
if (!this._events) return this;
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 allEvents = this._events.all;
if (events) triggerEvents(events, args);
@ -103,15 +103,15 @@
// listening to.
listenTo: function (obj, name, callback) {
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;
if (!callback && typeof name === 'object') callback = this;
if (!callback && typeof name === "object") callback = this;
obj.on(name, callback, this);
return this;
},
listenToOnce: function (obj, name, callback) {
if (typeof name === 'object') {
if (typeof name === "object") {
for (var event in name) this.listenToOnce(obj, event, name[event]);
return this;
}
@ -137,7 +137,7 @@
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object') callback = this;
if (!callback && typeof name === "object") callback = this;
if (obj) (listeningTo = {})[obj._listenId] = obj;
for (var id in listeningTo) {
obj = listeningTo[id];
@ -159,7 +159,7 @@
if (!name) return true;
// Handle event maps.
if (typeof name === 'object') {
if (typeof name === "object") {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
@ -239,16 +239,16 @@
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
if (_.isFunction(name)) {
callback = name;
name = '';
name = "";
}
if (!callback) callback = this[name];
var router = this;
BI.history.route(route, function (fragment) {
var args = router._extractParameters(route, fragment);
if (router.execute(callback, args, name) !== false) {
router.trigger.apply(router, ['route:' + name].concat(args));
router.trigger('route', name, args);
BI.history.trigger('route', router, name, args);
router.trigger.apply(router, ["route:" + name].concat(args));
router.trigger("route", name, args);
BI.history.trigger("route", router, name, args);
}
});
return this;
@ -271,7 +271,7 @@
// routes can be defined at the bottom of the route map.
_bindRoutes: function () {
if (!this.routes) return;
this.routes = _.result(this, 'routes');
this.routes = _.result(this, "routes");
var route, routes = _.keys(this.routes);
while ((route = routes.pop()) != null) {
this.route(route, this.routes[route]);
@ -281,13 +281,13 @@
// Convert a route string into a regular expression, suitable for matching
// against the current location hash.
_routeToRegExp: function (route) {
route = route.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
route = route.replace(escapeRegExp, "\\$&")
.replace(optionalParam, "(?:$1)?")
.replace(namedParam, function (match, optional) {
return optional ? match : '([^/?]+)';
return optional ? match : "([^/?]+)";
})
.replace(splatParam, '([^?]*?)');
return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
.replace(splatParam, "([^?]*?)");
return new RegExp("^" + route + "(?:\\?([\\s\\S]*))?$");
},
// Given a route, and a URL fragment that it matches, return the array of
@ -314,10 +314,10 @@
// falls back to polling.
var History = function () {
this.handlers = [];
_.bindAll(this, 'checkUrl');
_.bindAll(this, "checkUrl");
// Ensure that `History` can be used outside of the browser.
if (typeof window !== 'undefined') {
if (typeof window !== "undefined") {
this.location = window.location;
this.history = window.history;
}
@ -344,22 +344,22 @@
// Are we at the app root?
atRoot: function () {
var path = this.location.pathname.replace(/[^\/]$/, '$&/');
var path = this.location.pathname.replace(/[^\/]$/, "$&/");
return path === this.root && !this.getSearch();
},
// In IE6, the hash fragment and search params are incorrect if the
// fragment contains `?`.
getSearch: function () {
var match = this.location.href.replace(/#.*/, '').match(/\?.+/);
return match ? match[0] : '';
var match = this.location.href.replace(/#.*/, "").match(/\?.+/);
return match ? match[0] : "";
},
// Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded.
getHash: function (window) {
var match = (window || this).location.href.match(/#(.*)$/);
return match ? match[1] : '';
return match ? match[1] : "";
},
// Get the pathname and search params, without the root.
@ -367,7 +367,7 @@
var path = decodeURI(this.location.pathname + this.getSearch());
var root = this.root.slice(0, -1);
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.
@ -379,27 +379,27 @@
fragment = this.getHash();
}
}
return fragment.replace(routeStripper, '');
return fragment.replace(routeStripper, "");
},
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
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;
// Figure out the initial configuration. Do we need an iframe?
// 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._wantsHashChange = this.options.hashChange !== false;
this._hasHashChange = 'onhashchange' in window;
this._hasHashChange = "onhashchange" in window;
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState);
this.fragment = this.getFragment();
// 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
// requested.
@ -408,8 +408,8 @@
// 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...
if (!this._hasPushState && !this.atRoot()) {
var root = this.root.slice(0, -1) || '/';
this.location.replace(root + '#' + this.getPath());
var root = this.root.slice(0, -1) || "/";
this.location.replace(root + "#" + this.getPath());
// Return immediately as browser will do redirect to new url
return true;
@ -425,28 +425,28 @@
// support the `hashchange` event, HTML5 history, or the user wants
// `hashChange` but not `pushState`.
if (!this._hasHashChange && this._wantsHashChange && (!this._wantsPushState || !this._hasPushState)) {
var iframe = document.createElement('iframe');
iframe.src = 'javascript:0';
iframe.style.display = 'none';
var iframe = document.createElement("iframe");
iframe.src = "javascript:0";
iframe.style.display = "none";
iframe.tabIndex = -1;
var body = document.body;
// Using `appendChild` will throw on IE < 9 if the document is not ready.
this.iframe = body.insertBefore(iframe, body.firstChild).contentWindow;
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.
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
// 'onhashchange' is supported, determine how we check the URL state.
if (this._hasPushState) {
addEventListener('popstate', this.checkUrl, false);
addEventListener("popstate", this.checkUrl, false);
} else if (this._wantsHashChange && this._hasHashChange && !this.iframe) {
addEventListener('hashchange', this.checkUrl, false);
addEventListener("hashchange", this.checkUrl, false);
} else if (this._wantsHashChange) {
this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
}
@ -459,14 +459,14 @@
stop: function () {
// Add a cross-platform `removeEventListener` shim for older browsers.
var removeEventListener = window.removeEventListener || function (eventName, listener) {
return detachEvent('on' + eventName, listener);
return detachEvent("on" + eventName, listener);
};
// Remove window listeners.
if (this._hasPushState) {
removeEventListener('popstate', this.checkUrl, false);
removeEventListener("popstate", this.checkUrl, false);
} else if (this._wantsHashChange && this._hasHashChange && !this.iframe) {
removeEventListener('hashchange', this.checkUrl, false);
removeEventListener("hashchange", this.checkUrl, false);
}
// Clean up the iframe if necessary.
@ -527,24 +527,24 @@
if (!options || options === true) options = {trigger: !!options};
// Normalize the fragment.
fragment = this.getFragment(fragment || '');
fragment = this.getFragment(fragment || "");
// Don't include a trailing slash on the root.
var root = this.root;
if (fragment === '' || fragment.charAt(0) === '?') {
root = root.slice(0, -1) || '/';
if (fragment === "" || fragment.charAt(0) === "?") {
root = root.slice(0, -1) || "/";
}
var url = root + fragment;
// Strip the hash and decode for matching.
fragment = decodeURI(fragment.replace(pathStripper, ''));
fragment = decodeURI(fragment.replace(pathStripper, ""));
if (this.fragment === fragment) return;
this.fragment = fragment;
// If pushState is available, we use it to set the fragment as a real URL.
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
// fragment to store history.
@ -570,11 +570,11 @@
// a new one to the browser history.
_updateHash: function (location, fragment, replace) {
if (replace) {
var href = location.href.replace(/(javascript:|#).*$/, '');
location.replace(href + '#' + fragment);
var href = location.href.replace(/(javascript:|#).*$/, "");
location.replace(href + "#" + fragment);
} else {
// 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: [[], []],
popupItemsGetter: BI.emptyFn,
formatConfig: BI.emptyFn
})
});
},
_init: function () {
BI.CombineChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
//图可配置属性
// 图可配置属性
this.CombineChart = BI.createWidget({
type: "bi.chart",
element: this.element
@ -44,7 +44,7 @@ BI.CombineChart = BI.inherit(BI.Widget, {
if (BI.isArray(axisItems)) {
result = BI.concat(result, axisItems);
} else {
result.push(BI.extend(axisItems, {"yAxis": yAxisIndex}));
result.push(BI.extend(axisItems, {yAxis: yAxisIndex}));
}
});
if (BI.isNotEmptyArray(combineItems)) {
@ -93,7 +93,7 @@ BI.CombineChart = BI.inherit(BI.Widget, {
},
hgap: 10
}, item)
}
};
})
})
},
@ -118,7 +118,7 @@ BI.CombineChart = BI.inherit(BI.Widget, {
this.combo.showView();
this._debounce2Destroy();
function destroyCombo() {
function destroyCombo () {
if (self._doDestroy) {
this.destroy();
}
@ -153,4 +153,4 @@ BI.CombineChart = BI.inherit(BI.Widget, {
});
BI.CombineChart.EVENT_CHANGE = "EVENT_CHANGE";
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 () {
return BI.extend(BI.Chart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-chart"
})
});
},
_init: function () {
@ -35,7 +35,7 @@ BI.Chart = BI.inherit(BI.Pane, {
},
magnify: function () {
this.vanCharts.refreshRestore()
this.vanCharts.refreshRestore();
},
populate: function (items, options) {
@ -52,4 +52,4 @@ BI.Chart = BI.inherit(BI.Pane, {
}
});
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,
NUM_SEPARATORS: false,
FONT_STYLE: {
"fontFamily": "inherit",
"color": "inherit",
"fontSize": "12px"
fontFamily: "inherit",
color: "inherit",
fontSize: "12px"
}
},
@ -51,7 +51,7 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
return BI.extend(BI.AbstractChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-abstract-chart",
popupItemsGetter: BI.emptyFn
})
});
},
_init: function () {
@ -101,12 +101,12 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
da.x = BI.contentFormat(BI.parseFloat(da.x.div(magnify).toFixed(4)), "#.####;-#.####");
}
});
})
});
},
formatXYDataWithMagnify: function (number, magnify) {
if (BI.isNull(number)) {
return null
return null;
}
if (!BI.isNumber(number)) {
number = BI.parseFloat(number);
@ -173,46 +173,46 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
},
formatTickInXYaxis: function (type, number_level, separators, isCompareBar) {
var formatter = '#.##';
var formatter = "#.##";
switch (type) {
case this.constants.NORMAL:
formatter = '#.##';
formatter = "#.##";
if (separators) {
formatter = '#,###.##'
formatter = "#,###.##";
}
break;
case this.constants.ZERO2POINT:
formatter = '#0';
formatter = "#0";
if (separators) {
formatter = '#,###';
formatter = "#,###";
}
break;
case this.constants.ONE2POINT:
formatter = '#0.0';
formatter = "#0.0";
if (separators) {
formatter = '#,###.0';
formatter = "#,###.0";
}
break;
case this.constants.TWO2POINT:
formatter = '#0.00';
formatter = "#0.00";
if (separators) {
formatter = '#,###.00';
formatter = "#,###.00";
}
break;
}
if (number_level === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
formatter += '%';
formatter += "%";
}
formatter += ";-" + formatter;
if(isCompareBar) {
return function () {
arguments[0] = arguments[0] > 0 ? arguments[0] : (-1) * arguments[0];
return BI.contentFormat(arguments[0], formatter);
}
};
}
return function () {
return BI.contentFormat(arguments[0], formatter)
}
return BI.contentFormat(arguments[0], formatter);
};
},
formatDataLabel: function (state, items, config, style) {
@ -220,8 +220,8 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
if (state === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"align": "outside",
"autoAdjust": true,
align: "outside",
autoAdjust: true,
style: style,
enabled: true,
formatter: {
@ -238,13 +238,13 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
if (state === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"align": "outside",
"autoAdjust": true,
align: "outside",
autoAdjust: true,
style: style,
enabled: true,
formatter: {
identifier: "${VALUE}",
valueFormat: format,
valueFormat: format
}
};
if(isPercentChart) {
@ -265,7 +265,7 @@ BI.AbstractChart = BI.inherit(BI.Widget, {
BI.each(config.yAxis, function (idx, axis) {
axis.labelStyle = fontStyle;
axis.title.style = fontStyle;
})
});
},
_formatItems: function (items) {

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

@ -8,7 +8,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.AccumulateAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-area-chart"
})
});
},
_init: function () {
@ -35,7 +35,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateAreaChart.EVENT_CHANGE, 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,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle(v) {
function formatChartStyle (v) {
switch (v) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -125,7 +125,7 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
}
}
function formatChartLineStyle(v) {
function formatChartLineStyle (v) {
switch (v) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -152,9 +152,9 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -177,14 +177,14 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
},
@ -274,4 +274,4 @@ BI.AccumulateAreaChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.AccumulateAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-axis-chart"
})
});
},
_init: function () {
@ -33,7 +33,7 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateAxisChart.EVENT_CHANGE, 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,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "column";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatCordon() {
function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -115,9 +115,9 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -140,17 +140,17 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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 = "";
switch (numberLevelType) {
@ -178,13 +178,13 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
@ -277,4 +277,4 @@ BI.AccumulateAxisChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.AccumulateBarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-bar-chart"
})
});
},
_init: function () {
@ -21,7 +21,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
return this > 0 ? this : (-1) * this;
},
gridLineWidth: 0
}];
@ -45,7 +45,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateBarChart.EVENT_CHANGE, 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,
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
maxWidth: '40%'
maxWidth: "40%"
});
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
@ -82,17 +82,17 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
enableMinorTick: this.config.enableMinorTick
});
config.chartType = "bar";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.xAxis[0].formatter, this.config.chartFont);
config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter;
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
@ -111,9 +111,9 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -136,17 +136,17 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -163,13 +163,13 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
}
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 + ")";
}
@ -184,7 +184,7 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
var tmp = t.x;
t.x = t.y;
t.y = tmp;
})
});
});
});
return items;
@ -243,4 +243,4 @@ BI.AccumulateBarChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.AccumulateRadarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-accumulate-radar-chart"
})
});
},
_init: function () {
@ -21,7 +21,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
return this > 0 ? this : (-1) * this;
},
gridLineWidth: 0,
position: "bottom"
@ -45,7 +45,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AccumulateRadarChart.EVENT_CHANGE, 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;
delete config.xAxis;
delete config.yAxis;
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
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.angleAxis[0].labelStyle = config.angleAxis[0].title.style = this.config.chartFont;
config.legend.style = this.config.chartFont;
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -101,7 +101,7 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
}
}
function formatChartRadarStyle() {
function formatChartRadarStyle () {
switch (self.config.chartRadarType) {
case BICst.CHART_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);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify);
}
})
});
});
config.plotOptions.tooltip.formatter.valueFormat = formatter;
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -141,13 +141,13 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -191,4 +191,4 @@ BI.AccumulateRadarChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.AreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-area-chart"
})
});
},
_init: function () {
@ -34,7 +34,7 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AreaChart.EVENT_CHANGE, 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,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -131,9 +131,9 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -156,17 +156,17 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatChartLineStyle() {
function formatChartLineStyle () {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false;
@ -184,7 +184,7 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
}
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -201,13 +201,13 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -299,4 +299,4 @@ BI.AreaChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.AxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-axis-chart"
})
});
},
_init: function () {
@ -37,7 +37,7 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.AxisChart.EVENT_CHANGE, 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,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
var lineItem = [];
@ -115,15 +115,15 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
}
});
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [BI.concat(otherItem, lineItem), config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -142,9 +142,9 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -164,17 +164,17 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -191,13 +191,13 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -273,4 +273,4 @@ BI.AxisChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.BarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bar-chart"
})
});
},
_init: function () {
@ -21,7 +21,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
return this > 0 ? this : (-1) * this;
},
gridLineWidth: 0
}];
@ -48,7 +48,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.BarChart.EVENT_CHANGE, 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);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
//分类轴
// 分类轴
config.yAxis = this.yAxis;
config.yAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
config.yAxis[0].title.rotation = this.constants.ROTATION;
@ -69,10 +69,10 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection,
enableTick: this.config.enableTick,
lineWidth: this.config.lineWidth,
maxWidth: '40%'
maxWidth: "40%"
});
//值轴
// 值轴
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
config.xAxis[0].title.text = getXAxisTitle(this.config.leftYAxisNumberLevel, this.constants.X_AXIS);
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;
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
@ -114,9 +114,9 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -136,17 +136,17 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function getXAxisTitle(numberLevelType, position) {
function getXAxisTitle (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -163,10 +163,10 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
}
unit = unit === "" ? unit : "(" + unit + ")";
@ -181,7 +181,7 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
var tmp = t.x;
t.x = t.y;
t.y = tmp;
})
});
});
});
return items;
@ -238,4 +238,4 @@ BI.BarChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.BubbleChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bubble-chart"
})
});
},
_init: function () {
@ -43,7 +43,7 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.BubbleChart.EVENT_CHANGE, 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].lineWidth = 1;
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);
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.align = "center";
config.xAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.xAxis[0].maxHeith = '40%';
config.xAxis[0].maxHeith = "40%";
config.chartType = "bubble";
if (BI.isNotEmptyArray(this.config.tooltip)) {
config.plotOptions.bubble.tooltip = {
useHtml: true,
style: {
color: 'RGB(184, 184, 184)'
color: "RGB(184, 184, 184)"
},
formatter: function () {
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);
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>'}
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);
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>";
}
};
}
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
if (config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"style" : self.config.chartFont,
"align": "outside",
"autoAdjust": true,
style: self.config.chartFont,
align: "outside",
autoAdjust: true,
enabled: true,
formatter: {
identifier: "${X}${Y}${SIZE}",
"XFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
XFormat: function () {
return BI.contentFormat(arguments[0], "#.##;-#.##");
},
"YFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
YFormat: function () {
return BI.contentFormat(arguments[0], "#.##;-#.##");
},
"sizeFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
sizeFormat: function () {
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.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont;
config.legend.style = this.config.chartFont;
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -143,9 +144,9 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -168,31 +169,31 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatNumberLevelInYaxis(type, position) {
function formatNumberLevelInYaxis (type, position) {
var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify);
}
})
});
});
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 = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -209,13 +210,13 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -226,9 +227,9 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
BI.each(item, function (id, it) {
BI.each(it.data, function (i, da) {
var data = da.size;
da.size = BI.contentFormat(data, '#.##;-#.##')
})
})
da.size = BI.contentFormat(data, "#.##;-#.##");
});
});
});
return items;
},
@ -279,4 +280,4 @@ BI.BubbleChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.CompareAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-compare-area-chart"
})
});
},
_init: function () {
@ -34,7 +34,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.CompareAreaChart.EVENT_CHANGE, 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,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function _calculateValueNiceDomain(minValue, maxValue) {
function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue);
@ -125,7 +125,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
function _linearTickInterval(minValue, maxValue, m) {
function _linearTickInterval (minValue, maxValue, m) {
m = m || 5;
var span = maxValue - minValue;
@ -137,7 +137,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
return step;
}
function _linearNiceDomain(minValue, maxValue, tickInterval) {
function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
@ -146,7 +146,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
return [minValue, maxValue];
}
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -165,9 +165,9 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -190,17 +190,17 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatChartLineStyle() {
function formatChartLineStyle () {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
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);
BI.each(items, function (idx, item) {
var max = null;
@ -246,7 +246,7 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
});
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -263,13 +263,13 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -370,4 +370,4 @@ BI.CompareAreaChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.CompareAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-compare-axis-chart"
})
});
},
_init: function () {
@ -43,11 +43,11 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.CompareAxisChart.EVENT_CHANGE, 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;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
@ -58,15 +58,15 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
config.dataSheet.enabled = this.config.showDataTable;
config.xAxis[0].showLabel = !config.dataSheet.enabled;
config.zoom.zoomTool.enabled = this.config.showZoom;
if(this.config.showZoom === true){
if(this.config.showZoom === true) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function(idx, axis){
var unit = '';
switch (axis.axisIndex){
BI.each(config.yAxis, function (idx, axis) {
var unit = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
unit = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.rotation = self.constants.ROTATION;
@ -112,7 +112,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
BI.extend(config.xAxis[1], {
@ -121,15 +121,15 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
enableMinorTick: this.config.enableMinorTick
});
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle(){
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -139,23 +139,23 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
}
}
function formatCordon(){
BI.each(self.config.cordon, function(idx, cor){
if(idx === 0 && self.xAxis.length > 0){
function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) {
if(idx === 0 && self.xAxis.length > 0) {
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, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
}
if(idx > 0 && self.yAxis.length >= idx){
if(idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
@ -168,22 +168,22 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
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, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatChartLineStyle(){
function formatChartLineStyle () {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
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);
BI.each(items, function (idx, item) {
var max = null;
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
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;
}
}
});
if(position === item.yAxis){
if(position === item.yAxis) {
item.tooltip = BI.deepClone(config.plotOptions.tooltip);
item.tooltip.formatter.valueFormat = formatter;
}
if(BI.isNotNull(max)){
if(BI.isNotNull(max)) {
self.maxes.push(max);
}
});
}
function getXYAxisUnit(numberLevelType, position){
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -239,19 +239,19 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
unit = BI.i18nText("BI-Yi");
break;
}
if(position === self.constants.X_AXIS){
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
if(position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
}
if(position === self.constants.LEFT_AXIS){
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
if(position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
if(position === self.constants.RIGHT_AXIS){
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
if(position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
}
return unit === "" ? unit : "(" + unit + ")";
}
function _calculateValueNiceDomain(minValue, maxValue){
function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue);
@ -260,7 +260,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
function _linearTickInterval(minValue, maxValue, m){
function _linearTickInterval (minValue, maxValue, m) {
m = m || 5;
var span = maxValue - minValue;
@ -272,7 +272,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
return step;
}
function _linearNiceDomain(minValue, maxValue, tickInterval){
function _linearNiceDomain (minValue, maxValue, 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;
this.maxes = [];
BI.each(items, function(idx, item){
BI.each(item, function(id, it){
if(idx > 0){
BI.each(items, function (idx, item) {
BI.each(item, function (id, it) {
if(idx > 0) {
BI.extend(it, {reversed: true, xAxis: 1});
}else{
BI.extend(it, {reversed: false, xAxis: 0});
@ -314,7 +314,7 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
@ -339,16 +339,16 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
this.yAxis = [];
var types = [];
BI.each(items, function(idx, axisItems){
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function(id, item){
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AXIS);
});
types.push(type);
});
BI.each(types, function(idx, type){
if(BI.isEmptyArray(type)){
BI.each(types, function (idx, type) {
if(BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
@ -373,9 +373,9 @@ BI.CompareAxisChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize();
},
magnify: function(){
magnify: function () {
this.combineChart.magnify();
}
});
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 () {
return BI.extend(BI.CompareBarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-compare-bar-chart"
})
});
},
_init: function () {
@ -45,7 +45,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.CompareBarChart.EVENT_CHANGE, 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,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
maxWidth: '40%'
maxWidth: "40%"
});
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
@ -83,17 +83,17 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
});
config.chartType = "bar";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.xAxis[0].formatter, this.config.chartFont);
config.plotOptions.tooltip.formatter.valueFormat = config.xAxis[0].formatter;
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
@ -112,9 +112,9 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -137,17 +137,17 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -164,13 +164,13 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
}
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 + ")";
}
@ -190,7 +190,7 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
}
});
it.stack = i;
})
});
});
BI.each(items, function (idx, item) {
result = BI.concat(result, item);
@ -250,4 +250,4 @@ BI.CompareBarChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.DashboardChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-dashboard-chart"
})
});
},
_init: function () {
BI.DashboardChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.gaugeAxis = [{
"minorTickColor": "rgb(226,226,226)",
"tickColor": "rgb(186,186,186)",
minorTickColor: "rgb(226,226,226)",
tickColor: "rgb(186,186,186)",
labelStyle: this.constants.FONT_STYLE,
"step": 0,
"showLabel": true
step: 0,
showLabel: true
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
@ -32,7 +32,7 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.DashboardChart.EVENT_CHANGE, 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) {
config.plotOptions.seriesLabel.enabled = false;
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;
return [items, config];
function formatChartDashboardStyle() {
function formatChartDashboardStyle () {
var bands = getBandsStyles(self.config.bandsStyles, self.config.autoCustomStyle);
var percentageLabel = BI.extend(config.plotOptions.percentageLabel, {
enabled: self.config.showPercentage === BICst.PERCENTAGE.SHOW
@ -66,29 +66,29 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
formatter: function () {
var value = this.value;
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) {
value = BI.contentFormat(this.value, "#0.00%");
} 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 {
value = BI.contentFormat(this.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>';
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>";
if (isDashboard && items[0].data.length > 1) {
if (isMultiPointers) {
return '<div style="text-align: center">' + this.seriesName + ':' + value +
getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + '</div>';
return "<div style=\"text-align: center\">" + this.seriesName + ":" + value +
getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + "</div>";
}
return label
return label;
} 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,
useHtml: true
@ -132,9 +132,9 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
config.gaugeAxis[0].formatter = function () {
var scaleValue = this;
if (self.config.numSeparators) {
scaleValue = BI.contentFormat(scaleValue, '#,##0%;-#,##0%')
scaleValue = BI.contentFormat(scaleValue, "#,##0%;-#,##0%");
} else {
scaleValue = BI.contentFormat(scaleValue, '#0.00%')
scaleValue = BI.contentFormat(scaleValue, "#0.00%");
}
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 () {
var value = this;
if (self.config.numSeparators) {
value = BI.contentFormat(value, "#,###;-#,###")
value = BI.contentFormat(value, "#,###;-#,###");
}
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.plotOptions.bands = bands;
config.plotOptions.valueLabel = slotValueLAbel;
@ -158,44 +158,44 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
config.plotOptions.layout = layout;
}
function changeMaxMinScale() {
function changeMaxMinScale () {
self.gaugeAxis[0].min = BI.parseFloat(self.config.minScale) || null;
self.gaugeAxis[0].max = BI.parseFloat(self.config.maxScale) || null;
}
function formatNumberLevelInYaxis(type, position) {
function formatNumberLevelInYaxis (type, position) {
var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify);
}
})
});
});
config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(this, '#.##;-#.##') + getXYAxisUnit(type, position)
return BI.contentFormat(this, "#.##;-#.##") + getXYAxisUnit(type, position);
};
if (self.config.numSeparators) {
config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], '#,###.##;-#,###.##')
return BI.contentFormat(arguments[0], "#,###.##;-#,###.##");
};
}
if (type === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], '#0.00%')
return BI.contentFormat(arguments[0], "#0.00%");
};
if (self.config.numSeparators) {
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 = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -212,18 +212,18 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
break;
}
if (position === self.constants.DASHBOARD_AXIS) {
self.config.dashboardUnit !== "" && (unit = unit + self.config.dashboardUnit)
self.config.dashboardUnit !== "" && (unit = unit + self.config.dashboardUnit);
}
return unit;
}
function getBandsStyles(styles, change) {
function getBandsStyles (styles, change) {
var min = 0, bands = [], color = null, max = null, conditionMax = null;
BI.each(items, function (idx, item) {
var data = item.data[0];
if ((BI.isNull(max) || data.y > max)) {
max = data.y
max = data.y;
}
});
@ -233,52 +233,52 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
break;
case BICst.SCALE_SETTING.CUSTOM:
if (styles.length === 0) {
return bands
} else {
var maxScale = _calculateValueNiceDomain(0, max)[1];
BI.each(styles, function (idx, style) {
if(BI.parseFloat(style.range.min) > BI.parseFloat(style.range.max)) {
return bands.push({
color: color,
from: conditionMax,
to: maxScale
});
}
bands.push({
color: style.color,
from: style.range.min,
to: style.range.max
return bands;
}
var maxScale = _calculateValueNiceDomain(0, max)[1];
BI.each(styles, function (idx, style) {
if(BI.parseFloat(style.range.min) > BI.parseFloat(style.range.max)) {
return bands.push({
color: color,
from: conditionMax,
to: maxScale
});
color = style.color;
conditionMax = style.range.max
});
min = BI.parseInt(styles[0].range.min);
}
bands.push({
color: "#808080",
from: 0,
to: min
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({
color: "#808080",
from: 0,
to: min
});
bands.push({
color: color,
from: conditionMax,
to: maxScale
});
bands.push({
color: color,
from: conditionMax,
to: maxScale
});
return bands;
}
return bands;
}
}
function _calculateValueNiceDomain(minValue, maxValue) {
function _calculateValueNiceDomain (minValue, maxValue) {
minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
function _linearTickInterval(minValue, maxValue, m) {
function _linearTickInterval (minValue, maxValue, m) {
m = m || 5;
var span = maxValue - minValue;
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;
}
function _linearNiceDomain(minValue, maxValue, tickInterval) {
function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
@ -303,14 +303,14 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
var c = this.constants;
if (this.config.chartDashboardType === c.NORMAL || this.config.chartDashboardType === c.HALF_DASHBOARD) {
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) {
result.push({
data: [BI.extend({}, da, {
x: items[0][0].name
})],
name: da.x
})
});
});
return [result];
} 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
})],
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(item, function (id, it) {
var data = it.data[0];
data.x = it.name;
result.push(data);
})
});
});
return [[{
data: result,
@ -348,8 +348,8 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
y: da.y
})],
name: da.x
})
})
});
});
});
return [others];
}
@ -395,4 +395,4 @@ BI.DashboardChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.DonutChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-donut-chart"
})
});
},
_init: function () {
@ -24,11 +24,11 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.DonutChart.EVENT_CHANGE, 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;
delete config.zoom;
config.colors = this.config.chartColor;
@ -49,13 +49,13 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1);
})
});
});
config.legend.style = this.config.chartFont;
return [items, config];
function formatChartStyle(){
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -80,9 +80,9 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
this.options.items = items;
var types = [];
BI.each(items, function(idx, axisItems){
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function(id, item){
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.DONUT);
});
types.push(type);
@ -95,9 +95,9 @@ BI.DonutChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize();
},
magnify: function(){
magnify: function () {
this.combineChart.magnify();
}
});
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 () {
return BI.extend(BI.FallAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-fall-axis-chart"
})
});
},
_init: function () {
@ -43,11 +43,11 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.FallAxisChart.EVENT_CHANGE, 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 yTitle = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.colors = this.config.chartColor;
@ -56,11 +56,11 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
config.legend.enabled = false;
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.dataSheet.enabled = this.config.showDataTable;
if(config.dataSheet.enabled === true){
if(config.dataSheet.enabled === true) {
config.xAxis[0].showLabel = false;
}
config.zoom.zoomTool.enabled = this.config.showZoom;
if(this.config.showZoom === true){
if(this.config.showZoom === true) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
@ -86,20 +86,20 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
enableMinorTick: this.config.enableMinorTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
//为了给数据标签加个%,还要遍历所有的系列,唉
if(config.plotOptions.dataLabels.enabled === true){
BI.each(items, function(idx, item){
if(idx === 0){
// 为了给数据标签加个%,还要遍历所有的系列,唉
if(config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) {
if(idx === 0) {
item.dataLabels = {};
return;
}
item.dataLabels = {
"style": self.config.chartFont,
"align": "outside",
"autoAdjust": true,
style: self.config.chartFont,
align: "outside",
autoAdjust: true,
enabled: true,
formatter: {
identifier: "${VALUE}",
@ -109,12 +109,12 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
});
}
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle(){
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -124,23 +124,23 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
}
}
function formatCordon(){
BI.each(self.config.cordon, function(idx, cor){
if(idx === 0 && self.xAxis.length > 0){
function formatCordon () {
BI.each(self.config.cordon, function (idx, cor) {
if(idx === 0 && self.xAxis.length > 0) {
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, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
}
if(idx > 0 && self.yAxis.length >= idx){
if(idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
@ -153,34 +153,34 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
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, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatNumberLevelInYaxis(type, position, formatter){
function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify);
}
})
});
});
config.plotOptions.tooltip.formatter.valueFormat = formatter;
}
function getXYAxisUnit(numberLevelType, position){
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -196,33 +196,33 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
unit = BI.i18nText("BI-Yi");
break;
}
if(position === self.constants.X_AXIS){
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
if(position === self.constants.X_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit);
}
if(position === self.constants.LEFT_AXIS){
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
if(position === self.constants.LEFT_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
if(position === self.constants.RIGHT_AXIS){
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
if(position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit);
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function(items){
_formatItems: function (items) {
var o = this.options;
if(BI.isEmptyArray(items)){
if(BI.isEmptyArray(items)) {
return [];
}
items = items[0];
var tables = [], sum = 0;
var colors = this.config.chartColor || [];
if(BI.isEmptyArray(colors)){
if(BI.isEmptyArray(colors)) {
colors = ["rgb(152, 118, 170)", "rgb(0, 157, 227)"];
}
BI.each(items, function(idx, item){
BI.each(item.data, function(i, t){
if(t.y < 0){
BI.each(items, function (idx, item) {
BI.each(item.data, function (i, t) {
if(t.y < 0) {
tables.push([t.x, t.y, sum + t.y, t]);
}else{
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 {
"data": BI.map(tables, function(id, cell){
data: BI.map(tables, function (id, cell) {
var axis = BI.extend({}, cell[3], {
x: cell[0],
y: Math.abs(cell[2 - idx])
});
if(idx === 1){
if(idx === 1) {
axis.color = cell[2 - idx] < 0 ? colors[1] : colors[0];
}else{
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.tooltip = {
enable: false
}
};
}
return axis;
}),
@ -287,9 +287,9 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
};
this.options.items = items;
var types = [];
BI.each(items, function(idx, axisItems){
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function(id, item){
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AXIS);
});
types.push(type);
@ -302,9 +302,9 @@ BI.FallAxisChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize();
},
magnify: function(){
magnify: function () {
this.combineChart.magnify();
}
});
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 () {
return BI.extend(BI.ForceBubbleChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-force-bubble-chart"
})
});
},
_init: function () {
@ -24,13 +24,13 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.ForceBubbleChart.EVENT_CHANGE, 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) {
var self = this, o = this.options;
config.chartType = 'forceBubble';
config.chartType = "forceBubble";
config.colors = this.config.chartColor;
this.formatChartLegend(config, this.config.chartLegend);
@ -46,7 +46,7 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1);
})
});
});
config.legend.style = this.config.chartFont;
return [items, config];
@ -84,4 +84,4 @@ BI.ForceBubbleChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.GISMapChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-gis-map-chart"
})
});
},
_init: function () {
@ -24,7 +24,7 @@ BI.GISMapChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.GISMapChart.EVENT_CHANGE, 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.style = this.config.chartFont;
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 a = '<div style = ' + style + '>' + name + '</div>';
var a = "<div style = " + style + ">" + name + "</div>";
return a;
};
config.plotOptions.tooltip.shared = true;
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) {
tip += ('<div>' + point.seriesName + ':' + BI.contentFormat((point.size || point.y), '#.##;-#.##') + '</div>');
tip += ("<div>" + point.seriesName + ":" + BI.contentFormat((point.size || point.y), "#.##;-#.##") + "</div>");
});
return tip;
};
config.geo = {
"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>"
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>"
};
if (this.config.showBackgroundLayer === true && BI.isNotNull(this.config.backgroundLayerInfo)) {
config.geo = {};
if (this.config.backgroundLayerInfo.type === BICst.WMS_SERVER) {
config.geo.tileLayer = false;
config.geo.wmsUrl = this.config.backgroundLayerInfo.url;
config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer
config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer;
} else {
config.geo.tileLayer = this.config.backgroundLayerInfo.url;
}
@ -157,4 +157,4 @@ BI.GISMapChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.LineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-line-chart"
})
});
},
_init: function () {
@ -34,7 +34,7 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.LineChart.EVENT_CHANGE, 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,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "line";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -132,9 +132,9 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -157,17 +157,17 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatChartLineStyle() {
function formatChartLineStyle () {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false;
@ -185,7 +185,7 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
}
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -202,13 +202,13 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -294,4 +294,4 @@ BI.LineChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.MapChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-map-chart"
})
});
},
_init: function () {
@ -24,7 +24,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.MapChart.EVENT_CHANGE, 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 point = this.points[0];
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;
};
config.plotOptions.dataLabels.formatter.valueFormat = function () {
@ -64,7 +64,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
if (this.config.backgroundLayerInfo.type === BICst.WMS_SERVER) {
config.geo.tileLayer = false;
config.geo.wmsUrl = this.config.backgroundLayerInfo.url;
config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer
config.geo.wmsLayer = this.config.backgroundLayerInfo.wmsLayer;
} else {
config.geo.tileLayer = this.config.backgroundLayerInfo.url;
}
@ -89,12 +89,12 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
items.push({
type: "areaMap",
data: []
})
});
}
return [items, config];
function formatRangeLegend() {
function formatRangeLegend () {
config.rangeLegend.enabled = true;
switch (self.config.chartLegend) {
case BICst.CHART_LEGENDS.BOTTOM:
@ -117,36 +117,36 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
var settings = items[0].settings;
var legendFormat = formatToolTipAndDataLabel(settings.format || c.NORMAL, settings.num_level || c.NORMAL,
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) {
var formatter = '#.##';
function formatToolTipAndDataLabel (format, numberLevel, unit, numSeparators) {
var formatter = "#.##";
switch (format) {
case self.constants.NORMAL:
formatter = '#.##';
if (numSeparators) formatter = '#,###.##';
formatter = "#.##";
if (numSeparators) formatter = "#,###.##";
break;
case self.constants.ZERO2POINT:
formatter = '#0';
if (numSeparators) formatter = '#,###';
formatter = "#0";
if (numSeparators) formatter = "#,###";
break;
case self.constants.ONE2POINT:
formatter = '#0.0';
if (numSeparators) formatter = '#,###.0';
formatter = "#0.0";
if (numSeparators) formatter = "#,###.0";
break;
case self.constants.TWO2POINT:
formatter = '#0.00';
if (numSeparators) formatter = '#,###.00';
formatter = "#0.00";
if (numSeparators) formatter = "#,###.00";
break;
}
switch (numberLevel) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
formatter += '';
formatter += "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
formatter += BI.i18nText("BI-Wan");
@ -158,23 +158,23 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
formatter += BI.i18nText("BI-Yi");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.PERCENT:
formatter += '%';
formatter += "%";
break;
}
return formatter + unit;
}
function getRangeStyle(styles, change, defaultColor) {
function getRangeStyle (styles, change, defaultColor) {
var range = [], color = null, defaultStyle = {};
var conditionMax = null, conditionMin = null, min = null;
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, it) {
if (BI.isNull(min) || BI.parseFloat(min) > BI.parseFloat(it.y)) {
min = it.y
min = it.y;
}
})
});
});
switch (change) {
@ -196,11 +196,11 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
range.push({
color: style.color || "rgba(255,255,255,0)",
from: style.range.min,
to: to,
to: to
});
}
color = style.color;
conditionMax = style.range.max
conditionMax = style.range.max;
});
conditionMin = BI.parseFloat(styles[0].range.min);
@ -220,21 +220,21 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
});
}
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);
var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
function _linearTickInterval(minValue, maxValue, m) {
function _linearTickInterval (minValue, maxValue, m) {
m = m || 5;
var span = maxValue - minValue;
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;
}
function _linearNiceDomain(minValue, maxValue, tickInterval) {
function _linearNiceDomain (minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
@ -313,7 +313,7 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
self._formatDrillItems(da.drilldown);
}
});
})
});
});
return items;
},
@ -358,4 +358,4 @@ BI.MapChart = BI.inherit(BI.AbstractChart, {
});
BI.MapChart.EVENT_CHANGE = "EVENT_CHANGE";
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 () {
return BI.extend(BI.MultiAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-axis-chart"
})
});
},
_init: function () {
@ -20,10 +20,10 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
this.xAxis = [{
type: "category",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
fontFamily: "inherit", color: "#808080", fontSize: "12px"
},
position: "bottom",
gridLineWidth: 0
@ -39,7 +39,7 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.MultiAxisChart.EVENT_CHANGE, 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,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
if (config.dataSheet) {
config.dataSheet.style = this.config.chartFont;
}
@ -161,14 +161,14 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
style: {
fontFamily: "inherit",
color: "#808080",
fontSize: "12px",
fontWeight: ""
},
"text": t.text,
"align": "top"
text: t.text,
align: "top"
}
});
});
@ -193,19 +193,19 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
style: {
fontFamily: "inherit",
color: "#808080",
fontSize: "12px",
fontWeight: ""
},
"text": t.text,
"align": "left"
text: t.text,
align: "left"
}
});
});
}
})
});
},
getXYAxisUnit: function (numberLevelType, position) {
@ -227,16 +227,16 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit)
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit);
}
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) {
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit)
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit);
}
return unit === "" ? unit : "(" + unit + ")";
},
@ -294,10 +294,10 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
var newYAxis = {
type: "value",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
fontFamily: "inherit", color: "#808080", fontSize: "12px"
},
position: idx > 0 ? "right" : "left",
lineWidth: 1,
@ -319,4 +319,4 @@ BI.MultiAxisChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.MultiAxisCombineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-axis-combine-chart"
})
});
},
_init: function () {
@ -20,10 +20,10 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
this.xAxis = [{
type: "category",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
fontFamily: "inherit", color: "#808080", fontSize: "12px"
},
position: "bottom",
gridLineWidth: 0
@ -39,7 +39,7 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.MultiAxisCombineChart.EVENT_CHANGE, 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,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
if (config.dataSheet) {
config.dataSheet.style = this.config.chartFont;
}
@ -164,14 +164,14 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
style: {
fontFamily: "inherit",
color: "#808080",
fontSize: "12px",
fontWeight: ""
},
"text": t.text,
"align": "top"
text: t.text,
align: "top"
}
});
});
@ -196,19 +196,19 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
style: {
fontFamily: "inherit",
color: "#808080",
fontSize: "12px",
fontWeight: ""
},
"text": t.text,
"align": "left"
text: t.text,
align: "left"
}
});
});
}
})
});
},
getXYAxisUnit: function (numberLevelType, position) {
@ -230,16 +230,16 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit)
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit);
}
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) {
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit)
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit);
}
return unit === "" ? unit : "(" + unit + ")";
},
@ -296,10 +296,10 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
var newYAxis = {
type: "value",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
style: {fontFamily: "inherit", color: "#808080", fontSize: "12px", fontWeight: ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
fontFamily: "inherit", color: "#808080", fontSize: "12px"
},
position: idx > 0 ? "right" : "left",
lineWidth: 1,
@ -321,4 +321,4 @@ BI.MultiAxisCombineChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.PercentAccumulateAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-percent-accumulate-area-chart"
})
});
},
_init: function () {
@ -43,7 +43,7 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.PercentAccumulateAreaChart.EVENT_CHANGE, 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,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "area";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont, true);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -116,9 +116,9 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -141,17 +141,17 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -168,15 +168,15 @@ BI.PercentAccumulateAreaChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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.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 () {
return BI.extend(BI.PercentAccumulateAxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-percent-accumulate-axis-chart"
})
});
},
_init: function () {
@ -43,7 +43,7 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.PercentAccumulateAxisChart.EVENT_CHANGE, 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,
enableMinorTick: this.config.enableMinorTick,
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.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -115,9 +115,9 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -140,17 +140,17 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -167,10 +167,10 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
return unit === "" ? unit : "(" + unit + ")";
}
@ -237,4 +237,4 @@ BI.PercentAccumulateAxisChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.PieChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-pie-chart"
})
});
},
_init: function () {
@ -24,11 +24,11 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.PieChart.EVENT_CHANGE, 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;
delete config.zoom;
config.colors = this.config.chartColor;
@ -50,14 +50,14 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1);
})
});
});
config.legend.style = this.config.chartFont;
return [items, config];
function formatChartStyle(){
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -67,8 +67,8 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
}
}
function formatChartPieStyle(){
switch (self.config.chartPieType){
function formatChartPieStyle () {
switch (self.config.chartPieType) {
case BICst.CHART_SHAPE.EQUAL_ARC_ROSE:
config.plotOptions.roseType = "sameArc";
break;
@ -86,31 +86,31 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
},
//目前饼图不会有多个系列,如果有多个就要把它们合并在一起
_isNeedConvert: function(items){
var result = BI.find(items, function(idx, item){
// 目前饼图不会有多个系列,如果有多个就要把它们合并在一起
_isNeedConvert: function (items) {
var result = BI.find(items, function (idx, item) {
return item.length > 1;
});
return BI.isNotNull(result);
},
_formatItems: function(items){
if(this._isNeedConvert(items)){
//把每个坐标轴所有的多个系列合并成一个系列
return BI.map(items, function(idx, item){
_formatItems: function (items) {
if(this._isNeedConvert(items)) {
// 把每个坐标轴所有的多个系列合并成一个系列
return BI.map(items, function (idx, item) {
var seriesItem = [];
var obj = {data: [], name: ""};
seriesItem.push(obj);
BI.each(item, function(id, series){
BI.each(series.data, function(i, da){
BI.each(item, function (id, series) {
BI.each(series.data, function (i, da) {
obj.data.push(BI.extend({}, da, {x: series.name}));
});
});
return seriesItem;
})
}else{
return items;
});
}
return items;
},
populate: function (items, options) {
@ -129,9 +129,9 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
this.options.items = items;
var types = [];
BI.each(items, function(idx, axisItems){
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function(id, item){
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.PIE);
});
types.push(type);
@ -144,10 +144,10 @@ BI.PieChart = BI.inherit(BI.AbstractChart, {
this.combineChart.resize();
},
magnify: function(){
magnify: function () {
this.combineChart.magnify();
}
});
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 () {
return BI.extend(BI.RadarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-radar-chart"
})
});
},
_init: function () {
@ -21,7 +21,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
return this > 0 ? this : (-1) * this;
},
gridLineWidth: 0,
position: "bottom"
@ -45,7 +45,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.RadarChart.EVENT_CHANGE, 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";
delete config.xAxis;
delete config.yAxis;
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.radiusAxis[0].formatter, this.config.chartFont);
//全局样式
// 全局样式
config.legend.style = 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;
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
@ -92,7 +92,7 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
}
}
function formatChartRadarStyle() {
function formatChartRadarStyle () {
switch (self.config.chartRadarType) {
case BICst.CHART_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);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify);
}
})
});
});
config.plotOptions.tooltip.formatter.valueFormat = formatter;
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -132,13 +132,13 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -182,4 +182,4 @@ BI.RadarChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.RangeAreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-range-area-chart"
})
});
},
_init: function () {
@ -44,7 +44,7 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.RangeAreaChart.EVENT_CHANGE, 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,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
maxHeight: "40%"
});
config.chartType = "area";
config.plotOptions.tooltip.formatter.identifier = "${CATEGORY}${VALUE}";
//为了给数据标签加个%,还要遍历所有的系列,唉
// 为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabelForAxis(config.plotOptions.dataLabels.enabled, items, config.yAxis[0].formatter, this.config.chartFont);
//全局样式的图表文字
// 全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -112,9 +112,9 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -137,29 +137,29 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatNumberLevelInYaxis(type, position, formatter) {
function formatNumberLevelInYaxis (type, position, formatter) {
var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
da.y = self.formatXYDataWithMagnify(da.y, magnify);
}
})
});
});
config.plotOptions.tooltip.formatter.valueFormat = formatter;
}
function getXYAxisUnit(numberLevelType, position) {
function getXYAxisUnit (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -176,10 +176,10 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
return unit === "" ? unit : "(" + unit + ")";
}
@ -281,4 +281,4 @@ BI.RangeAreaChart = BI.inherit(BI.AbstractChart, {
}
});
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 () {
return BI.extend(BI.ScatterChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-scatter-chart"
})
});
},
_init: function () {
@ -43,7 +43,7 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
self.fireEvent(BI.ScatterChart.EVENT_CHANGE, 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;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
config.plotOptions.marker = {"symbol": "circle", "radius": 4.5, "enabled": true};
config.plotOptions.marker = {symbol: "circle", radius: 4.5, enabled: true};
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
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].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
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);
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.align = "center";
config.xAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.xAxis[0].maxHeight = '40%';
config.xAxis[0].maxHeight = "40%";
config.chartType = "scatter";
if (BI.isNotEmptyArray(this.config.tooltip)) {
config.plotOptions.tooltip.formatter = function () {
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);
return this.seriesName + '<div>(X)' + self.config.tooltip[0]
+ ':' + x + '</div><div>(Y)' + self.config.tooltip[1] + ':' + y + '</div>'
return this.seriesName + "<div>(X)" + self.config.tooltip[0]
+ ":" + x + "</div><div>(Y)" + self.config.tooltip[1] + ":" + y + "</div>";
};
}
if (config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"style": self.config.chartFont,
"align": "outside",
"autoAdjust": true,
style: self.config.chartFont,
align: "outside",
autoAdjust: true,
enabled: true,
formatter: {
identifier: "${X}${Y}",
"XFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
XFormat: function () {
return BI.contentFormat(arguments[0], "#.##;-#.##");
},
"YFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
YFormat: function () {
return BI.contentFormat(arguments[0], "#.##;-#.##");
}
}
};
@ -110,14 +110,14 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
});
}
//全局样式图表文字
// 全局样式图表文字
config.legend.style = 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;
return [items, config];
function formatChartStyle() {
function formatChartStyle () {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_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) {
if (idx === 0 && self.xAxis.length > 0) {
var magnify = self.calcMagnify(self.config.xAxisNumberLevel);
@ -136,9 +136,9 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
style: self.config.chartFont,
text: t.text,
align: "top"
}
});
});
@ -161,35 +161,35 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "left"
style: self.config.chartFont,
text: t.text,
align: "left"
}
});
});
}
})
});
}
function formatNumberLevelInXaxis(type) {
function formatNumberLevelInXaxis (type) {
var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
da.x = self.formatXYDataWithMagnify(da.x, magnify);
})
})
});
});
}
function formatNumberLevelInYaxis(type) {
function formatNumberLevelInYaxis (type) {
var magnify = self.calcMagnify(type);
BI.each(items, function (idx, item) {
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 = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
@ -206,13 +206,13 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
break;
}
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) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit);
}
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 + ")";
}
@ -263,4 +263,4 @@ BI.ScatterChart = BI.inherit(BI.AbstractChart, {
}
});
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.ACCUMULATE_BAR:
case BICst.WIDGET.COMPARE_BAR:
item = BI.extend({"type": "bar"}, items);
item = BI.extend({type: "bar"}, items);
break;
case BICst.WIDGET.BUBBLE:
item = BI.extend({"type": "bubble"}, items);
item = BI.extend({type: "bubble"}, items);
break;
case BICst.WIDGET.FORCE_BUBBLE:
item = BI.extend({"type": "forceBubble"}, items);
item = BI.extend({type: "forceBubble"}, items);
break;
case BICst.WIDGET.SCATTER:
item = BI.extend({"type": "scatter"}, items);
item = BI.extend({type: "scatter"}, items);
break;
case BICst.WIDGET.AXIS:
case BICst.WIDGET.ACCUMULATE_AXIS:
case BICst.WIDGET.PERCENT_ACCUMULATE_AXIS:
case BICst.WIDGET.COMPARE_AXIS:
case BICst.WIDGET.FALL_AXIS:
item = BI.extend({"type": "column"}, items);
item = BI.extend({type: "column"}, items);
break;
case BICst.WIDGET.LINE:
item = BI.extend({"type": "line"}, items);
item = BI.extend({type: "line"}, items);
break;
case BICst.WIDGET.AREA:
case BICst.WIDGET.ACCUMULATE_AREA:
case BICst.WIDGET.COMPARE_AREA:
case BICst.WIDGET.RANGE_AREA:
case BICst.WIDGET.PERCENT_ACCUMULATE_AREA:
item = BI.extend({"type": "area"}, items);
item = BI.extend({type: "area"}, items);
break;
case BICst.WIDGET.DONUT:
item = BI.extend({"type": "pie"}, items);
item = BI.extend({type: "pie"}, items);
break;
case BICst.WIDGET.RADAR:
case BICst.WIDGET.ACCUMULATE_RADAR:
item = BI.extend({"type": "radar"}, items);
item = BI.extend({type: "radar"}, items);
break;
case BICst.WIDGET.PIE:
item = BI.extend({"type": "pie"}, items);
item = BI.extend({type: "pie"}, items);
break;
case BICst.WIDGET.DASHBOARD:
item = BI.extend({"type": "gauge"}, items);
item = BI.extend({type: "gauge"}, items);
break;
case BICst.WIDGET.MAP:
item = BI.extend({"type": "areaMap"}, items);
item = BI.extend({type: "areaMap"}, items);
break;
case BICst.WIDGET.GIS_MAP:
item = BI.extend({"type": "pointMap"}, items);
item = BI.extend({type: "pointMap"}, items);
break;
default:
item = BI.extend({"type": "column"}, items);
item = BI.extend({type: "column"}, items);
break;
}
return item;
@ -68,177 +68,177 @@ BI.ChartCombineFormatItemFactory = {
combineConfig: function () {
return {
"title": "",
"chartType": "column",
"plotOptions": {
"rotatable": false,
"startAngle": 0,
"borderRadius": 0,
"endAngle": 360,
"innerRadius": "0.0%",
"layout": "horizontal",
"hinge": "rgb(101,107,109)",
"dataLabels": {
"autoAdjust": true,
"style": {"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"},
"formatter": {
"identifier": "${VALUE}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat,
"XFormat": this._contentFormat2Decimal,
"YFormat": this._contentFormat2Decimal,
"sizeFormat": this._contentFormat2Decimal
title: "",
chartType: "column",
plotOptions: {
rotatable: false,
startAngle: 0,
borderRadius: 0,
endAngle: 360,
innerRadius: "0.0%",
layout: "horizontal",
hinge: "rgb(101,107,109)",
dataLabels: {
autoAdjust: true,
style: {fontFamily: "inherit", color: "inherit", fontSize: "12px"},
formatter: {
identifier: "${VALUE}",
valueFormat: this._contentFormat2Decimal,
seriesFormat: this._contentFormat,
percentFormat: this._contentFormatPercentage,
categoryFormat: this._contentFormat,
XFormat: this._contentFormat2Decimal,
YFormat: this._contentFormat2Decimal,
sizeFormat: this._contentFormat2Decimal
},
"align": "outside",
"enabled": false
align: "outside",
enabled: false
},
"percentageLabel": {
"formatter": {
"identifier": "${PERCENT}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
percentageLabel: {
formatter: {
identifier: "${PERCENT}",
valueFormat: this._contentFormat2Decimal,
seriesFormat: this._contentFormat,
percentFormat: this._contentFormatPercentage,
categoryFormat: this._contentFormat
},
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
style: {
fontFamily: "inherit", color: "inherit", fontSize: "12px"
},
"align": "bottom",
"enabled": true
align: "bottom",
enabled: true
},
"valueLabel": {
"formatter": {
"identifier": "${SERIES}${VALUE}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
valueLabel: {
formatter: {
identifier: "${SERIES}${VALUE}",
valueFormat: this._contentFormat2Decimal,
seriesFormat: this._contentFormat,
percentFormat: this._contentFormatPercentage,
categoryFormat: this._contentFormat
},
"backgroundColor": "rgb(255,255,0)",
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
backgroundColor: "rgb(255,255,0)",
style: {
fontFamily: "inherit", color: "inherit", fontSize: "12px"
},
"align": "inside",
"enabled": true
align: "inside",
enabled: true
},
"hingeBackgroundColor": "rgb(220,242,249)",
"seriesLabel": {
"formatter": {
"identifier": "${CATEGORY}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
hingeBackgroundColor: "rgb(220,242,249)",
seriesLabel: {
formatter: {
identifier: "${CATEGORY}",
valueFormat: this._contentFormat2Decimal,
seriesFormat: this._contentFormat,
percentFormat: this._contentFormatPercentage,
categoryFormat: this._contentFormat
},
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
style: {
fontFamily: "inherit", color: "inherit", fontSize: "12px"
},
"align": "bottom",
"enabled": true
align: "bottom",
enabled: true
},
"paneBackgroundColor": "rgb(252,252,252)",
"needle": "rgb(229,113,90)",
"large": false,
"connectNulls": false,
"shadow": true,
"curve": false,
"sizeBy": "area",
"tooltip": {
"formatter": {
"identifier": "${SERIES}${X}${Y}${SIZE}{CATEGORY}${SERIES}${VALUE}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat,
"XFormat": this._contentFormat2Decimal,
"sizeFormat": this._contentFormat2Decimal,
"YFormat": this._contentFormat2Decimal
paneBackgroundColor: "rgb(252,252,252)",
needle: "rgb(229,113,90)",
large: false,
connectNulls: false,
shadow: true,
curve: false,
sizeBy: "area",
tooltip: {
formatter: {
identifier: "${SERIES}${X}${Y}${SIZE}{CATEGORY}${SERIES}${VALUE}",
valueFormat: this._contentFormat2Decimal,
seriesFormat: this._contentFormat,
percentFormat: this._contentFormatPercentage,
categoryFormat: this._contentFormat,
XFormat: this._contentFormat2Decimal,
sizeFormat: this._contentFormat2Decimal,
YFormat: this._contentFormat2Decimal
},
"shared": false,
"padding": 5,
"backgroundColor": "rgba(0,0,0,0.4980392156862745)",
"borderColor": "rgb(0,0,0)",
"shadow": false,
"borderRadius": 2,
"borderWidth": 0,
"follow": false,
"enabled": true,
"animation": true,
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3",
"color": "#c4c6c6",
"fontSize": "12px",
"fontWeight": ""
shared: false,
padding: 5,
backgroundColor: "rgba(0,0,0,0.4980392156862745)",
borderColor: "rgb(0,0,0)",
shadow: false,
borderRadius: 2,
borderWidth: 0,
follow: false,
enabled: true,
animation: true,
style: {
fontFamily: "Microsoft YaHei, Hiragino Sans GB W3",
color: "#c4c6c6",
fontSize: "12px",
fontWeight: ""
}
},
"maxSize": 80,
"fillColorOpacity": 0.5,
"step": false,
"force": false,
"minSize": 15,
"displayNegative": true,
"categoryGap": "16.0%",
"borderColor": "rgb(255,255,255)",
"borderWidth": 1,
"gap": "22.0%",
"animation": true,
"lineWidth": 2,
"bubble": {
"large": false,
"connectNulls": false,
"shadow": true,
"curve": false,
"sizeBy": "area",
"maxSize": 80,
"minSize": 15,
"lineWidth": 0,
"animation": true,
"fillColorOpacity": 0.699999988079071,
"marker": {
"symbol": "circle",
"radius": 28.39695010101295,
"enabled": true
maxSize: 80,
fillColorOpacity: 0.5,
step: false,
force: false,
minSize: 15,
displayNegative: true,
categoryGap: "16.0%",
borderColor: "rgb(255,255,255)",
borderWidth: 1,
gap: "22.0%",
animation: true,
lineWidth: 2,
bubble: {
large: false,
connectNulls: false,
shadow: true,
curve: false,
sizeBy: "area",
maxSize: 80,
minSize: 15,
lineWidth: 0,
animation: true,
fillColorOpacity: 0.699999988079071,
marker: {
symbol: "circle",
radius: 28.39695010101295,
enabled: true
}
}
},
"dTools": {
"enabled": false,
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3",
"color": "#1a1a1a",
"fontSize": "12px"
dTools: {
enabled: false,
style: {
fontFamily: "Microsoft YaHei, Hiragino Sans GB W3",
color: "#1a1a1a",
fontSize: "12px"
},
"backgroundColor": 'white'
backgroundColor: "white"
},
"dataSheet": {
"enabled": false,
"borderColor": "rgb(0,0,0)",
"borderWidth": 1,
"formatter": this._contentFormat2Decimal,
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
dataSheet: {
enabled: false,
borderColor: "rgb(0,0,0)",
borderWidth: 1,
formatter: this._contentFormat2Decimal,
style: {
fontFamily: "inherit", color: "inherit", fontSize: "12px"
}
},
"borderColor": "rgb(238,238,238)",
"shadow": false,
"legend": {
"borderColor": "rgb(204,204,204)",
"borderRadius": 0,
"shadow": false,
"borderWidth": 0,
"visible": true,
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
borderColor: "rgb(238,238,238)",
shadow: false,
legend: {
borderColor: "rgb(204,204,204)",
borderRadius: 0,
shadow: false,
borderWidth: 0,
visible: true,
style: {
fontFamily: "inherit", color: "inherit", fontSize: "12px"
},
"position": "right",
"enabled": false
position: "right",
enabled: false
},
"rangeLegend": {
"range": {
"min": 0,
"color": [
rangeLegend: {
range: {
min: 0,
color: [
[
0,
"rgb(182,226,255)"
@ -252,40 +252,40 @@ BI.ChartCombineFormatItemFactory = {
"rgb(36,167,255)"
]
],
"max": 266393
max: 266393
},
"enabled": false
enabled: false
},
"zoom": {"zoomType": "xy", "zoomTool": {"visible": false, "resize": true, "from": "", "to": ""}},
"plotBorderColor": "rgba(255,255,255,0)",
"tools": {
"hidden": false,
"toImage": {"enabled": false},
"sort": {"enabled": false},
"fullScreen": {"enabled": false},
"refresh": {
"enabled": false
zoom: {zoomType: "xy", zoomTool: {visible: false, resize: true, from: "", to: ""}},
plotBorderColor: "rgba(255,255,255,0)",
tools: {
hidden: false,
toImage: {enabled: false},
sort: {enabled: false},
fullScreen: {enabled: false},
refresh: {
enabled: false
}
},
"plotBorderWidth": 0,
"style": "normal",
"colors": ["rgb(99,178,238)", "rgb(118,218,145)"],
"borderRadius": 0,
"borderWidth": 0,
"plotShadow": false,
"plotBorderRadius": 0
plotBorderWidth: 0,
style: "normal",
colors: ["rgb(99,178,238)", "rgb(118,218,145)"],
borderRadius: 0,
borderWidth: 0,
plotShadow: false,
plotBorderRadius: 0
};
},
_contentFormat: function () {
return BI.contentFormat(arguments[0], '')
return BI.contentFormat(arguments[0], "");
},
_contentFormat2Decimal: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
return BI.contentFormat(arguments[0], "#.##;-#.##");
},
_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 () {
return BI.extend(BI.Canvas.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-canvas"
})
});
},
_init: function () {
BI.Canvas.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var canvas = document.createElement("canvas");
if (!document.createElement('canvas').getContext) {
if (!document.createElement("canvas").getContext) {
canvas = window.G_vmlCanvasManager.initElement(canvas);
}
this.element.append(canvas);
@ -35,7 +35,7 @@ BI.Canvas = BI.inherit(BI.Widget, {
_getContext: function () {
if (!this.ctx) {
this.ctx = this.canvas.getContext('2d');
this.ctx = this.canvas.getContext("2d");
}
return this.ctx;
},
@ -119,7 +119,7 @@ BI.Canvas = BI.inherit(BI.Widget, {
stroke: function () {
var ctx = this._getContext();
if(!ctx){
if(!ctx) {
return false;
}
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) {
this._lastRenderedCellIndices = this._sectionManager.getCellIndices(height, width, x, y);
return this._cellGroupRenderer()
return this._cellGroupRenderer();
},
_cellGroupRenderer: function () {
@ -122,13 +122,13 @@ BI.CollectionView = BI.inherit(BI.Widget, {
var right = Math.min(this._width, scrollLeft + o.width + o.horizontalOverscanSize);
var bottom = Math.min(this._height, scrollTop + o.height + o.verticalOverscanSize);
if (right > 0 && bottom > 0) {
//如果滚动的区间并没有超出渲染的范围
// 如果滚动的区间并没有超出渲染的范围
if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) {
return;
}
var childrenToDisplay = this._cellRenderers(bottom - top, right - left, left, top);
var renderedCells = [], renderedKeys = {}, renderedWidgets = {};
//存储所有的left和top
// 存储所有的left和top
var lefts = {}, tops = {};
for (var i = 0, len = childrenToDisplay.length; i < len; i++) {
var datum = childrenToDisplay[i];
@ -141,7 +141,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
tops = BI.toArray(tops);
var leftMap = BI.invert(lefts);
var topMap = BI.invert(tops);
//存储上下左右四个边界
// 存储上下左右四个边界
var leftBorder = {}, rightBorder = {}, topBorder = {}, bottomBorder = {};
var assertMinBorder = function (border, offset) {
if (border[offset] == null) {
@ -215,7 +215,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
renderedKeys[datum.index] = [datum.index, i];
renderedWidgets[i] = child;
}
//已存在的, 需要添加的和需要删除的
// 已存在的, 需要添加的和需要删除的
var existSet = {}, addSet = {}, deleteArray = [];
BI.each(renderedKeys, function (i, key) {
if (self.renderedKeys[i]) {
@ -234,21 +234,21 @@ BI.CollectionView = BI.inherit(BI.Widget, {
deleteArray.push(key[1]);
});
BI.each(deleteArray, function (i, index) {
//性能优化,不调用destroy方法防止触发destroy事件
// 性能优化,不调用destroy方法防止触发destroy事件
self.renderedCells[index].el._destroy();
});
var addedItems = [];
BI.each(addSet, function (index, key) {
addedItems.push(renderedCells[key[1]])
addedItems.push(renderedCells[key[1]]);
});
this.container.addItems(addedItems);
//拦截父子级关系
// 拦截父子级关系
this.container._children = renderedWidgets;
this.container.attr("items", renderedCells);
this.renderedCells = renderedCells;
this.renderedKeys = renderedKeys;
//Todo 左右比较特殊
// Todo 左右比较特殊
var minX = BI.min(leftBorder);
var maxX = BI.max(rightBorder);
@ -279,7 +279,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.container.setHeight(this._height);
this._calculateChildrenToRender();
//元素未挂载时不能设置scrollTop
// 元素未挂载时不能设置scrollTop
try {
this.element.scrollTop(o.scrollTop);
this.element.scrollLeft(o.scrollLeft);
@ -315,7 +315,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
if (this.options.overflowX !== !!b) {
this.options.overflowX = !!b;
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) {
this.options.overflowY = !!b;
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();
},
//重新计算children
// 重新计算children
_reRange: function () {
this.renderRange = {};
},
@ -375,4 +375,4 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}
});
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",
trigger: "click",
toggle: true,
direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
container: null,//popupview放置的容器,默认为this.element
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
isNeedAdjustHeight: true,//是否需要高度调整
isNeedAdjustHeight: true, // 是否需要高度调整
isNeedAdjustWidth: true,
stopEvent: false,
stopPropagation: false,
adjustLength: 0,//调整的距离
adjustLength: 0, // 调整的距离
adjustXOffset: 0,
adjustYOffset: 0,
hideChecker: BI.emptyFn,
offsetStyle: "left", //left,right,center
offsetStyle: "left", // left,right,center
el: {},
popup: {},
comboClass: "bi-combo-popup",
hoverClass: "bi-combo-hover"
})
});
},
_init: function () {
@ -108,7 +108,7 @@ BI.Combo = BI.inherit(BI.Widget, {
var enterPopup = false;
function hide() {
function hide () {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView();
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))) {
// return;
// }
//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的公式弹框需要特殊处理下
// 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的公式弹框需要特殊处理下
return;
}
var isHide = this.options.hideChecker.apply(this, [e]);
@ -319,31 +319,31 @@ BI.Combo = BI.inherit(BI.Widget, {
switch (o.direction) {
case "bottom":
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;
case "top":
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;
case "left":
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;
case "right":
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;
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;
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;
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;
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;
case "top,custom":
case "custom,top":
@ -368,7 +368,7 @@ BI.Combo = BI.inherit(BI.Widget, {
}
if ("adaptHeight" in p) {
this.resetListHeight(p['adaptHeight']);
this.resetListHeight(p["adaptHeight"]);
}
if ("left" in p) {
this.popupView.element.css({

22
src/base/combination/expander.js

@ -12,13 +12,13 @@ BI.Expander = BI.inherit(BI.Widget, {
baseCls: "bi-expander",
trigger: "click",
toggle: true,
//direction: "bottom", //top,bottom四个方向
isDefaultInit: false, //是否默认初始化子节点
// direction: "bottom", //top,bottom四个方向
isDefaultInit: false, // 是否默认初始化子节点
el: {},
popup: {},
expanderClass: "bi-expander-popup",
hoverClass: "bi-expander-hover"
})
});
},
_init: function () {
@ -92,13 +92,13 @@ BI.Expander = BI.inherit(BI.Widget, {
self.element[e](function (e) {
if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid()) {
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);
}
}, function () {
if (self.isEnabled() && self.isValid() && self.expander.isEnabled() && self.expander.isValid() && o.toggle) {
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);
}
});
@ -113,7 +113,7 @@ BI.Expander = BI.inherit(BI.Widget, {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.expander);
self.fireEvent(BI.Expander.EVENT_EXPAND);
} 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);
}
}
@ -122,7 +122,7 @@ BI.Expander = BI.inherit(BI.Widget, {
}
break;
}
})
});
},
_initExpander: function () {
@ -144,7 +144,7 @@ BI.Expander = BI.inherit(BI.Widget, {
this.popupView.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
//self.setValue(self.getValue());
// self.setValue(self.getValue());
self.fireEvent(BI.Expander.EVENT_CHANGE, value, obj);
}
});
@ -191,7 +191,7 @@ BI.Expander = BI.inherit(BI.Widget, {
},
populate: function (items) {
//this._assertPopupView();
// this._assertPopupView();
this.popupView && this.popupView.populate.apply(this.popupView, arguments);
this.expander.populate.apply(this.expander, arguments);
},
@ -203,13 +203,13 @@ BI.Expander = BI.inherit(BI.Widget, {
},
setValue: function (v) {
//this._assertPopupView();
// this._assertPopupView();
this.expander.setValue(v);
this.popupView && this.popupView.setValue(v);
},
getValue: function () {
//this._assertPopupView();
// this._assertPopupView();
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,
vgap: 0
}]
})
});
},
_init: function () {
@ -25,7 +25,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
BI.each(this.options.behaviors, function (key, rule) {
behaviors[key] = BI.BehaviorFactory.createBehavior(key, {
rule: rule
})
});
});
this.behaviors = behaviors;
this.populate(this.options.items);
@ -65,7 +65,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
});
btn.on(BI.Events.DESTROY, function () {
BI.remove(self.buttons, btn);
})
});
});
return buttons;
@ -81,8 +81,8 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
el: it
})
]
})
})
});
});
}
return btns;
},
@ -95,8 +95,8 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
}
return BI.extend({}, item, {
el: btns[i]
})
})
});
});
},
_packageItems: function (items, packBtns) {
@ -114,10 +114,10 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return layout;
},
//如果是一个简单的layout
// 如果是一个简单的layout
_isSimpleLayout: function () {
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 () {
@ -125,7 +125,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
args.unshift(this.buttons);
BI.each(this.behaviors, function (i, behavior) {
behavior.doBehavior.apply(behavior, args);
})
});
},
prependItems: function (items) {
@ -147,7 +147,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
var btns = this._btnsCreator.apply(this, arguments);
this.buttons = BI.concat(this.buttons, btns);
//如果是一个简单的layout
// 如果是一个简单的layout
if (this._isSimpleLayout() && this.layouts && this.layouts.addItems) {
this.layouts.addItems(btns);
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), {
baseCls: "bi-combo-group bi-list-item",
//以下这些属性对每一个combo都是公用的
// 以下这些属性对每一个combo都是公用的
trigger: "click,hover",
direction: "right",
adjustLength: 0,
@ -27,7 +27,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
}]
}
}
})
});
},
_init: function () {
@ -57,7 +57,7 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
ch.adjustLength = o.adjustLength;
ch.popup = o.popup;
}
})
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
@ -74,13 +74,13 @@ BI.ComboGroup = BI.inherit(BI.Widget, {
items: children
}, o.popup.el)
})
})
});
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.ComboGroup.EVENT_CHANGE, obj);
}
})
});
},
getValue: function () {

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

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

14
src/base/combination/loader.js

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

4
src/base/combination/navigation.js

@ -5,7 +5,7 @@
BI.Navigation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
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: {
dynamic: false
},
@ -18,7 +18,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
afterCardCreated: BI.emptyFn,
afterCardShow: BI.emptyFn
})
});
},
render: function () {

24
src/base/combination/searcher.js

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

12
src/base/combination/switcher.js

@ -19,7 +19,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
masker: {},
switcherClass: "bi-switcher-popup",
hoverClass: "bi-switcher-hover"
})
});
},
_init: function () {
@ -89,13 +89,13 @@ BI.Switcher = BI.inherit(BI.Widget, {
self.element[e](function (e) {
if (self.isEnabled() && self.switcher.isEnabled()) {
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);
}
}, function () {
if (self.isEnabled() && self.switcher.isEnabled() && o.toggle) {
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);
}
});
@ -107,10 +107,10 @@ BI.Switcher = BI.inherit(BI.Widget, {
if (self.isEnabled() && self.switcher.isEnabled()) {
o.toggle ? self._toggle() : self._popupView();
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);
} 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);
}
}
@ -119,7 +119,7 @@ BI.Switcher = BI.inherit(BI.Widget, {
}
break;
}
})
});
},
_initSwitcher: function () {

8
src/base/combination/tab.js

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

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

@ -8,7 +8,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
_defaultConfig: function () {
return BI.extend(BI.ButtonTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-button-tree"
})
});
},
_init: function () {
@ -116,7 +116,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, {
return btns;
},
//获取所有的叶子节点
// 获取所有的叶子节点
getAllLeaves: function () {
var leaves = [];
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 () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
})
});
},
setValue: function (v) {
@ -39,4 +39,4 @@ BI.EL = BI.inherit(BI.Widget, {
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) {
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]);
}
function arrayContains(arr, item) {
function arrayContains (arr, item) {
if (!Array.prototype.indexOf) {
var i = arr.length;
while (i--) {
@ -20,7 +20,7 @@
return arr.indexOf(item) != -1;
}
function scriptHint(editor, keywords, getToken, options) {
function scriptHint (editor, keywords, getToken, options) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur);
if (/\b(?:string)\b/.test(token.type)) {
@ -54,25 +54,25 @@
};
}
function getFormulaKeywords() {
function getFormulaKeywords () {
return BI.FormulaCollections;
}
function formulaHint(editor, options) {
function formulaHint (editor, options) {
return scriptHint(editor, getFormulaKeywords(),
function (e, cur) {
return e.getTokenAt(cur);
},
options);
};
}
CodeMirror.registerHelper("hint", "formula", formulaHint);
function getCompletions(token, context, keywords, options) {
function getCompletions (token, context, keywords, options) {
var found = [], start = token.string;
if (!start) {
return found;
}
function maybeAdd(str) {
function maybeAdd (str) {
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) {
found.push(str);
}

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

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

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

@ -31,7 +31,7 @@
completion.update(true);
});
function Completion(cm, options) {
function Completion (cm, options) {
this.cm = cm;
this.options = this.buildOptions(options);
this.widget = null;
@ -47,8 +47,8 @@
}
var requestAnimationFrame = window.requestAnimationFrame || function (fn) {
return setTimeout(fn, 1000 / 60);
};
return setTimeout(fn, 1000 / 60);
};
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
Completion.prototype = {
@ -73,16 +73,16 @@
else {
this.cm.replaceRange(getText(completion), completion.from || data.from,
completion.to || data.to, "complete");
if(completion.isKeyword === true){
}else{
var to = this.cm.getCursor();
this.cm.markText(completion.from || data.from, to, {className: "#function", atomic: true});
this.cm.replaceSelection("() ");
to = this.cm.getCursor();
to.ch = to.ch - 2;
this.cm.setCursor(to);
this.cm.focus();
}
if(completion.isKeyword === true) {
}else{
var to = this.cm.getCursor();
this.cm.markText(completion.from || data.from, to, {className: "#function", atomic: true});
this.cm.replaceSelection("() ");
to = this.cm.getCursor();
to.ch = to.ch - 2;
this.cm.setCursor(to);
this.cm.focus();
}
}
CodeMirror.signal(data, "pick", completion);
this.close();
@ -140,20 +140,22 @@
var editor = this.cm.options.hintOptions;
var out = {};
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
if (editor) 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 (editor) {
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];}
}
return out;
}
};
function getText(completion) {
if (typeof completion == "string") return completion;
else return completion.text;
function getText (completion) {
if (typeof completion === "string") return completion;
return completion.text;
}
function buildKeyMap(completion, handle) {
function buildKeyMap (completion, handle) {
var baseMap = {
Up: function () {
handle.moveFocus(-1);
@ -180,38 +182,40 @@
var custom = completion.options.customKeys;
var ourMap = custom ? {} : baseMap;
function addBinding(key, val) {
function addBinding (key, val) {
var bound;
if (typeof val != "string")
if (typeof val !== "string") {
bound = function (cm) {
return val(cm, handle);
};
}
// This mechanism is deprecated
else if (baseMap.hasOwnProperty(val))
bound = baseMap[val];
else
bound = val;
else if (baseMap.hasOwnProperty(val)) {bound = baseMap[val];} else {bound = val;}
ourMap[key] = bound;
}
if (custom)
for (var key in custom) if (custom.hasOwnProperty(key))
addBinding(key, custom[key]);
if (custom) {
for (var key in custom) {
if (custom.hasOwnProperty(key)) {addBinding(key, custom[key]);}
}
}
var extra = completion.options.extraKeys;
if (extra)
for (var key in extra) if (extra.hasOwnProperty(key))
addBinding(key, extra[key]);
if (extra) {
for (var key in extra) {
if (extra.hasOwnProperty(key)) {addBinding(key, extra[key]);}
}
}
return ourMap;
}
function getHintElement(hintsElement, el) {
function getHintElement (hintsElement, el) {
while (el && el != hintsElement) {
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
el = el.parentNode;
}
}
function Widget(completion, data) {
function Widget (completion, data) {
this.completion = completion;
this.data = data;
this.picked = false;
@ -366,19 +370,13 @@
},
changeActive: function (i, avoidWrap) {
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;
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;}
if (this.selectedHint == i) return;
var node = this.hints.childNodes[this.selectedHint];
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
node = this.hints.childNodes[this.selectedHint = i];
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
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;
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;}
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
},
@ -406,15 +404,16 @@
var found = [];
for (var i = 0; i < options.words.length; i++) {
var word = options.words[i];
if (word.slice(0, token.string.length) == token.string)
found.push(word);
if (word.slice(0, token.string.length) == token.string) {found.push(word);}
}
if (found.length) return {
list: found,
from: CodeMirror.Pos(cur.line, token.start),
to: CodeMirror.Pos(cur.line, token.end)
};
if (found.length) {
return {
list: found,
from: CodeMirror.Pos(cur.line, token.start),
to: CodeMirror.Pos(cur.line, token.end)
};
}
});
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, {
_defaultConfig: function () {
return $.extend(BI.FormulaEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-formula-editor bi-card',
watermark: '',
value: '',
baseCls: "bi-formula-editor bi-card",
watermark: "",
value: "",
fieldTextValueMap: {},
showHint: true,
lineHeight: 2
@ -21,8 +21,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
textWrapping: true,
lineWrapping: true,
lineNumbers: false,
mode: 'formula',
//解决插入字段由括号或其他特殊字符包围时分裂的bug
mode: "formula",
// 解决插入字段由括号或其他特殊字符包围时分裂的bug
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");
@ -32,7 +32,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
CodeMirror.showHint(cm, CodeMirror.formulaHint, {completeSingle: false});
}
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) {
var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + field + '\u200b');
// 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection("\u200b" + field + "\u200b");
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.focus();
},
@ -166,7 +166,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
_.forEach(line.markedSpans, function (i, ms) {
switch (i.marker.className) {
case "fieldName":
//因为插入字段的时候首尾加了不可见字符,所以首尾缩进一个字符
// 因为插入字段的时候首尾加了不可见字符,所以首尾缩进一个字符
var dId = fieldMap[value.substr(i.from + 1, i.to - i.from - 2)];
if (!fields.contains(dId)) {
fields.push(dId);

56
src/base/foundation/message.js

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

34
src/base/grid/grid.js

@ -15,8 +15,8 @@ BI.GridView = BI.inherit(BI.Widget, {
overflowY: true,
overscanColumnCount: 0,
overscanRowCount: 0,
rowHeightGetter: BI.emptyFn, //number类型或function类型
columnWidthGetter: BI.emptyFn, //number类型或function类型
rowHeightGetter: BI.emptyFn, // number类型或function类型
columnWidthGetter: BI.emptyFn, // number类型或function类型
// estimatedColumnSize: 100, //columnWidthGetter为function时必设
// estimatedRowSize: 30, //rowHeightGetter为function时必设
scrollLeft: 0,
@ -73,7 +73,7 @@ BI.GridView = BI.inherit(BI.Widget, {
return {
overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
}
};
},
_calculateChildrenToRender: function () {
@ -98,7 +98,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this._renderedRowStartIndex = visibleRowIndices.start;
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);
@ -107,7 +107,7 @@ BI.GridView = BI.inherit(BI.Widget, {
var rowStartIndex = overscanRowIndices.overscanStartIndex;
var rowStopIndex = overscanRowIndices.overscanStopIndex;
//算区间size
// 算区间size
var minRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStartIndex);
var minColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStartIndex);
var maxRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStopIndex);
@ -116,7 +116,7 @@ BI.GridView = BI.inherit(BI.Widget, {
var left = minColumnDatum.offset + horizontalOffsetAdjustment;
var bottom = maxRowDatum.offset + verticalOffsetAdjustment + maxRowDatum.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) {
return;
}
@ -180,7 +180,7 @@ BI.GridView = BI.inherit(BI.Widget, {
count++;
}
}
//已存在的, 需要添加的和需要删除的
// 已存在的, 需要添加的和需要删除的
var existSet = {}, addSet = {}, deleteArray = [];
BI.each(renderedKeys, function (i, key) {
if (self.renderedKeys[i]) {
@ -199,15 +199,15 @@ BI.GridView = BI.inherit(BI.Widget, {
deleteArray.push(key[2]);
});
BI.each(deleteArray, function (i, index) {
//性能优化,不调用destroy方法防止触发destroy事件
// 性能优化,不调用destroy方法防止触发destroy事件
self.renderedCells[index].el._destroy();
});
var addedItems = [];
BI.each(addSet, function (index, key) {
addedItems.push(renderedCells[key[2]])
addedItems.push(renderedCells[key[2]]);
});
this.container.addItems(addedItems);
//拦截父子级关系
// 拦截父子级关系
this.container._children = renderedWidgets;
this.container.attr("items", 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._calculateChildrenToRender();
//元素未挂载时不能设置scrollTop
// 元素未挂载时不能设置scrollTop
try {
this.element.scrollTop(o.scrollTop);
this.element.scrollLeft(o.scrollLeft);
@ -280,11 +280,11 @@ BI.GridView = BI.inherit(BI.Widget, {
},
setColumnCount: function (columnCount) {
this.options.columnCount = columnCount
this.options.columnCount = columnCount;
},
setRowCount: function (rowCount) {
this.options.rowCount = rowCount
this.options.rowCount = rowCount;
},
setOverflowX: function (b) {
@ -292,7 +292,7 @@ BI.GridView = BI.inherit(BI.Widget, {
if (this.options.overflowX !== !!b) {
this.options.overflowX = !!b;
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) {
this.options.overflowY = !!b;
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;
},
//重新计算children
// 重新计算children
_reRange: function () {
this.renderRange = {};
},
@ -360,4 +360,4 @@ BI.GridView = BI.inherit(BI.Widget, {
}
});
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",
width: 600,
height: 500
})
});
},
_init: function () {
BI.FloatBox.superclass._init.apply(this, arguments);
@ -35,19 +35,19 @@ BI.FloatBox = BI.inherit(BI.Widget, {
if (ui.position.top < 0) {
ui.position.top = 0;
}
//BI-12134 没有什么特别好的方法
// BI-12134 没有什么特别好的方法
BI.Resizers._resize();
}
});
this._south = BI.createWidget();
BI.createWidget({
type: 'bi.border',
type: "bi.border",
element: this,
items: {
'north': {
north: {
el: {
type: 'bi.border',
cls: 'bi-message-title bi-background',
type: "bi.border",
cls: "bi-message-title bi-background",
items: {
center: {
el: {
@ -63,8 +63,8 @@ BI.FloatBox = BI.inherit(BI.Widget, {
},
east: {
el: {
type: 'bi.icon_button',
cls: 'bi-message-close close-font',
type: "bi.icon_button",
cls: "bi-message-close close-font",
height: 50,
handler: function () {
self.currentSectionProvider.close();
@ -76,7 +76,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
},
height: 50
},
'center': {
center: {
el: {
type: "bi.absolute",
items: [{
@ -88,7 +88,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
}]
}
},
'south': {
south: {
el: {
type: "bi.absolute",
items: [{
@ -102,7 +102,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
height: 60
}
}
})
});
},
populate: function (sectionProvider) {
@ -116,7 +116,7 @@ BI.FloatBox = BI.inherit(BI.Widget, {
sectionProvider.rebuildSouth(this._south);
sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () {
self.close();
})
});
},
show: function () {

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

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

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

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

4
src/base/list/listview.js

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

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

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

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

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

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

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

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

@ -7,47 +7,47 @@
* @abstract
*/
BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function() {
_defaultConfig: function () {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, {
baseCls: (conf.baseCls || "") + " bi-node",
open: false
})
});
},
_init:function() {
_init: function () {
BI.NodeButton.superclass._init.apply(this, arguments);
var self = this;
BI.nextTick(function(){
BI.nextTick(function () {
self.setOpened(self.isOpened());
})
});
},
doClick: function(){
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
this.setOpened(!this.isOpened());
},
isOnce: function(){
isOnce: function () {
return false;
},
isOpened: function(){
isOpened: function () {
return !!this.options.open;
},
setOpened: function(b){
setOpened: function (b) {
this.options.open = !!b;
},
triggerCollapse: function(){
triggerCollapse: function () {
if(this.isOpened()) {
this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
}
},
triggerExpand: function(){
triggerExpand: function () {
if(!this.isOpened()) {
this.setOpened(true);
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",
iconWidth: null,
iconHeight: null
})
});
},
_init: function () {
BI.IconButton.superclass._init.apply(this, arguments);
var o = this.options;
this.element.css({
textAlign: 'center'
textAlign: "center"
});
this.icon = BI.createWidget({
type: 'bi.icon',
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight
});
@ -30,11 +30,11 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
type: "bi.default",
element: this,
items: [this.icon]
})
});
} else {
BI.createWidget({
element: this,
type: 'bi.center_adapt',
type: "bi.center_adapt",
items: [this.icon]
});
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -17,7 +17,7 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
textVgap: 0,
textLgap: 0,
textRgap: 0
})
});
},
_init: function () {
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, {
_defaultConfig: function () {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor',
value: '',
baseCls: "bi-code-editor",
value: "",
watermark: "",
lineHeight: 2,
readOnly: false,
//参数显示值构造函数
// 参数显示值构造函数
paramFormatter: function (v) {
return v;
}
@ -26,13 +26,13 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true,
lineNumbers: false,
readOnly: o.readOnly,
//解决插入字段由括号或其他特殊字符包围时分裂的bug
// 解决插入字段由括号或其他特殊字符包围时分裂的bug
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");
this.editor.on("change", function (cm, change) {
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");
// });
//水印
// 水印
this.watermark = BI.createWidget({
type: "bi.label",
text: o.watermark,
@ -96,7 +96,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
_setEnable: function (b) {
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 () {
@ -112,12 +112,12 @@ BI.CodeEditor = BI.inherit(BI.Single, {
var value = param;
param = this.options.paramFormatter(param);
var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + param + '\u200b');
// 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection("\u200b" + param + "\u200b");
var to = this.editor.getCursor();
var options = {className: 'param', atomic: true};
var options = {className: "param", atomic: true};
if (BI.isNotNull(param.match(/^<!.*!>$/))) {
options.className = 'error-param';
options.className = "error-param";
}
options.value = value;
this.editor.markText(from, to, options);
@ -134,16 +134,16 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return this.editor.getValue("\n", function (line) {
var rawText = line.text, value = line.text, num = 0;
value.text = rawText;
//根据插入位置不同,line.markedSpan可能是乱序的
// 根据插入位置不同,line.markedSpan可能是乱序的
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) {
switch (i.marker.className) {
case "param":
case "error-param":
var fieldNameLength = i.to - i.from;
value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length);
//加上${}的偏移
// 加上${}的偏移
num += 3;
//加上实际值和显示值的长度差的偏移
// 加上实际值和显示值的长度差的偏移
num += (i.marker.value.length - fieldNameLength);
break;
}

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

@ -14,7 +14,7 @@ BI.Editor = BI.inherit(BI.Single, {
rgap: 0,
tgap: 0,
bgap: 0,
//title,warningTitle这两个属性没用
// title,warningTitle这两个属性没用
tipType: "warning",
inputType: "text",
validationChecker: BI.emptyFn,
@ -22,7 +22,7 @@ BI.Editor = BI.inherit(BI.Single, {
allowBlank: false,
watermark: "",
errorText: ""
})
});
},
_init: function () {
@ -38,12 +38,12 @@ BI.Editor = BI.inherit(BI.Single, {
allowBlank: o.allowBlank
}));
this.editor.element.css({
"width": "100%",
"height": "100%",
"border": "none",
"outline": "none",
"padding": "0",
"margin": "0"
width: "100%",
height: "100%",
border: "none",
outline: "none",
padding: "0",
margin: "0"
});
if (BI.isKey(this.options.watermark)) {
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, {
baseCls: (conf.baseCls || "") + " bi-multifile-editor",
multiple: false,
maxSize: -1,//1024 * 1024
maxSize: -1, // 1024 * 1024
accept: "",
url: ""
})
});
},
_init: function () {

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

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

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

@ -9,7 +9,7 @@ BI.Icon = BI.inherit(BI.Single, {
return BI.extend(conf, {
tagName: "i",
baseCls: (conf.baseCls || "") + " x-icon b-font horizon-center display-block"
})
});
},
_init: function () {
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: "",
width: "100%",
height: "100%"
})
});
},
_init: function () {
@ -40,11 +40,11 @@ BI.Iframe = BI.inherit(BI.Single, {
},
getWidth: function () {
return this.options.width
return this.options.width;
},
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: "",
width: "100%",
height: "100%"
})
});
},
_init: function () {

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

@ -4,8 +4,8 @@
* @type {*|void|Object}
*/
BI.Checkbox = BI.inherit(BI.IconButton, {
_defaultConfig: function() {
var conf = BI.Checkbox.superclass._defaultConfig.apply(this,arguments);
_defaultConfig: function () {
var conf = BI.Checkbox.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-checkbox check-box-icon",
selected: false,
@ -14,16 +14,16 @@ BI.Checkbox = BI.inherit(BI.IconButton, {
height: 16,
iconWidth: 16,
iconHeight: 16
})
});
},
_init : function() {
_init: function () {
BI.Checkbox.superclass._init.apply(this, arguments);
},
doClick: function(){
doClick: function () {
BI.Checkbox.superclass.doClick.apply(this, arguments);
if(this.isValid()){
if(this.isValid()) {
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",
element: "<input/>",
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,//按确定键能否退出编辑
quitChecker: BI.emptyFn, // 按确定键能否退出编辑
allowBlank: false
})
});
},
_init: function () {
@ -40,8 +40,8 @@ BI.Input = BI.inherit(BI.Single, {
}
})
.on("input propertychange", function (e) {
//这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)){
// 这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)) {
inputEventValid = true;
self._keydown_ = true;
_keydown(e.keyCode);
@ -77,7 +77,7 @@ BI.Input = BI.inherit(BI.Single, {
} else {
blur();
}
function blur() {
function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : "");
self._checkValidationOnValueChange();
@ -119,7 +119,7 @@ BI.Input = BI.inherit(BI.Single, {
this.fireEvent(BI.Input.EVENT_START);
}
}
if (ctrlKey === true && keyCode === 86) {//ctrlKey+V
if (ctrlKey === true && keyCode === 86) {// ctrlKey+V
this._valueChange();
} else {
if (keyCode == BI.KeyCode.ENTER) {
@ -157,7 +157,7 @@ BI.Input = BI.inherit(BI.Single, {
}
},
//初始状态
// 初始状态
_defaultState: function () {
if (this.getValue() == "") {
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}
*/
BI.Radio = BI.inherit(BI.IconButton, {
_defaultConfig: function() {
var conf = BI.Radio.superclass._defaultConfig.apply(this,arguments);
_defaultConfig: function () {
var conf = BI.Radio.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-radio radio-icon",
selected: false,
@ -14,16 +14,16 @@ BI.Radio = BI.inherit(BI.IconButton, {
height: 16,
iconWidth: 16,
iconHeight: 16
})
});
},
_init : function() {
_init: function () {
BI.Radio.superclass._init.apply(this, arguments);
},
doClick: function(){
doClick: function () {
BI.Radio.superclass.doClick.apply(this, arguments);
if(this.isValid()){
if(this.isValid()) {
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, {
baseCls: (conf.baseCls || "") + " bi-label",
textAlign: "center",
whiteSpace: "nowrap", //normal or nowrap
forceCenter: false, //是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
whiteSpace: "nowrap", // normal or nowrap
forceCenter: false, // 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
textWidth: null,
textHeight: null,
hgap: 0,
@ -21,7 +21,7 @@ BI.Label = BI.inherit(BI.Single, {
text: "",
py: "",
keyword: ""
})
});
},
_createJson: function () {
@ -226,7 +226,7 @@ BI.Label = BI.inherit(BI.Single, {
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
})
});
},
_createNotCenterEl: function () {
@ -344,7 +344,7 @@ BI.Label = BI.inherit(BI.Single, {
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json)
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
@ -424,7 +424,7 @@ BI.Label = BI.inherit(BI.Single, {
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
})
});
},
doRedMark: function () {
@ -453,7 +453,7 @@ BI.Label = BI.inherit(BI.Single, {
},
setStyle: function (css) {
this.text.setStyle(css)
this.text.setStyle(css);
},
setValue: function (v) {

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

@ -4,19 +4,19 @@
* @extends BI.Text
*/
BI.Link = BI.inherit(BI.Label, {
_defaultConfig: function() {
_defaultConfig: function () {
var conf = BI.Link.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-link",
href: "",
target: "_blank"
})
});
},
_createJson: function(){
_createJson: function () {
var o = this.options;
return {
type:"bi.a",
type: "bi.a",
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
lineHeight: o.textHeight,
@ -29,7 +29,7 @@ BI.Link = BI.inherit(BI.Label, {
};
},
_init : function() {
_init: function () {
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,
tipType: null, // success或warning
value: null
})
});
},
_showToolTip: function (e, opt) {
@ -88,7 +88,7 @@ BI.Single = BI.inherit(BI.Widget, {
},
disabledHover: function () {
//取消hover事件
// 取消hover事件
if (BI.isNotNull(this.timeout)) {
clearTimeout(this.timeout);
}
@ -103,7 +103,7 @@ BI.Single = BI.inherit(BI.Widget, {
this.items = items || [];
},
//opt: {container: '', belowMouse: false}
// opt: {container: '', belowMouse: false}
setTitle: function (title, opt) {
this.options.title = title;
if (BI.isKey(title)) {

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

Loading…
Cancel
Save