Browse Source

Merge pull request #39 in FUI/fineui from ~GUY/fineui:master to master

* commit '48e4b1ce8a9f94818e347da377e6ed1f26dcb69e': (24 commits)
  支持图表
  数值区间
  editor
  样式
  text_editor的error
  add
  add
  以周日为一周第一天
  bug
  update
  下拉框
  add
  setVisible的display属性设置
  去样式
  表格
  update
  IE8兼容
  月份偏移方法
  update
  buttongroup的removeAt方法写错了
  ...
es6
guy 7 years ago
parent
commit
bd299f536b
  1. 18
      Gruntfile.js
  2. 114
      bi/base.css
  3. 205
      bi/base.js
  4. 246
      bi/case.js
  5. 7600
      bi/chart.js
  6. 63
      bi/core.css
  7. 306
      bi/core.js
  8. 35
      bi/widget.css
  9. 74
      bi/widget.js
  10. 6
      demo.html
  11. 21
      demo/config.js
  12. 124
      demo/js/base/button/demo.button.js
  13. 1
      demo/js/center.js
  14. 70
      demo/js/chart/demo.axis_chart.js
  15. 8
      demo/js/config/chart.js
  16. 6
      demo/js/config/component.js
  17. 114
      docs/base.css
  18. 205
      docs/base.js
  19. 668
      docs/biconst.js
  20. 246
      docs/case.js
  21. 7600
      docs/chart.js
  22. 63
      docs/core.css
  23. 306
      docs/core.js
  24. 231
      docs/demo.js
  25. 5
      docs/index.html
  26. 32
      docs/resource.css
  27. 167
      docs/vancharts-all.js
  28. 35
      docs/widget.css
  29. 74
      docs/widget.js
  30. 156
      src/addons/chart/chart.combine.js
  31. 53
      src/addons/chart/chart.js
  32. 286
      src/addons/chart/chart/chart.abstract.js
  33. 277
      src/addons/chart/chart/chart.accumulatearea.js
  34. 280
      src/addons/chart/chart/chart.accumulateaxis.js
  35. 246
      src/addons/chart/chart/chart.accumulatebar.js
  36. 194
      src/addons/chart/chart/chart.accumulateradar.js
  37. 302
      src/addons/chart/chart/chart.area.js
  38. 276
      src/addons/chart/chart/chart.axis.js
  39. 241
      src/addons/chart/chart/chart.bar.js
  40. 282
      src/addons/chart/chart/chart.bubble.js
  41. 373
      src/addons/chart/chart/chart.comparearea.js
  42. 381
      src/addons/chart/chart/chart.compareaxis.js
  43. 253
      src/addons/chart/chart/chart.comparebar.js
  44. 398
      src/addons/chart/chart/chart.dashboard.js
  45. 103
      src/addons/chart/chart/chart.donut.js
  46. 310
      src/addons/chart/chart/chart.fallaxis.js
  47. 87
      src/addons/chart/chart/chart.forcebubble.js
  48. 160
      src/addons/chart/chart/chart.gismap.js
  49. 297
      src/addons/chart/chart/chart.line.js
  50. 361
      src/addons/chart/chart/chart.map.js
  51. 322
      src/addons/chart/chart/chart.multiaxis.js
  52. 324
      src/addons/chart/chart/chart.multiaxiscombine.js
  53. 245
      src/addons/chart/chart/chart.percentaccumulatearea.js
  54. 240
      src/addons/chart/chart/chart.percentaccumulateaxis.js
  55. 153
      src/addons/chart/chart/chart.pie.js
  56. 185
      src/addons/chart/chart/chart.radar.js
  57. 284
      src/addons/chart/chart/chart.rangearea.js
  58. 266
      src/addons/chart/chart/chart.scatter.js
  59. 291
      src/addons/chart/factory.charts.js
  60. 4
      src/base/combination/combo.js
  61. 2
      src/base/combination/group.button.js
  62. 2
      src/base/single/button/button.basic.js
  63. 30
      src/base/single/button/buttons/button.js
  64. 7
      src/base/single/tip/tip.tooltip.js
  65. 155
      src/base/table/native.scrollbar.js
  66. 6
      src/base/table/table.grid.scrollbar.js
  67. 6
      src/case/combo/bubblecombo/combo.bubble.js
  68. 2
      src/case/combo/bubblecombo/popup.bubble.js
  69. 162
      src/case/editor/editor.adapt.js
  70. 2
      src/case/editor/editor.search.js
  71. 15
      src/case/editor/editor.shelter.js
  72. 2
      src/case/editor/editor.sign.initial.js
  73. 17
      src/case/editor/editor.sign.js
  74. 20
      src/case/editor/editor.state.js
  75. 2
      src/case/editor/editor.state.simple.js
  76. 4
      src/case/editor/editor.text.js
  77. 7
      src/case/layer/pane.list.js
  78. 4
      src/case/loader/sort.list.js
  79. 2
      src/case/trigger/trigger.text.select.js
  80. 2
      src/case/zclip/zclip.js
  81. 15
      src/config.js
  82. 20
      src/core/base.js
  83. 1
      src/core/controller/controller.tooltips.js
  84. 2
      src/core/controller/router.floatbox.js
  85. 4
      src/core/func/dom.js
  86. 3
      src/core/func/function.js
  87. 26
      src/core/proto/date.js
  88. 5
      src/core/widget.js
  89. 98
      src/core/wrapper/layout/adapt/inline.center.js
  90. 72
      src/core/wrapper/layout/adapt/inline.vertical.js
  91. 63
      src/core/wrapper/layout/layout.inline.js
  92. 3
      src/css/base/combo/popup.bubble.css
  93. 101
      src/css/base/single/button/button.css
  94. 6
      src/css/base/single/editor/editor.textarea.css
  95. 4
      src/css/base/table/table.grid.scrollbar.css
  96. 63
      src/css/core/utils/common.css
  97. 26
      src/css/resource/app.css
  98. 6
      src/css/resource/background.css
  99. 7
      src/css/widget/image/button/href/image.button.href.css
  100. 6
      src/css/widget/image/button/size/image.button.size.css
  101. Some files were not shown because too many files have changed in this diff Show More

18
Gruntfile.js

@ -102,6 +102,15 @@ module.exports = function (grunt) {
],
dest: "docs/widget.js"
},
chartJs: {
src: [
'src/addons/chart/chart.js',
'src/addons/chart/chart.combine.js',
'src/addons/chart/factory.charts.js',
'src/addons/chart/**/*.js'
],
dest: "docs/chart.js"
},
coreCss: {
src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'],
dest: 'docs/core.css'
@ -201,6 +210,15 @@ module.exports = function (grunt) {
],
dest: "bi/widget.js"
},
bi_chartJs: {
src: [
'src/addons/chart/chart.js',
'src/addons/chart/chart.combine.js',
'src/addons/chart/factory.charts.js',
'src/addons/chart/**/*.js'
],
dest: "bi/chart.js"
},
bi_coreCss: {
src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'],
dest: 'bi/core.css'

114
bi/base.css

@ -68,9 +68,6 @@
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.bi-bubble-popup-view .bubble-popup-line {
background-color: #3f8ce8;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
@ -717,60 +714,96 @@ li.CodeMirror-hint-active {
cursor: pointer;
font-size: 14px;
}
.bi-button.button-common,
.bi-button.button-common .b-font {
color: #ffffff;
.bi-button.block {
font-size: inherit;
border-width: 0;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.bi-button.clear {
font-size: inherit;
border-width: 0;
background-color: transparent;
}
.bi-button.clear:hover,
.bi-button.clear:active {
opacity: 0.75;
filter: alpha(opacity=75);
}
.bi-button.button-common,
.bi-button.button-common .b-font:before {
color: #ffffff;
}
.bi-button.button-common.clear,
.bi-button.button-common.clear .b-font:before {
color: #3f8ce8;
}
.bi-button.button-ignore {
background-color: #ffffff;
border-color: #d4dadd;
}
.bi-button.button-ignore,
.bi-button.button-ignore .b-font {
.bi-button.button-ignore .b-font:before {
color: #1a1a1a;
}
.bi-button.button-ignore.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-success {
background-color: #58cc7d;
border-color: #58cc7d;
}
.bi-button.button-success,
.bi-button.button-success .b-font {
color: #ffffff;
}
.bi-button.button-success .b-font:before {
color: #ffffff;
}
.bi-button.button-success.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-success.clear,
.bi-button.button-success.clear .b-font:before {
color: #0c6d23;
}
.bi-button.button-warning {
background-color: #e85050;
border-color: #e85050;
}
.bi-button.button-warning,
.bi-button.button-warning .b-font {
color: #ffffff;
}
.bi-button.button-warning .b-font:before {
color: #ffffff;
}
.bi-button.button-warning.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-warning.clear,
.bi-button.button-warning.clear .b-font:before {
color: #e85050;
}
.bi-button.button-common.disabled,
.bi-button.button-success.disabled,
.bi-button.button-warning.disabled {
.bi-button.button-warning.disabled,
.bi-button.button-common.disabled.base-disabled,
.bi-button.button-success.disabled.base-disabled,
.bi-button.button-warning.disabled.base-disabled {
background: #cccccc !important;
border-color: #c4c6c6 !important;
border-color: #cccccc !important;
}
.bi-button.button-common.disabled,
.bi-button.button-success.disabled,
.bi-button.button-warning.disabled,
.bi-button.button-common.disabled .b-font,
.bi-button.button-success.disabled .b-font,
.bi-button.button-warning.disabled .b-font {
color: #ffffff !important;
}
.bi-button.button-common.disabled.base-disabled,
.bi-button.button-success.disabled.base-disabled,
.bi-button.button-warning.disabled.base-disabled,
.bi-button.button-common.disabled .b-font:before,
.bi-button.button-success.disabled .b-font:before,
.bi-button.button-warning.disabled .b-font:before {
.bi-button.button-warning.disabled .b-font:before,
.bi-button.button-common.disabled.base-disabled .b-font:before,
.bi-button.button-success.disabled.base-disabled .b-font:before,
.bi-button.button-warning.disabled.base-disabled .b-font:before {
color: #ffffff !important;
}
.bi-button.button-ignore.disabled {
@ -778,12 +811,37 @@ li.CodeMirror-hint-active {
border-color: #d4dadd !important;
}
.bi-button.button-ignore.disabled,
.bi-button.button-ignore.disabled .b-font {
.bi-button.button-ignore.disabled .b-font:before {
color: #cccccc !important;
}
.bi-button.button-ignore.disabled .b-font:before {
.bi-button.button-common.disabled.clear,
.bi-button.button-success.disabled.clear,
.bi-button.button-warning.disabled.clear,
.bi-button.button-ignore.disabled.clear {
background: transparent !important;
border-width: 0 !important;
}
.bi-button.button-common.disabled.clear,
.bi-button.button-success.disabled.clear,
.bi-button.button-warning.disabled.clear,
.bi-button.button-ignore.disabled.clear,
.bi-button.button-common.disabled.clear .b-font:before,
.bi-button.button-success.disabled.clear .b-font:before,
.bi-button.button-warning.disabled.clear .b-font:before,
.bi-button.button-ignore.disabled.clear .b-font:before {
color: #cccccc !important;
}
.bi-button.button-common.disabled.clear:hover,
.bi-button.button-success.disabled.clear:hover,
.bi-button.button-warning.disabled.clear:hover,
.bi-button.button-ignore.disabled.clear:hover,
.bi-button.button-common.disabled.clear:active,
.bi-button.button-success.disabled.clear:active,
.bi-button.button-warning.disabled.clear:active,
.bi-button.button-ignore.disabled.clear:active {
opacity: 1;
filter: alpha(opacity=100);
}
.bi-basic-button.button-common .bi-button-mask,
.bi-basic-button.button-success .bi-button-mask,
.bi-basic-button.button-warning .bi-button-mask {
@ -862,6 +920,12 @@ li.CodeMirror-hint-active {
.bi-textarea-editor .textarea-editor-content {
border: none;
}
.bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #d4dadd;
}
.bi-theme-dark .bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #525466;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
@ -1199,13 +1263,13 @@ li.CodeMirror-hint-active {
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-faceActive:after {
.public-scrollbar-face-active:after {
background-color: rgba(102, 102, 102, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666,endColorstr=#b3666666);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-faceActive:after {
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(204, 204, 204, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc,endColorstr=#b3cccccc);
}

205
bi/base.js

@ -599,7 +599,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
stopPropagation: false,
selected: false,
once: false, //点击一次选中有效,再点无效
forceSelected: false, //点击即选中, 选中了就不会被取消
forceSelected: false, //点击即选中, 选中了就不会被取消,与once的区别是forceSelected不影响事件的触发
forceNotSelected: false, //无论怎么点击都不会被选中
disableSelected: false, //使能选中
@ -1135,7 +1135,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
removeItemAt: function (indexes) {
BI.remove(this.buttons, indexes);
BI.removeAt(this.buttons, indexes);
this.layouts.removeItemAt(indexes);
},
@ -2935,7 +2935,7 @@ BI.Combo = BI.inherit(BI.Widget, {
}
}
}, BI.EVENT_RESPONSE_TIME, true);
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e);
st(e);
});
@ -3051,7 +3051,7 @@ BI.Combo = BI.inherit(BI.Widget, {
break;
case "top":
case "top,right":
p = $.getComboPosition(this.combo, this.popupView, 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":
@ -15883,25 +15883,25 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/
BI.Button = BI.inherit(BI.BasicButton, {
_const: {
minWidth: 90
},
_defaultConfig: function () {
_defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + ' bi-button',
shadow: true,
minWidth: (props.block === true || props.clear === true) ? 0 : 90,
shadow: props.clear !== true,
isShadowShowingOnSelected: true,
readonly: true,
iconClass: "",
level: 'common',
block: false, //是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, //是否去掉边框和背景
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: 10,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
@ -15913,8 +15913,10 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
_init: function () {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height)) {
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'});
} else {
this.element.css({lineHeight: o.height + 'px'});
}
if (BI.isKey(o.iconClass)) {
this.icon = BI.createWidget({
@ -15961,7 +15963,15 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
value: o.value
});
}
this.element.css({"min-width": this._const.minWidth - 2 + "px"});
if (o.block === true) {
this.element.addClass("block");
}
if (o.clear === true) {
this.element.addClass("clear");
}
if (o.minWidth > 2) {
this.element.css({"min-width": o.minWidth - 2 + "px"});
}
},
doClick: function () {
@ -15985,8 +15995,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
setEnable: function (b) {
BI.Button.superclass.setEnable.apply(this, arguments);
this.text.setEnable(b);
this.icon && this.icon.setEnable(b);
// this.text.setEnable(b);
// this.icon && this.icon.setEnable(b);
},
doRedMark: function () {
@ -19759,6 +19769,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
extraCls: "bi-tooltip",
text: "",
level: "success",//success或warning
stopEvent: false,
stopPropagation: false,
height: 20
})
},
@ -19767,9 +19779,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
var self = this, o = this.options;
this.element.addClass("tooltip-" + o.level);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
o.stopPropagation && e.stopPropagation();
o.stopEvent && e.stopEvent();
};
this.element.bind({
"click": fn,
@ -28225,6 +28236,160 @@ BI.Svg = BI.inherit(BI.Widget, {
}
});
BI.shortcut("bi.svg", BI.Svg);/**
*
* 原生表格滚动条为了IE8的兼容
*
* Created by GUY on 2016/1/12.
* @class BI.NativeTableScrollbar
* @extends BI.Widget
*/
BI.NativeTableScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
defaultPosition: 0,
position: 0,
size: 0
})
},
render: function () {
var self = this, o = this.options;
//把滚动台size改掉
BI.GridTableScrollbar.SIZE = 16;
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrolly: true,
items: [{
type: "bi.layout",
width: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
}
},
mounted: function () {
this._populate();
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollTop(o.position);
} catch (e) {
}
this.inner.element.height(o.contentSize);
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setHeight(size);
this.options.size = size;
},
populate: function () {
this._populate();
}
});
BI.NativeTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_scrollbar", BI.NativeTableScrollbar);
BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
position: 0,
size: 0
})
},
render: function () {
var self = this, o = this.options;
//把滚动台size改掉
BI.GridTableScrollbar.SIZE = 16;
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrollx: true,
items: [{
type: "bi.layout",
height: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
}
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setWidth(size);
this.options.size = size;
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollLeft(o.position);
} catch (e) {
}
this.inner.element.width(o.contentSize);
},
populate: function () {
this._populate();
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
@ -29821,7 +29986,11 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
} else {
this._mouseMoveTracker.captureMouseMoves(e);
}
this.element[0].focus();
try {
this.element[0].focus();
} catch (e) {
}
},
_onMouseMove: function (deltaX, deltaY) {

246
bi/case.js

@ -3527,7 +3527,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
type: "bi.center_adapt",
items: [{
type: "bi.layout",
cls: "bubble-combo-triangle-" + direction
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
}]
});
pos.el = this.triangle;
@ -3592,6 +3592,10 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
showView: function () {
this.combo && this.combo.showView();
},
hasView: function () {
return BI.isNotNull(this.combo.getView());
}
});
@ -3663,7 +3667,7 @@ BI.BubblePopupView = BI.inherit(BI.PopupView, {
}
this.line = BI.createWidget(op, {
type: "bi.layout",
cls: "bubble-popup-line"
cls: "bubble-popup-line bi-high-light-background"
});
pos.el = this.line;
BI.createWidget({
@ -4899,167 +4903,6 @@ BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, {
}
});
BI.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/**
* 根据内容自适应长度的输入框
* @class BI.AdaptiveEditor
* @extends BI.Single
*/
BI.AdaptiveEditor = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.AdaptiveEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-adapt-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
mouseOut: false,
allowBlank: true,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.AdaptiveEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.sign_editor",
element: this,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
mouseOut: o.mouseOut,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_FOCUS);
});
this.editor.on(BI.SignEditor.EVENT_BLUR, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_BLUR);
});
this.editor.on(BI.SignEditor.EVENT_CLICK, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_CLICK);
});
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () {
self._checkEditorLength();
self.fireEvent(BI.AdaptiveEditor.EVENT_CHANGE);
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.AdaptiveEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.SignEditor.EVENT_VALID, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_VALID);
});
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_CONFIRM);
});
this.editor.on(BI.SignEditor.EVENT_START, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_START);
});
this.editor.on(BI.SignEditor.EVENT_PAUSE, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_STOP);
});
this.editor.on(BI.SignEditor.EVENT_SPACE, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_SPACE);
});
this.editor.on(BI.SignEditor.EVENT_ERROR, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_ERROR);
});
this.editor.on(BI.SignEditor.EVENT_ENTER, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_ENTER);
});
this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_RESTRICT);
});
this.editor.on(BI.SignEditor.EVENT_EMPTY, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_EMPTY);
});
this._checkEditorLength();
},
_checkEditorLength: function () {
var o = this.options;
this.element.width(BI.DOM.getTextSizeWidth(this.getValue(), 14) + 2 * o.hgap + o.lgap + o.rgap);
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
isValid: function () {
return this.editor.isValid();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
setValue: function (k) {
this.editor.setValue(k);
this._checkEditorLength();
},
getValue: function () {
return this.editor.getValue();
},
getState: function () {
return this.editor.getState();
},
setState: function (v) {
}
});
BI.AdaptiveEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.AdaptiveEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.AdaptiveEditor.EVENT_BLUR = "EVENT_BLUR";
BI.AdaptiveEditor.EVENT_CLICK = "EVENT_CLICK";
BI.AdaptiveEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.AdaptiveEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.AdaptiveEditor.EVENT_START = "EVENT_START";
BI.AdaptiveEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.AdaptiveEditor.EVENT_STOP = "EVENT_STOP";
BI.AdaptiveEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.AdaptiveEditor.EVENT_VALID = "EVENT_VALID";
BI.AdaptiveEditor.EVENT_ERROR = "EVENT_ERROR";
BI.AdaptiveEditor.EVENT_ENTER = "EVENT_ENTER";
BI.AdaptiveEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.AdaptiveEditor.EVENT_SPACE = "EVENT_SPACE";
BI.AdaptiveEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.adapt_editor", BI.AdaptiveEditor);/**
* 有清楚按钮的文本框
* Created by GUY on 2015/9/29.
* @class BI.SmallTextEditor
@ -5402,7 +5245,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
setEnable: function (b) {
BI.Editor.superclass.setEnable.apply(this, arguments);
this.editor && this.editor.setEnable(b);
this.clear.setEnabled(b);
this.clear.setEnable(b);
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";
@ -5447,9 +5290,9 @@ BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/**
* 带标记的文本框
* Created by GUY on 2016/1/25.
* @class BI.ShelterEditor
* @extends BI.Single
* @extends BI.Widget
*/
BI.ShelterEditor = BI.inherit(BI.Single, {
BI.ShelterEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -5494,6 +5337,9 @@ BI.ShelterEditor = BI.inherit(BI.Single, {
this.text = BI.createWidget({
type: "bi.text_button",
cls: "shelter-editor-text",
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: o.textAlign,
height: o.height,
hgap: 4
@ -5599,6 +5445,14 @@ BI.ShelterEditor = BI.inherit(BI.Single, {
this.text.visible();
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
focus: function () {
this._showInput();
this.editor.focus();
@ -5697,7 +5551,7 @@ BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/**
* @class BI.SignInitialEditor
* @extends BI.Single
*/
BI.SignInitialEditor = BI.inherit(BI.Single, {
BI.SignInitialEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -5860,9 +5714,9 @@ BI.shortcut("bi.sign_initial_editor", BI.SignInitialEditor);/**
* 带标记的文本框
* Created by GUY on 2015/8/28.
* @class BI.SignEditor
* @extends BI.Single
* @extends BI.Widget
*/
BI.SignEditor = BI.inherit(BI.Single, {
BI.SignEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -5906,6 +5760,9 @@ BI.SignEditor = BI.inherit(BI.Single, {
this.text = BI.createWidget({
type: "bi.text_button",
cls: "sign-editor-text",
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
height: o.height,
hgap: 4,
@ -6016,6 +5873,14 @@ BI.SignEditor = BI.inherit(BI.Single, {
this.text.visible();
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
focus: function () {
this._showInput();
this.editor.focus();
@ -6053,7 +5918,7 @@ BI.SignEditor = BI.inherit(BI.Single, {
return this.editor.isValid();
},
setValid: function(v){
setValid: function (v) {
BI.SignEditor.superclass.setValid.apply(this, arguments);
this.editor.setValid(v);
},
@ -6116,7 +5981,7 @@ BI.shortcut("bi.sign_editor", BI.SignEditor);/**
* @class BI.StateEditor
* @extends BI.Single
*/
BI.StateEditor = BI.inherit(BI.Single, {
BI.StateEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -6345,15 +6210,15 @@ BI.StateEditor = BI.inherit(BI.Single, {
return;
}
if (BI.isString(v)) {
if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setTitle("");
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(v);
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
}
// if (BI.isEmpty(v)) {
// this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
// this.text.setTitle("");
// this.text.element.addClass("state-editor-infinite-text");
// } else {
this.text.setText(v);
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
// }
return;
}
if (BI.isArray(v)) {
@ -6396,7 +6261,7 @@ BI.shortcut("bi.state_editor", BI.StateEditor);/**
* @class BI.SimpleStateEditor
* @extends BI.Single
*/
BI.SimpleStateEditor = BI.inherit(BI.Single, {
BI.SimpleStateEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -6655,7 +6520,7 @@ BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/**
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Single, {
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -6748,7 +6613,7 @@ BI.TextEditor = BI.inherit(BI.Single, {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR);
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);
@ -7177,6 +7042,13 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.check();
},
removeItemAt: function (indexes) {
indexes = indexes || [];
BI.removeAt(this.options.items, indexes);
this.button_group.removeItemAt.apply(this.button_group, arguments);
this.check();
},
populate: function (items) {
var self = this, o = this.options;
if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法
@ -7897,8 +7769,8 @@ BI.SortList = BI.inherit(BI.Widget, {
containment: o.containment || this.element,
connectWith: o.connectWith || ".bi-sort-list",
items: ".sort-item",
cursor: "drag",
tolerance: "intersect",
cursor: o.cursor || "drag",
tolerance: o.tolerance || "intersect",
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
@ -11335,10 +11207,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
}
},
@ -11976,7 +11846,7 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, {
_init: function () {
BI.ZeroClip.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.nextTick(function () {
self.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf",

7600
bi/chart.js

File diff suppressed because it is too large Load Diff

63
bi/core.css

@ -3047,6 +3047,9 @@ i {
background-color: #3f8ce8;
color: #ffffff;
}
.bi-high-light-border {
border-color: #178cdf;
}
.bi-water-mark {
color: #cccccc;
cursor: text;
@ -3063,10 +3066,20 @@ i {
.bi-theme-dark .bi-resizer {
background: #ffffff;
}
.bi-mask {
color: #ffffff;
background-color: rgba(26, 26, 26, 0.2);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#331a1a1a,endColorstr=#331a1a1a);
}
.bi-theme-dark .bi-mask {
color: #242640;
background-color: rgba(255, 255, 255, 0.2);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff,endColorstr=#33ffffff);
}
.bi-z-index-mask {
color: #ffffff;
background-color: rgba(26, 26, 26, 0.5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a);
background-color: rgba(26, 26, 26, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d1a1a1a,endColorstr=#4d1a1a1a);
}
.bi-list-item:hover,
.bi-list-item.hover {
@ -3102,6 +3115,10 @@ i {
.bi-theme-dark .bi-list-item.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-border:active,
.bi-list-item-border.active {
border: 1px solid #178cdf;
}
.bi-list-item-simple {
color: #999999;
}
@ -3200,6 +3217,48 @@ i {
.bi-theme-dark .bi-list-item-active.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-active2:hover,
.bi-list-item-active2.hover {
color: #1a1a1a;
background-color: #ffffff;
}
.bi-list-item-active2.active,
.bi-list-item-active2:active {
color: #3f8ce8;
background-color: #ffffff;
}
.bi-list-item-active2.disabled,
.bi-list-item-active2.disabled:hover,
.bi-list-item-active2.disabled:active {
background-color: transparent !important;
color: #cccccc !important;
}
.bi-list-item-active2.disabled .bi-high-light,
.bi-list-item-active2.disabled:hover .bi-high-light,
.bi-list-item-active2.disabled:active .bi-high-light {
color: #cccccc !important;
}
.bi-theme-dark .bi-list-item-active2:hover,
.bi-theme-dark .bi-list-item-active2.hover {
color: #ffffff;
background-color: #242640;
}
.bi-theme-dark .bi-list-item-active2.active,
.bi-theme-dark .bi-list-item-active2:active {
color: #3f8ce8;
background-color: #242640;
}
.bi-theme-dark .bi-list-item-active2.disabled,
.bi-theme-dark .bi-list-item-active2.disabled:hover,
.bi-theme-dark .bi-list-item-active2.disabled:active {
background-color: transparent !important;
color: #666666 !important;
}
.bi-theme-dark .bi-list-item-active2.disabled .bi-high-light,
.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-high-light,
.bi-theme-dark .bi-list-item-active2.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-select:hover,
.bi-list-item-select.hover {
color: #1a1a1a;

306
bi/core.js

@ -2920,6 +2920,26 @@ if (!window.BI) {
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
},
isIE9Below: function () {
if (!BI.isIE()) {
return false;
}
var version = 0;
var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/);
var v2 = agent.match(/(?:trident.*rv:([\w.]+))/);
if (v1 && v2 && v1[1] && v2[1]) {
version = Math.max(v1[1] * 1, v2[1] * 1);
} else if (v1 && v1[1]) {
version = v1[1] * 1;
} else if (v2 && v2[1]) {
version = v2[1] * 1;
} else {
version = 0;
}
return version < 9;
},
isEdge: function () {
return /edge/i.test(navigator.userAgent.toLowerCase());
},
@ -4492,11 +4512,12 @@ BI.Widget = BI.inherit(BI.OB, {
setVisible: function (visible) {
if (visible === true) {
this.options.invisible = false;
this.element.show();
//用this.element.show()会把display属性改成block
this.element.css("display", "");
this._mount();
} else if (visible === false) {
this.options.invisible = true;
this.element.hide();
this.element.css("display", "none");
}
this.fireEvent(BI.Events.VIEW, visible);
},
@ -6354,6 +6375,32 @@ Date.prototype.getQuarterStartMonth = function () {
}
return quarterStartMonth;
};
//指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime());
var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if(day > monthDay){
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
};
//获得本周的起始日期
Date.prototype.getWeekStartDate = function () {
var w = this.getDay();
return this.getOffsetDate(-w);
};
//得到本周的结束日期
Date.prototype.getWeekEndDate = function () {
var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w);
return this.getOffsetDate(offset);
};
//获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);
@ -12443,174 +12490,6 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut('bi.horizontal_float', BI.FloatHorizontalLayout);/**
* 内联布局
* @class BI.InlineCenterAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineCenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-center-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + "-" + i)) {
var t = BI.createWidget(item);
t.element.css({
"position": "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + "-" + i, w);
} else {
var w = this.getWidgetByName(this.getName() + "-" + i);
}
w.element.css({
"position": "relative",
"display": "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("cannot be added");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (!!item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineCenterAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline_center_adapt', BI.InlineCenterAdaptLayout);/**
* 内联布局
* @class BI.InlineVerticalAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineVerticalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-vertical-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
"position": "relative",
"display": "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1
});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.InlineVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline_vertical_adapt', BI.InlineVerticalAdaptLayout);/**
*自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2.
*
@ -14178,68 +14057,6 @@ BI.HorizontalCellLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut('bi.horizontal_cell', BI.HorizontalCellLayout);/**
* 内联布局
* @class BI.InlineLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function(){
this.stroke(this.options.items);
},
populate: function (items) {
BI.InlineLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline', BI.InlineLayout);/**
* 靠左对齐的自由浮动布局
* @class BI.LatticeLayout
* @extends BI.Layout
@ -16139,6 +15956,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
type: "bi.tooltip",
text: text,
level: level,
stopEvent: true,
height: this._const.height
});
},
@ -16333,7 +16151,7 @@ BI.FloatBoxRouter = BI.inherit(BI.WRouter, {
if(this.controller){
this.controller.remove(url);
delete this.store[url];
this.views[url] && this.views[url].destroy();
this.views[url] && this.views[url].model.destroy();
delete this.views[url];
}
return this;
@ -17021,7 +16839,9 @@ BI.extend(jQuery, {
}
break;
}
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
if(needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
}
return position;
}
});/**
@ -17163,6 +16983,9 @@ $(function () {
//获取对比颜色
getContrastColor: function (color) {
if (!color) {
return "";
}
if (this.isDarkColor(color)) {
return "#ffffff";
}
@ -17808,6 +17631,21 @@ $(function () {
return ob;
}
});
//注册滚动条
BI.Plugin.registerWidget("bi.grid_table_scrollbar", function (ob) {
if (BI.isIE9Below()) {
return BI.extend(ob, {type: "bi.native_table_scrollbar"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.grid_table_horizontal_scrollbar", function (ob) {
if (BI.isIE9Below()) {
return BI.extend(ob, {type: "bi.native_table_horizontal_scrollbar"});
} else {
return ob;
}
});
//注册控件
BI.Plugin.registerWidget("bi.grid_table", function (ob) {

35
bi/widget.css

@ -190,33 +190,6 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-image-button-href .image-button-href-icon-button {
z-index: 1;
font-size: 16px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-image-button-size .image-button-size-button-group {
font-size: 12px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-upload-image .upload-image-text-button-label {
font-size: 14px;
color: #999999;
}
.bi-upload-image .upload-image-icon-button {
z-index: 1;
font-size: 16px;
}
.bi-upload-image .upload-image-delete-label {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-interactive-arrangement .interactive-arrangement-dragtag-line {
z-index: 1000000000;
background-color: #f07d0a;
@ -397,6 +370,14 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-preview-table {
-webkit-user-select: initial;
-khtml-user-select: initial;
-moz-user-select: initial;
-ms-user-select: initial;
-o-user-select: initial;
user-select: initial;
}
.bi-preview-table > div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #eff1f4;

74
bi/widget.js

@ -173,12 +173,18 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
items[1].height = 0;
} else if (o.isNeedFreeze === true) {
items[0].height = headerHeight;
items[1].height = 2;
}
this.layout.attr("items", items);
this.layout.resize();
this.scrollContainer.element.scrollTop(o.scrollTop);
try {
this.scrollContainer.element.scrollTop(o.scrollTop);
} catch (e) {
}
},
_getHeaderHeight: function () {
@ -352,7 +358,11 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
setVerticalScroll: function (scrollTop) {
if (this.options.scrollTop !== scrollTop) {
this.options.scrollTop = scrollTop;
this.scrollContainer.element.scrollTop(scrollTop);
try {
this.scrollContainer.element.scrollTop(scrollTop);
} catch (e) {
}
}
},
@ -945,7 +955,7 @@ BI.ArrangementBlock = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ArrangementBlock.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-arrangement-block bi-resizer"
baseCls: "bi-arrangement-block bi-mask"
});
},
@ -4951,7 +4961,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
self.fireEvent(BI.DateTrigger.EVENT_ERROR);
});
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () {
var value = self.editor.getState();
var value = self.editor.getValue();
if (BI.isNotNull(value)) {
self.editor.setState(value);
}
@ -9853,7 +9863,6 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
this.storeValue = v || {};
this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue);
this.trigger.setValue(this.storeValue);
},
getValue: function () {
@ -12261,7 +12270,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
var self = this, c = this.constants, o = this.options;
BI.NumericalInterval.superclass._init.apply(this, arguments)
this.smallEditor = BI.createWidget({
type: "bi.sign_editor",
type: "bi.editor",
height: o.height - 2,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true,
@ -12298,7 +12307,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
});
this.bigEditor = BI.createWidget({
type: "bi.sign_editor",
type: "bi.editor",
height: o.height - 2,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true,
@ -12525,7 +12534,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setFocusEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.SignEditor.EVENT_FOCUS, function () {
w.on(BI.Editor.EVENT_FOCUS, function () {
self._setTitle("");
switch (self._checkValidation()) {
case c.typeError:
@ -12551,7 +12560,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
},
_setBlurEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.SignEditor.EVENT_BLUR, function () {
w.on(BI.Editor.EVENT_BLUR, function () {
BI.Bubbles.hide(c.typeError);
BI.Bubbles.hide(c.numberError);
BI.Bubbles.hide(c.signalError);
@ -12573,7 +12582,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setErrorEvent: function (w) {
var c = this.constants, self = this
w.on(BI.SignEditor.EVENT_ERROR, function () {
w.on(BI.Editor.EVENT_ERROR, function () {
self._checkValidation();
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
offsetStyle: "center"
@ -12585,7 +12594,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setValidEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.SignEditor.EVENT_VALID, function () {
w.on(BI.Editor.EVENT_VALID, function () {
switch (self._checkValidation()) {
case c.numberError:
BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, {
@ -12608,7 +12617,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setEditorValueChangedEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.SignEditor.EVENT_CHANGE, function () {
w.on(BI.Editor.EVENT_CHANGE, function () {
switch (self._checkValidation()) {
case c.typeError:
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
@ -13045,6 +13054,18 @@ BI.PageTable = BI.inherit(BI.Widget, {
return this.table.getVerticalScroll();
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
restore: function () {
this.table.restore();
},
@ -15797,6 +15818,9 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
items: [{
el: this.headerContainer,
height: o.headerRowSize * o.header.length - 2
}, {
el: {type: "bi.layout"},
height: 2
}, {
el: this.scrollContainer
}]
@ -15806,17 +15830,23 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
_layout: function () {
var self = this, o = this.options;
var headerHeight = o.headerRowSize * o.header.length;
var headerHeight = o.headerRowSize * o.header.length - 2;
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
items[1].height = 0;
} else if (o.isNeedFreeze === true) {
items[0].height = headerHeight;
items[1].height = 2;
}
this.layout.attr("items", items);
this.layout.resize();
this.container.setHeight(o.items.length * o.rowSize);
this.scrollContainer.element.scrollTop(o.scrollTop);
try {
this.scrollContainer.element.scrollTop(o.scrollTop);
} catch (e) {
}
},
_createHeader: function () {
@ -15925,7 +15955,11 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
setVerticalScroll: function (scrollTop) {
if (this.options.scrollTop !== scrollTop) {
this.options.scrollTop = scrollTop;
this.scrollContainer.element.scrollTop(scrollTop);
try {
this.scrollContainer.element.scrollTop(scrollTop);
} catch (e) {
}
}
},
@ -16160,6 +16194,14 @@ BI.SequenceTable = BI.inherit(BI.Widget, {
return this.table.hasRightHorizontalScroll();
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
this.sequence.setVerticalScroll(scrollTop);
@ -16769,7 +16811,7 @@ BI.YearTrigger = BI.inherit(BI.Trigger, {
self.editor.setTitle(value);
}
self.fireEvent(BI.YearTrigger.EVENT_CONFIRM);
})
});
this.editor.on(BI.SignEditor.EVENT_SPACE, function () {
if (self.editor.isValid()) {
self.editor.blur();

6
demo.html

@ -19,6 +19,12 @@
<script src="docs/base.js"></script>
<script src="docs/case.js"></script>
<script src="docs/widget.js"></script>
<!--图表-->
<script src="docs/vancharts-all.js"></script>
<script src="docs/biconst.js"></script><!--图表用到的常量(直接拿的bi的常量)-->
<script src="docs/chart.js"></script>
<script src="docs/demo.js"></script>
</head>
<body>

21
demo/config.js

File diff suppressed because one or more lines are too long

124
demo/js/base/button/demo.button.js

@ -54,7 +54,127 @@ Demo.Button = BI.inherit(BI.Widget, {
type: 'bi.button',
text: '带图标的按钮',
//level: 'ignore',
iconClass: "rename-font",
iconClass: "close-font",
height: 30
}
}, {
el: {
type: 'bi.button',
text: '一般按钮',
block: true,
level: 'common',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '表示成功状态按钮',
block: true,
level: 'success',
height: 30
}
},
{
el: {
type: 'bi.button',
text: '表示警告状态的按钮',
block: true,
level: 'warning',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '表示忽略状态的按钮',
block: true,
level: 'ignore',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '普通灰化按钮',
block: true,
disabled: true,
level: 'success',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '忽略状态灰化按钮',
block: true,
disabled: true,
level: 'ignore',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '带图标的按钮',
block: true,
//level: 'ignore',
iconClass: "close-font",
height: 30
}
}, {
el: {
type: 'bi.button',
text: '一般按钮',
clear: true,
level: 'common',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '表示成功状态按钮',
clear: true,
level: 'success',
height: 30
}
},
{
el: {
type: 'bi.button',
text: '表示警告状态的按钮',
clear: true,
level: 'warning',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '表示忽略状态的按钮',
clear: true,
level: 'ignore',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '普通灰化按钮',
clear: true,
disabled: true,
level: 'success',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '忽略状态灰化按钮',
clear: true,
disabled: true,
level: 'ignore',
height: 30
}
}, {
el: {
type: 'bi.button',
text: '带图标的按钮',
clear: true,
//level: 'ignore',
iconClass: "close-font",
height: 30
}
}
@ -66,7 +186,7 @@ Demo.Button = BI.inherit(BI.Widget, {
});
return {
type: "bi.left",
vgap: 200,
vgap: 100,
hgap: 20,
items: items
}

1
demo/js/center.js

@ -9,6 +9,7 @@ Demo.Center = BI.inherit(BI.Widget, {
ref: function () {
self.tab = this;
},
single: true,
defaultShowIndex: "demo.face",
cardCreator: function (v) {
return BI.createWidget({

70
demo/js/chart/demo.axis_chart.js

@ -0,0 +1,70 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var self = this;
return {
type: "bi.tab",
ref: function () {
self.tab = this;
},
single: true,
cardCreator: function (v) {
return {
type: v
}
}
};
},
mounted: function () {
var self = this;
var items = [[{
"data": [
{"x": "孙林", "y": 789},
{"x": "金士鹏", "y": 156},
{"x": "张珊", "y": 289},
{"x": "孙阳", "y": 562},
{"x": "袁成洁", "y": 546},
{"x": "张颖", "y": 218},
{"x": "王伟", "y": 541},
{"x": "张武", "y": 219},
{"x": "韩文", "y": 345}
],
"name": "测试1",
stack: 1
}, {
"data": [
{"x": "孙林", "y": 789},
{"x": "金士鹏", "y": 156},
{"x": "张珊", "y": 289},
{"x": "孙阳", "y": 562},
{"x": "袁成洁", "y": 546},
{"x": "张颖", "y": 218},
{"x": "王伟", "y": 541},
{"x": "张武", "y": 219},
{"x": "韩文", "y": 345}
],
"name": "测试2",
stack: 1
}]];
var types = ["bi.axis_chart", "bi.line_chart", "bi.bar_chart"];
var index = 0;
this.tab.setSelect(types[index]);
this.tab.populate(BI.deepClone(items));
this.interval = setInterval(function () {
index++;
if (index >= types.length) {
index = 0;
}
self.tab.setSelect(types[index]);
self.tab.populate(BI.deepClone(items));
}, 2000)
},
destroyed: function () {
clearInterval(this.interval);
}
});
BI.shortcut("demo.axis_chart", Demo.Func);

8
demo/js/config/chart.js

@ -0,0 +1,8 @@
Demo.CHART_CONFIG = [{
id: 6,
text: "图表控件"
}, {
pId: 6,
text: "柱状图",
value: "demo.axis_chart"
}];

6
demo/js/config/component.js

@ -2,14 +2,14 @@
* Created by User on 2017/3/22.
*/
Demo.COMPONENT_CONFIG = [{
id: 15,
id: 5,
text: "部件"
}, {
pId: 15,
pId: 5,
text: "bi.value_chooser_combo",
value: "demo.value_chooser_combo"
}, {
pId: 15,
pId: 5,
text: "bi.tree_value_chooser_combo",
value: "demo.tree_value_chooser"
}];

114
docs/base.css

@ -68,9 +68,6 @@
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.bi-bubble-popup-view .bubble-popup-line {
background-color: #3f8ce8;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
@ -717,60 +714,96 @@ li.CodeMirror-hint-active {
cursor: pointer;
font-size: 14px;
}
.bi-button.button-common,
.bi-button.button-common .b-font {
color: #ffffff;
.bi-button.block {
font-size: inherit;
border-width: 0;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.bi-button.clear {
font-size: inherit;
border-width: 0;
background-color: transparent;
}
.bi-button.clear:hover,
.bi-button.clear:active {
opacity: 0.75;
filter: alpha(opacity=75);
}
.bi-button.button-common,
.bi-button.button-common .b-font:before {
color: #ffffff;
}
.bi-button.button-common.clear,
.bi-button.button-common.clear .b-font:before {
color: #3f8ce8;
}
.bi-button.button-ignore {
background-color: #ffffff;
border-color: #d4dadd;
}
.bi-button.button-ignore,
.bi-button.button-ignore .b-font {
.bi-button.button-ignore .b-font:before {
color: #1a1a1a;
}
.bi-button.button-ignore.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-success {
background-color: #58cc7d;
border-color: #58cc7d;
}
.bi-button.button-success,
.bi-button.button-success .b-font {
color: #ffffff;
}
.bi-button.button-success .b-font:before {
color: #ffffff;
}
.bi-button.button-success.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-success.clear,
.bi-button.button-success.clear .b-font:before {
color: #0c6d23;
}
.bi-button.button-warning {
background-color: #e85050;
border-color: #e85050;
}
.bi-button.button-warning,
.bi-button.button-warning .b-font {
color: #ffffff;
}
.bi-button.button-warning .b-font:before {
color: #ffffff;
}
.bi-button.button-warning.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-warning.clear,
.bi-button.button-warning.clear .b-font:before {
color: #e85050;
}
.bi-button.button-common.disabled,
.bi-button.button-success.disabled,
.bi-button.button-warning.disabled {
.bi-button.button-warning.disabled,
.bi-button.button-common.disabled.base-disabled,
.bi-button.button-success.disabled.base-disabled,
.bi-button.button-warning.disabled.base-disabled {
background: #cccccc !important;
border-color: #c4c6c6 !important;
border-color: #cccccc !important;
}
.bi-button.button-common.disabled,
.bi-button.button-success.disabled,
.bi-button.button-warning.disabled,
.bi-button.button-common.disabled .b-font,
.bi-button.button-success.disabled .b-font,
.bi-button.button-warning.disabled .b-font {
color: #ffffff !important;
}
.bi-button.button-common.disabled.base-disabled,
.bi-button.button-success.disabled.base-disabled,
.bi-button.button-warning.disabled.base-disabled,
.bi-button.button-common.disabled .b-font:before,
.bi-button.button-success.disabled .b-font:before,
.bi-button.button-warning.disabled .b-font:before {
.bi-button.button-warning.disabled .b-font:before,
.bi-button.button-common.disabled.base-disabled .b-font:before,
.bi-button.button-success.disabled.base-disabled .b-font:before,
.bi-button.button-warning.disabled.base-disabled .b-font:before {
color: #ffffff !important;
}
.bi-button.button-ignore.disabled {
@ -778,12 +811,37 @@ li.CodeMirror-hint-active {
border-color: #d4dadd !important;
}
.bi-button.button-ignore.disabled,
.bi-button.button-ignore.disabled .b-font {
.bi-button.button-ignore.disabled .b-font:before {
color: #cccccc !important;
}
.bi-button.button-ignore.disabled .b-font:before {
.bi-button.button-common.disabled.clear,
.bi-button.button-success.disabled.clear,
.bi-button.button-warning.disabled.clear,
.bi-button.button-ignore.disabled.clear {
background: transparent !important;
border-width: 0 !important;
}
.bi-button.button-common.disabled.clear,
.bi-button.button-success.disabled.clear,
.bi-button.button-warning.disabled.clear,
.bi-button.button-ignore.disabled.clear,
.bi-button.button-common.disabled.clear .b-font:before,
.bi-button.button-success.disabled.clear .b-font:before,
.bi-button.button-warning.disabled.clear .b-font:before,
.bi-button.button-ignore.disabled.clear .b-font:before {
color: #cccccc !important;
}
.bi-button.button-common.disabled.clear:hover,
.bi-button.button-success.disabled.clear:hover,
.bi-button.button-warning.disabled.clear:hover,
.bi-button.button-ignore.disabled.clear:hover,
.bi-button.button-common.disabled.clear:active,
.bi-button.button-success.disabled.clear:active,
.bi-button.button-warning.disabled.clear:active,
.bi-button.button-ignore.disabled.clear:active {
opacity: 1;
filter: alpha(opacity=100);
}
.bi-basic-button.button-common .bi-button-mask,
.bi-basic-button.button-success .bi-button-mask,
.bi-basic-button.button-warning .bi-button-mask {
@ -862,6 +920,12 @@ li.CodeMirror-hint-active {
.bi-textarea-editor .textarea-editor-content {
border: none;
}
.bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #d4dadd;
}
.bi-theme-dark .bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #525466;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
@ -1199,13 +1263,13 @@ li.CodeMirror-hint-active {
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-faceActive:after {
.public-scrollbar-face-active:after {
background-color: rgba(102, 102, 102, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666,endColorstr=#b3666666);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-faceActive:after {
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(204, 204, 204, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc,endColorstr=#b3cccccc);
}

205
docs/base.js

@ -599,7 +599,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
stopPropagation: false,
selected: false,
once: false, //点击一次选中有效,再点无效
forceSelected: false, //点击即选中, 选中了就不会被取消
forceSelected: false, //点击即选中, 选中了就不会被取消,与once的区别是forceSelected不影响事件的触发
forceNotSelected: false, //无论怎么点击都不会被选中
disableSelected: false, //使能选中
@ -1135,7 +1135,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
removeItemAt: function (indexes) {
BI.remove(this.buttons, indexes);
BI.removeAt(this.buttons, indexes);
this.layouts.removeItemAt(indexes);
},
@ -2935,7 +2935,7 @@ BI.Combo = BI.inherit(BI.Widget, {
}
}
}, BI.EVENT_RESPONSE_TIME, true);
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e);
st(e);
});
@ -3051,7 +3051,7 @@ BI.Combo = BI.inherit(BI.Widget, {
break;
case "top":
case "top,right":
p = $.getComboPosition(this.combo, this.popupView, 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":
@ -15883,25 +15883,25 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/
BI.Button = BI.inherit(BI.BasicButton, {
_const: {
minWidth: 90
},
_defaultConfig: function () {
_defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + ' bi-button',
shadow: true,
minWidth: (props.block === true || props.clear === true) ? 0 : 90,
shadow: props.clear !== true,
isShadowShowingOnSelected: true,
readonly: true,
iconClass: "",
level: 'common',
block: false, //是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, //是否去掉边框和背景
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: 10,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
@ -15913,8 +15913,10 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
_init: function () {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height)) {
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'});
} else {
this.element.css({lineHeight: o.height + 'px'});
}
if (BI.isKey(o.iconClass)) {
this.icon = BI.createWidget({
@ -15961,7 +15963,15 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
value: o.value
});
}
this.element.css({"min-width": this._const.minWidth - 2 + "px"});
if (o.block === true) {
this.element.addClass("block");
}
if (o.clear === true) {
this.element.addClass("clear");
}
if (o.minWidth > 2) {
this.element.css({"min-width": o.minWidth - 2 + "px"});
}
},
doClick: function () {
@ -15985,8 +15995,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
setEnable: function (b) {
BI.Button.superclass.setEnable.apply(this, arguments);
this.text.setEnable(b);
this.icon && this.icon.setEnable(b);
// this.text.setEnable(b);
// this.icon && this.icon.setEnable(b);
},
doRedMark: function () {
@ -19759,6 +19769,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
extraCls: "bi-tooltip",
text: "",
level: "success",//success或warning
stopEvent: false,
stopPropagation: false,
height: 20
})
},
@ -19767,9 +19779,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
var self = this, o = this.options;
this.element.addClass("tooltip-" + o.level);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
o.stopPropagation && e.stopPropagation();
o.stopEvent && e.stopEvent();
};
this.element.bind({
"click": fn,
@ -28225,6 +28236,160 @@ BI.Svg = BI.inherit(BI.Widget, {
}
});
BI.shortcut("bi.svg", BI.Svg);/**
*
* 原生表格滚动条为了IE8的兼容
*
* Created by GUY on 2016/1/12.
* @class BI.NativeTableScrollbar
* @extends BI.Widget
*/
BI.NativeTableScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
defaultPosition: 0,
position: 0,
size: 0
})
},
render: function () {
var self = this, o = this.options;
//把滚动台size改掉
BI.GridTableScrollbar.SIZE = 16;
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrolly: true,
items: [{
type: "bi.layout",
width: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
}
},
mounted: function () {
this._populate();
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollTop(o.position);
} catch (e) {
}
this.inner.element.height(o.contentSize);
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setHeight(size);
this.options.size = size;
},
populate: function () {
this._populate();
}
});
BI.NativeTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_scrollbar", BI.NativeTableScrollbar);
BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
position: 0,
size: 0
})
},
render: function () {
var self = this, o = this.options;
//把滚动台size改掉
BI.GridTableScrollbar.SIZE = 16;
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrollx: true,
items: [{
type: "bi.layout",
height: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
}
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setWidth(size);
this.options.size = size;
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollLeft(o.position);
} catch (e) {
}
this.inner.element.width(o.contentSize);
},
populate: function () {
this._populate();
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
@ -29821,7 +29986,11 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
} else {
this._mouseMoveTracker.captureMouseMoves(e);
}
this.element[0].focus();
try {
this.element[0].focus();
} catch (e) {
}
},
_onMouseMove: function (deltaX, deltaY) {

668
docs/biconst.js

@ -0,0 +1,668 @@
BICst.DATE_TYPE = {};
BICst.DATE_TYPE.MULTI_DATE_YEAR_PREV = 1;
BICst.DATE_TYPE.MULTI_DATE_YEAR_AFTER = 2;
BICst.DATE_TYPE.MULTI_DATE_YEAR_BEGIN = 3;
BICst.DATE_TYPE.MULTI_DATE_YEAR_END = 4;
BICst.DATE_TYPE.MULTI_DATE_MONTH_PREV = 5;
BICst.DATE_TYPE.MULTI_DATE_MONTH_AFTER = 6;
BICst.DATE_TYPE.MULTI_DATE_MONTH_BEGIN = 7;
BICst.DATE_TYPE.MULTI_DATE_MONTH_END = 8;
BICst.DATE_TYPE.MULTI_DATE_QUARTER_PREV = 9;
BICst.DATE_TYPE.MULTI_DATE_QUARTER_AFTER = 10;
BICst.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN = 11;
BICst.DATE_TYPE.MULTI_DATE_QUARTER_END = 12;
BICst.DATE_TYPE.MULTI_DATE_WEEK_PREV = 13;
BICst.DATE_TYPE.MULTI_DATE_WEEK_AFTER = 14;
BICst.DATE_TYPE.MULTI_DATE_DAY_PREV = 15;
BICst.DATE_TYPE.MULTI_DATE_DAY_AFTER = 16;
BICst.DATE_TYPE.MULTI_DATE_DAY_TODAY = 17;
BICst.DATE_TYPE.MULTI_DATE_PARAM = 18;
BICst.DATE_TYPE.MULTI_DATE_CALENDAR = 19;
BICst.DATE_TYPE.YEAR_QUARTER = 20;
BICst.DATE_TYPE.YEAR_MONTH = 21;
BICst.DATE_TYPE.YEAR_WEEK = 22;
BICst.DATE_TYPE.YEAR_DAY = 23;
BICst.DATE_TYPE.MONTH_WEEK = 24;
BICst.DATE_TYPE.MONTH_DAY = 25;
BICst.DATE_TYPE.YEAR = 26;
BICst.DATE_TYPE.SAME_PERIOD = 27;
BICst.DATE_TYPE.LAST_SAME_PERIOD = 28;
BICst.DATE_FORMAT = {};
BICst.DATE_FORMAT.SPLIT = 1;
BICst.DATE_FORMAT.CHINESE = 2;
BICst.RES_STATUS = {};
BICst.RES_STATUS.NORMAL = 1;
BICst.RES_STATUS.ERROR = 2;
BICst.RES_STATUS.DATA_MISS = 3;
BICst.RES_STATUS.NO_AUTHORITY = 4;
BICst.RES_STATUS.NO_DATA = 5;
BICst.REPORT_AUTH = {};
BICst.REPORT_AUTH.NONE = 0;
BICst.REPORT_AUTH.EDIT = 1;
BICst.REPORT_AUTH.VIEW = 2;
BICst.TARGET_STYLE = {};
BICst.TARGET_STYLE.ICON_STYLE = {};
BICst.TARGET_STYLE.ICON_STYLE.NONE = 1;
BICst.TARGET_STYLE.ICON_STYLE.POINT = 2;
BICst.TARGET_STYLE.ICON_STYLE.ARROW = 3;
BICst.TARGET_STYLE.NUM_LEVEL = {};
BICst.TARGET_STYLE.NUM_LEVEL.NORMAL = 1;
BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND = 2;
BICst.TARGET_STYLE.NUM_LEVEL.MILLION = 3;
BICst.TARGET_STYLE.NUM_LEVEL.YI = 4;
BICst.TARGET_STYLE.NUM_LEVEL.PERCENT = 5;
BICst.TARGET_STYLE.FORMAT = {};
BICst.TARGET_STYLE.FORMAT.NORMAL = -1;
BICst.TARGET_STYLE.FORMAT.ZERO2POINT = 0;
BICst.TARGET_STYLE.FORMAT.ONE2POINT = 1;
BICst.TARGET_STYLE.FORMAT.TWO2POINT = 2;
BICst.MULTI_PATH_STATUS = {};
BICst.MULTI_PATH_STATUS.NEED_GENERATE_CUBE = 0;
BICst.MULTI_PATH_STATUS.NOT_NEED_GENERATE_CUBE = 1;
BICst.CUSTOM_GROUP = {};
BICst.CUSTOM_GROUP.UNGROUP2OTHER = {};
BICst.CUSTOM_GROUP.UNGROUP2OTHER.NOTSELECTED = 0;
BICst.CUSTOM_GROUP.UNGROUP2OTHER.SELECTED = 1;
BICst.REPORT_STATUS = {};
BICst.REPORT_STATUS.APPLYING = 1;
BICst.REPORT_STATUS.HANGOUT = 2;
BICst.REPORT_STATUS.NORMAL = 3;
BICst.FIELD_ID = {};
BICst.FIELD_ID.HEAD = "81c48028-1401-11e6-a148-3e1d05defe78";
BICst.TREE_LABEL = {};
BICst.TREE_LABEL.TREE_LABEL_ITEM_COUNT_NUM = 40;
BICst.TREE = {};
BICst.TREE.TREE_REQ_TYPE = {};
BICst.TREE.TREE_REQ_TYPE.DEFAULT_DATA = 0;
BICst.TREE.TREE_REQ_TYPE.INIT_DATA = 1;
BICst.TREE.TREE_REQ_TYPE.SELECT_DATA = 3;
BICst.TREE.TREE_REQ_TYPE.ADJUST_DATA = 2;
BICst.TREE.TREE_REQ_TYPE.GET_SELECTED_DATA = 4;
BICst.TREE.TREE_REQ_TYPE.UNSELECT_DATA = 5;
BICst.TREE.TREE_ITEM_COUNT_PER_PAGE = 100;
BICst.BUSINESS_TABLE_TYPE = {};
BICst.BUSINESS_TABLE_TYPE.NORMAL = 0;
BICst.EXPANDER_TYPE = {};
BICst.EXPANDER_TYPE.NONE = false;
BICst.EXPANDER_TYPE.ALL = true;
BICst.SORT = {};
BICst.SORT.ASC = 0;
BICst.SORT.DESC = 1;
BICst.SORT.CUSTOM = 2;
BICst.SORT.NONE = 3;
BICst.SORT.NUMBER_ASC = 4;
BICst.SORT.NUMBER_DESC = 5;
BICst.TABLE_PAGE_OPERATOR = {};
BICst.TABLE_PAGE_OPERATOR.ALL_PAGE = -1;
BICst.TABLE_PAGE_OPERATOR.REFRESH = 0;
BICst.TABLE_PAGE_OPERATOR.COLUMN_PRE = 1;
BICst.TABLE_PAGE_OPERATOR.COLUMN_NEXT = 2;
BICst.TABLE_PAGE_OPERATOR.ROW_PRE = 3;
BICst.TABLE_PAGE_OPERATOR.ROW_NEXT = 4;
BICst.TABLE_PAGE_OPERATOR.EXPAND = 5;
BICst.TABLE_PAGE = {};
BICst.TABLE_PAGE.VERTICAL_PRE = 0;
BICst.TABLE_PAGE.VERTICAL_NEXT = 1;
BICst.TABLE_PAGE.HORIZON_PRE = 2;
BICst.TABLE_PAGE.HORIZON_NEXT = 3;
BICst.TABLE_PAGE.TOTAL_PAGE = 4;
BICst.TABLE_WIDGET = {};
BICst.TABLE_WIDGET.GROUP_TYPE = 1;
BICst.TABLE_WIDGET.CROSS_TYPE = 2;
BICst.TABLE_WIDGET.COMPLEX_TYPE = 3;
BICst.REGION = {};
BICst.REGION.DIMENSION1 = "10000";
BICst.REGION.DIMENSION2 = "20000";
BICst.REGION.TARGET1 = "30000";
BICst.REGION.TARGET2 = "40000";
BICst.REGION.TARGET3 = "50000";
BICst.EXPORT = {};
BICst.EXPORT.EXCEL = 1;
BICst.EXPORT.PDF = 2;
BICst.WIDGET = {};
BICst.WIDGET.TABLE = 1;
BICst.WIDGET.CROSS_TABLE = 2;
BICst.WIDGET.COMPLEX_TABLE = 3;
BICst.WIDGET.DETAIL = 4;
BICst.WIDGET.AXIS = 5;
BICst.WIDGET.ACCUMULATE_AXIS = 6;
BICst.WIDGET.PERCENT_ACCUMULATE_AXIS = 7;
BICst.WIDGET.COMPARE_AXIS = 8;
BICst.WIDGET.FALL_AXIS = 9;
BICst.WIDGET.BAR = 10;
BICst.WIDGET.ACCUMULATE_BAR = 11;
BICst.WIDGET.COMPARE_BAR = 12;
BICst.WIDGET.LINE = 13;
BICst.WIDGET.AREA = 14;
BICst.WIDGET.ACCUMULATE_AREA = 15;
BICst.WIDGET.PERCENT_ACCUMULATE_AREA = 16;
BICst.WIDGET.COMPARE_AREA = 17;
BICst.WIDGET.RANGE_AREA = 18;
BICst.WIDGET.COMBINE_CHART = 19;
BICst.WIDGET.MULTI_AXIS_COMBINE_CHART = 20;
BICst.WIDGET.PIE = 21;
BICst.WIDGET.DONUT = 22;
BICst.WIDGET.MAP = 23;
BICst.WIDGET.GIS_MAP = 24;
BICst.WIDGET.DASHBOARD = 25;
BICst.WIDGET.BUBBLE = 26;
BICst.WIDGET.SCATTER = 28;
BICst.WIDGET.FORCE_BUBBLE = 27;
BICst.WIDGET.RADAR = 29;
BICst.WIDGET.ACCUMULATE_RADAR = 30;
BICst.WIDGET.FUNNEL = 31;
BICst.WIDGET.RECT_TREE = 39;
BICst.WIDGET.MULTI_PIE = 40;
BICst.WIDGET.HEAT_MAP = 65;
BICst.WIDGET.PARETO = 66;
BICst.WIDGET.DOT = 67;
BICst.WIDGET.STRING = 32;
BICst.WIDGET.NUMBER = 33;
BICst.WIDGET.TREE = 34;
BICst.WIDGET.SINGLE_SLIDER = 35;
BICst.WIDGET.INTERVAL_SLIDER = 36;
BICst.WIDGET.LIST_LABEL = 37;
BICst.WIDGET.TREE_LABEL = 38;
BICst.WIDGET.STRING_LIST = 59;
BICst.WIDGET.TREE_LIST = 60;
BICst.WIDGET.DATE_PANE = 61;
BICst.WIDGET.DATE = 48;
BICst.WIDGET.YEAR = 49;
BICst.WIDGET.QUARTER = 50;
BICst.WIDGET.MONTH = 51;
BICst.WIDGET.YMD = 52;
BICst.WIDGET.QUERY = 53;
BICst.WIDGET.RESET = 54;
BICst.WIDGET.CONTENT = 55;
BICst.WIDGET.IMAGE = 56;
BICst.WIDGET.WEB = 57;
BICst.WIDGET.GENERAL_QUERY = 58;
BICst.WIDGET.TABLE_SHOW = 64;
BICst.WIDGET.NONE = -1;
BICst.TARGET_TYPE = {};
BICst.TARGET_TYPE.CAL_POSITION = {};
BICst.TARGET_TYPE.CAL_POSITION.ALL = 0;
BICst.TARGET_TYPE.CAL_POSITION.INGROUP = 1;
BICst.TARGET_TYPE.CAL_VALUE = {};
BICst.TARGET_TYPE.CAL_VALUE.PERIOD_TYPE = {};
BICst.TARGET_TYPE.CAL_VALUE.PERIOD_TYPE.VALUE = 0;
BICst.TARGET_TYPE.CAL_VALUE.PERIOD_TYPE.RATE = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE = {};
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.SUM = 0;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.MAX = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.MIN = 2;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.AVG = 3;
BICst.TARGET_TYPE.CAL_VALUE.RANK_TPYE = {};
BICst.TARGET_TYPE.CAL_VALUE.RANK_TPYE.ASC = 0;
BICst.TARGET_TYPE.CAL_VALUE.RANK_TPYE.DESC = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUM_OF_ALL = 0;
BICst.TARGET_TYPE.CAL_VALUE.PERIOD = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUM_OF_ABOVE = 2;
BICst.TARGET_TYPE.CAL_VALUE.RANK = 3;
BICst.TARGET_TYPE.CAL = {};
BICst.TARGET_TYPE.CAL.FORMULA = 0;
BICst.TARGET_TYPE.CAL.CONFIGURATION = 1;
BICst.TARGET_TYPE.STRING = 1;
BICst.TARGET_TYPE.NUMBER = 2;
BICst.TARGET_TYPE.DATE = 3;
BICst.TARGET_TYPE.COUNTER = 4;
BICst.TARGET_TYPE.FORMULA = 5;
BICst.TARGET_TYPE.YEAR_ON_YEAR_RATE = 6;
BICst.TARGET_TYPE.MONTH_ON_MONTH_RATE = 7;
BICst.TARGET_TYPE.YEAR_ON_YEAR_VALUE = 8;
BICst.TARGET_TYPE.MONTH_ON_MONTH_VALUE = 9;
BICst.TARGET_TYPE.SUM_OF_ABOVE = 10;
BICst.TARGET_TYPE.SUM_OF_ABOVE_IN_GROUP = 11;
BICst.TARGET_TYPE.SUM_OF_ALL = 12;
BICst.TARGET_TYPE.SUM_OF_ALL_IN_GROUP = 13;
BICst.TARGET_TYPE.RANK = 14;
BICst.TARGET_TYPE.RANK_IN_GROUP = 15;
BICst.DIMENSION_FILTER_DATE = {};
BICst.DIMENSION_FILTER_DATE.BELONG_VALUE = 98;
BICst.DIMENSION_FILTER_DATE.NOT_BELONG_VALUE = 99;
BICst.DIMENSION_FILTER_DATE.IS_NULL = 100;
BICst.DIMENSION_FILTER_DATE.NOT_NULL = 101;
BICst.DIMENSION_FILTER_DATE.TOP_N = 102;
BICst.DIMENSION_FILTER_DATE.BOTTOM_N = 103;
BICst.DIMENSION_FILTER_DATE.CONTAIN = 104;
BICst.DIMENSION_FILTER_DATE.NOT_CONTAIN = 105;
BICst.DIMENSION_FILTER_DATE.BEGIN_WITH = 106;
BICst.DIMENSION_FILTER_DATE.END_WITH = 107;
BICst.FILTER_TYPE = {};
BICst.FILTER_TYPE.AND = 80;
BICst.FILTER_TYPE.OR = 81;
BICst.FILTER_TYPE.FORMULA = 82;
BICst.FILTER_TYPE.EMPTY_FORMULA = 90;
BICst.FILTER_TYPE.EMPTY_CONDITION = 91;
BICst.FILTER_TYPE.NUMBER_SUM = 83;
BICst.FILTER_TYPE.NUMBER_AVG = 84;
BICst.FILTER_TYPE.NUMBER_MAX = 85;
BICst.FILTER_TYPE.NUMBER_MIN = 86;
BICst.FILTER_TYPE.NUMBER_COUNT = 87;
BICst.FILTER_TYPE.TREE_FILTER = 88;
BICst.FILTER_TYPE.COLUMNFILTER = 89;
BICst.FILTER_TYPE.DIMENSION_TARGET_VALUE_FILTER = 96;
BICst.FILTER_TYPE.DIMENSION_SELF_FILTER = 97;
BICst.FILTER_DATE = {};
BICst.FILTER_DATE.BELONG_DATE_RANGE = 64;
BICst.FILTER_DATE.BELONG_WIDGET_VALUE = 65;
BICst.FILTER_DATE.NOT_BELONG_DATE_RANGE = 66;
BICst.FILTER_DATE.NOT_BELONG_WIDGET_VALUE = 67;
BICst.FILTER_DATE.MORE_THAN = 68;
BICst.FILTER_DATE.LESS_THAN = 69;
BICst.FILTER_DATE.EQUAL_TO = 70;
BICst.FILTER_DATE.NOT_EQUAL_TO = 71;
BICst.FILTER_DATE.IS_NULL = 72;
BICst.FILTER_DATE.NOT_NULL = 73;
BICst.FILTER_DATE.EARLY_THAN = 74;
BICst.FILTER_DATE.LATER_THAN = 75;
BICst.FILTER_DATE.CONTAINS = 76;
BICst.FILTER_DATE.CONTAINS_DAY = 77;
BICst.FILTER_DATE.DAY_EQUAL_TO = 78;
BICst.FILTER_DATE.DAY_NOT_EQUAL_TO = 79;
BICst.TARGET_FILTER_NUMBER = {};
BICst.TARGET_FILTER_NUMBER.EQUAL_TO = 48;
BICst.TARGET_FILTER_NUMBER.NOT_EQUAL_TO = 49;
BICst.TARGET_FILTER_NUMBER.BELONG_VALUE = 50;
BICst.TARGET_FILTER_NUMBER.BELONG_USER = 51;
BICst.TARGET_FILTER_NUMBER.NOT_BELONG_VALUE = 52;
BICst.TARGET_FILTER_NUMBER.NOT_BELONG_USER = 53;
BICst.TARGET_FILTER_NUMBER.IS_NULL = 54;
BICst.TARGET_FILTER_NUMBER.NOT_NULL = 55;
BICst.TARGET_FILTER_NUMBER.CONTAINS = 56;
BICst.TARGET_FILTER_NUMBER.NOT_CONTAINS = 57;
BICst.TARGET_FILTER_NUMBER.LARGE_THAN_CAL_LINE = 58;
BICst.TARGET_FILTER_NUMBER.LARGE_OR_EQUAL_CAL_LINE = 59;
BICst.TARGET_FILTER_NUMBER.SMALL_THAN_CAL_LINE = 60;
BICst.TARGET_FILTER_NUMBER.SMALL_OR_EQUAL_CAL_LINE = 61;
BICst.TARGET_FILTER_NUMBER.TOP_N = 62;
BICst.TARGET_FILTER_NUMBER.BOTTOM_N = 63;
BICst.TARGET_FILTER_STRING = {};
BICst.TARGET_FILTER_STRING.BELONG_VALUE = 32;
BICst.TARGET_FILTER_STRING.BELONG_USER = 33;
BICst.TARGET_FILTER_STRING.NOT_BELONG_VALUE = 34;
BICst.TARGET_FILTER_STRING.NOT_BELONG_USER = 35;
BICst.TARGET_FILTER_STRING.CONTAIN = 36;
BICst.TARGET_FILTER_STRING.NOT_CONTAIN = 37;
BICst.TARGET_FILTER_STRING.IS_NULL = 38;
BICst.TARGET_FILTER_STRING.NOT_NULL = 39;
BICst.TARGET_FILTER_STRING.BEGIN_WITH = 40;
BICst.TARGET_FILTER_STRING.END_WITH = 41;
BICst.TARGET_FILTER_STRING.NOT_BEGIN_WITH = 42;
BICst.TARGET_FILTER_STRING.NOT_END_WITH = 43;
BICst.TARGET_FILTER_STRING.VAGUE_CONTAIN = 46;
BICst.TARGET_FILTER_STRING.NOT_VAGUE_CONTAIN = 47;
BICst.DIMENSION_FILTER_NUMBER = {};
BICst.DIMENSION_FILTER_NUMBER.BELONG_VALUE = 16;
BICst.DIMENSION_FILTER_NUMBER.BELONG_USER = 17;
BICst.DIMENSION_FILTER_NUMBER.NOT_BELONG_VALUE = 18;
BICst.DIMENSION_FILTER_NUMBER.NOT_BELONG_USER = 19;
BICst.DIMENSION_FILTER_NUMBER.MORE_THAN_AVG = 20;
BICst.DIMENSION_FILTER_NUMBER.LESS_THAN_AVG = 21;
BICst.DIMENSION_FILTER_NUMBER.IS_NULL = 22;
BICst.DIMENSION_FILTER_NUMBER.NOT_NULL = 23;
BICst.DIMENSION_FILTER_NUMBER.TOP_N = 24;
BICst.DIMENSION_FILTER_NUMBER.BOTTOM_N = 25;
BICst.DIMENSION_FILTER_STRING = {};
BICst.DIMENSION_FILTER_STRING.BELONG_VALUE = 0;
BICst.DIMENSION_FILTER_STRING.BELONG_USER = 1;
BICst.DIMENSION_FILTER_STRING.NOT_BELONG_VALUE = 2;
BICst.DIMENSION_FILTER_STRING.NOT_BELONG_USER = 3;
BICst.DIMENSION_FILTER_STRING.CONTAIN = 4;
BICst.DIMENSION_FILTER_STRING.NOT_CONTAIN = 5;
BICst.DIMENSION_FILTER_STRING.IS_NULL = 6;
BICst.DIMENSION_FILTER_STRING.NOT_NULL = 7;
BICst.DIMENSION_FILTER_STRING.BEGIN_WITH = 8;
BICst.DIMENSION_FILTER_STRING.END_WITH = 9;
BICst.DIMENSION_FILTER_STRING.TOP_N = 10;
BICst.DIMENSION_FILTER_STRING.BOTTOM_N = 11;
BICst.DIMENSION_FILTER_STRING.NOT_BEGIN_WITH = 12;
BICst.DIMENSION_FILTER_STRING.NOT_END_WITH = 13;
BICst.DIMENSION_FILTER_STRING.VAGUE_CONTAIN = 14;
BICst.DIMENSION_FILTER_STRING.NOT_VAGUE_CONTAIN = 15;
BICst.GROUP = {};
BICst.GROUP.NO_GROUP = 0;
BICst.GROUP.AUTO_GROUP = 3;
BICst.GROUP.CUSTOM_GROUP = 4;
BICst.GROUP.CUSTOM_NUMBER_GROUP = 5;
BICst.GROUP.Y = 6;
BICst.GROUP.S = 7;
BICst.GROUP.M = 8;
BICst.GROUP.W = 9;
BICst.GROUP.YMD = 10;
BICst.GROUP.YD = 11;
BICst.GROUP.MD = 12;
BICst.GROUP.YMDHMS = 13;
BICst.GROUP.ID_GROUP = 14;
BICst.GROUP.HOUR = 15;
BICst.GROUP.MINUTE = 16;
BICst.GROUP.SECOND = 17;
BICst.GROUP.WEEK_COUNT = 18;
BICst.GROUP.D = 19;
BICst.GROUP.YM = 20;
BICst.GROUP.YW = 21;
BICst.GROUP.YMDH = 22;
BICst.GROUP.YMDHM = 23;
BICst.GROUP.YS = 24;
BICst.SUMMARY_TYPE = {};
BICst.SUMMARY_TYPE.SUM = 0;
BICst.SUMMARY_TYPE.MAX = 1;
BICst.SUMMARY_TYPE.MIN = 2;
BICst.SUMMARY_TYPE.AVG = 3;
BICst.SUMMARY_TYPE.COUNT = 4;
BICst.SUMMARY_TYPE.APPEND = 5;
BICst.SUMMARY_TYPE.RECORD_COUNT = 6;
BICst.BI_REPORT = {};
BICst.BI_REPORT.NULL = 0;
BICst.BI_REPORT.SUBMITED = 1;
BICst.BI_REPORT.PUBLISHED = 2;
BICst.VERSION = "4.0.2";
BICst.SYSTEM_TIME = "__system_time-3e1d05defe78__";
BICst.ETL_ADD_COLUMN_TYPE = {};
BICst.ETL_ADD_COLUMN_TYPE.FORMULA = "formula";
BICst.ETL_ADD_COLUMN_TYPE.DATE_DIFF = "date_diff";
BICst.ETL_ADD_COLUMN_TYPE.DATE_YEAR = "date_year";
BICst.ETL_ADD_COLUMN_TYPE.DATE_SEASON = "date_season";
BICst.ETL_ADD_COLUMN_TYPE.DATE_MONTH = "date_month";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_CPP = "expr_same_period";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_LP = "expr_last_period";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_CPP_PERCENT = "expr_same_period_percent";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_LP_PERCENT = "expr_last_period_percent";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_SUM = "expr_sum";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_ACC = "expr_acc";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_RANK = "expr_rank";
BICst.ETL_ADD_COLUMN_TYPE.GROUP = "group_value";
BICst.ETL_ADD_COLUMN_TYPE.SINGLE_VALUE = "single_value";
BICst.ETL_ADD_COLUMN_TYPE.VALUE_CONVERT = "value_convert";
BICst.JSON_KEYS = {};
BICst.JSON_KEYS.STATISTIC_ELEMENT = "_src";
BICst.JSON_KEYS.FILED_MAX_VALUE = "max";
BICst.JSON_KEYS.FIELD_MIN_VALUE = "min";
BICst.JSON_KEYS.FILTER_VALUE = "filterValue";
BICst.JSON_KEYS.FILTER_CONDITION = "condition";
BICst.JSON_KEYS.FILTER_AND_OR = "andor";
BICst.JSON_KEYS.FILTER_TYPE = "filterType";
BICst.JSON_KEYS.FIELD_ID = "fieldId";
BICst.JSON_KEYS.FIELD_TYPE = "fieldType";
BICst.JSON_KEYS.FIELD_VALUE = "field_value";
BICst.JSON_KEYS.FIELD_NAME = "fieldName";
BICst.JSON_KEYS.TYPE = "type";
BICst.JSON_KEYS.VALUE = "value";
BICst.JSON_KEYS.EXPANDER = "expander";
BICst.JSON_KEYS.EXPANDER_X = "x";
BICst.JSON_KEYS.EXPANDER_Y = "y";
BICst.JSON_KEYS.CLICKEDVALUE = "clickedvalue";
BICst.JSON_KEYS.SETTTINGS = "settings";
BICst.JSON_KEYS.ID = "id";
BICst.JSON_KEYS.TABLES = "tables";
BICst.JSON_KEYS.TABLE = "table";
BICst.JSON_KEYS.FIELDS = "fields";
BICst.JSON_KEYS.FIELD = "field";
BICst.JSON_KEYS.ETL_TYPE = "etlType";
BICst.JSON_KEYS.ETL_VALUE = "etlValue";
BICst.JSON_KEYS.TABLE_TYPE = "table_type";
BICst.JSON_KEYS.HAS_NEXT = "hasNext";
BICst.JSON_KEYS.CONNECTION_SET = "connectionSet";
BICst.JSON_KEYS.PRIMARY_KEY_MAP = "primKeyMap";
BICst.JSON_KEYS.FOREIGN_KEY_MAP = "foreignKeyMap";
BICst.CUSTOM_FORMAT = {};
BICst.CUSTOM_FORMAT.VALUEFORMAT = "(window.BH ? BH.contentFormat(this.value, '#.##;-#.##') : this.value)";
BICst.CUSTOM_FORMAT.PERCENTVALUEFORMAT = "(window.BH ? BH.contentFormat(this.value, '#0.00%') : this.value)";
BICst.CUSTOM_FORMAT.THISPERCENTVALUEFORMAT = "(window.BH ? BH.contentFormat(this, '#0.00%') : this)";
BICst.CUSTOM_FORMAT.NUMSEPARATORS = "(window.BH ? BH.contentFormat(this.value, '#,###.##') : this.value)";
BICst.CUSTOM_FORMAT.PERCENTNUMSEPARATORS = "(window.BH ? BH.contentFormat(this.value, '#,##0%') : this.value)";
BICst.CUSTOM_FORMAT.THISPERCENTNUMSEPARATORS = "(window.BH ? BH.contentFormat(this, '#,##0%') : this)";
BICst.DEFAULT_FORMAT_FUNCTIONS = {};
BICst.DEFAULT_FORMAT_FUNCTIONS.CONTENTFORMAT = "function(){return window.BH ? BH.contentFormat(arguments[0], '') : arguments[0]}";
BICst.DEFAULT_FORMAT_FUNCTIONS.CONTENTFORMAT2DECIMAL = "function () {return window.BH ? BH.contentFormat(arguments[0], '#.##') : arguments[0]}";
BICst.DEFAULT_FORMAT_FUNCTIONS.CONTENTFORMATPERCENTAGE = "function(){return window.BH ? BH.contentFormat(arguments[0], '#.##%') : arguments[0]}";
BICst.LENEGD_DEFAULT_COLOR = {};
BICst.LENEGD_DEFAULT_COLOR.COLOR_A = "#65B3EE";
BICst.LENEGD_DEFAULT_COLOR.COLOR_B = "#95E1AA";
BICst.LENEGD_DEFAULT_COLOR.COLOR_C = "#F8D08E";
BICst.LENEGD_DEFAULT_COLOR.COLOR_D = "#e697c8";
BICst.LENEGD_DEFAULT_COLOR.COLOR_E = "#a484b9";
BICst.CHART_COLOR = {};
BICst.CHART_COLOR.COLOR_A = "#5caae4";
BICst.CHART_COLOR.COLOR_B = "#70cc7f";
BICst.CHART_COLOR.COLOR_C = "#ebbb67";
BICst.CHART_COLOR.COLOR_D = "#e97e7b";
BICst.CHART_COLOR.COLOR_E = "#6ed3c9";
BICst.DISPLAY_RULES = {};
BICst.DISPLAY_RULES.DIMENSION = 1;
BICst.DISPLAY_RULES.FIXED = 2;
BICst.DISPLAY_RULES.GRADIENT = 3;
BICst.LINE_WIDTH = {};
BICst.LINE_WIDTH.ZERO = 0;
BICst.LINE_WIDTH.ONE = 1;
BICst.POINTER = {};
BICst.POINTER.ONE = 1;
BICst.POINTER.SOME = 2;
BICst.CHART_TARGET_STYLE = {};
BICst.CHART_TARGET_STYLE.NUM_LEVEL = {};
BICst.CHART_TARGET_STYLE.NUM_LEVEL.NORMAL = 1;
BICst.CHART_TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND = 2;
BICst.CHART_TARGET_STYLE.NUM_LEVEL.MILLION = 3;
BICst.CHART_TARGET_STYLE.NUM_LEVEL.YI = 4;
BICst.CHART_TARGET_STYLE.NUM_LEVEL.PERCENT = 5;
BICst.CHART_TARGET_STYLE.FORMAT = {};
BICst.CHART_TARGET_STYLE.FORMAT.NORMAL = 1;
BICst.CHART_TARGET_STYLE.FORMAT.ZERO2POINT = 2;
BICst.CHART_TARGET_STYLE.FORMAT.ONE2POINT = 3;
BICst.CHART_TARGET_STYLE.FORMAT.TWO2POINT = 4;
BICst.DOT_VALUE_TYPE = {};
BICst.DOT_VALUE_TYPE.SIZE = 1;
BICst.DOT_VALUE_TYPE.COLOR = 2;
BICst.ACCUMULATE_TYPE = {};
BICst.ACCUMULATE_TYPE.COLUMN = 1;
BICst.ACCUMULATE_TYPE.STACKED_COLUMN = 2;
BICst.ACCUMULATE_TYPE.AREA_NORMAL = 3;
BICst.ACCUMULATE_TYPE.AREA_CURVE = 4;
BICst.ACCUMULATE_TYPE.AREA_RIGHT_ANGLE = 5;
BICst.ACCUMULATE_TYPE.STACKED_AREA_NORMAL = 6;
BICst.ACCUMULATE_TYPE.STACKED_AREA_CURVE = 7;
BICst.ACCUMULATE_TYPE.STACKED_AREA_RIGHT_ANGLE = 8;
BICst.ACCUMULATE_TYPE.LINE_NORMAL = 9;
BICst.ACCUMULATE_TYPE.LINE_CURVE = 10;
BICst.ACCUMULATE_TYPE.LINE_RIGHT_ANGLE = 11;
BICst.DATA_LABEL = {};
BICst.DATA_LABEL.POSITION_INNER = 1;
BICst.DATA_LABEL.POSITION_OUTER = 2;
BICst.DATA_LABEL.POSITION_CENTER = 2;
BICst.DOT_STYLE = {};
BICst.DOT_STYLE.SQUARE = 1;
BICst.DOT_STYLE.TRIANGLE = 2;
BICst.CHART_SHAPE = {};
BICst.CHART_SHAPE.NORMAL = 1;
BICst.CHART_SHAPE.RIGHT_ANGLE = 2;
BICst.CHART_SHAPE.CURVE = 3;
BICst.CHART_SHAPE.EQUAL_ARC_ROSE = 4;
BICst.CHART_SHAPE.NOT_EQUAL_ARC_ROSE = 5;
BICst.CHART_SHAPE.CIRCLE = 6;
BICst.CHART_SHAPE.POLYGON = 7;
BICst.CHART_SHAPE.HALF_DASHBOARD = 9;
BICst.CHART_SHAPE.PERCENT_DASHBOARD = 10;
BICst.CHART_SHAPE.PERCENT_SCALE_SLOT = 11;
BICst.CHART_SHAPE.VERTICAL_TUBE = 12;
BICst.CHART_SHAPE.HORIZONTAL_TUBE = 13;
BICst.CHART_SHAPE.NO_PROJECTOR = 16;
BICst.CHART_SHAPE.PROJECTOR = 17;
BICst.DASHBOARD_CHART_STYLE_AUTO = {};
BICst.DASHBOARD_CHART_STYLE_AUTO.THIRD = {};
BICst.DASHBOARD_CHART_STYLE_AUTO.THIRD.FROM = 2;
BICst.DASHBOARD_CHART_STYLE_AUTO.THIRD.TO = 2;
BICst.DASHBOARD_CHART_STYLE_AUTO.THIRD.COLOR = "";
BICst.DASHBOARD_CHART_STYLE_AUTO.SECOND = {};
BICst.DASHBOARD_CHART_STYLE_AUTO.SECOND.FROM = 2;
BICst.DASHBOARD_CHART_STYLE_AUTO.SECOND.TO = 2;
BICst.DASHBOARD_CHART_STYLE_AUTO.SECOND.COLOR = "";
BICst.DASHBOARD_CHART_STYLE_AUTO.FIRST = {};
BICst.DASHBOARD_CHART_STYLE_AUTO.FIRST.FROM = 2;
BICst.DASHBOARD_CHART_STYLE_AUTO.FIRST.TO = 2;
BICst.DASHBOARD_CHART_STYLE_AUTO.FIRST.COLOR = "";
BICst.PERCENTAGE = {};
BICst.PERCENTAGE.SHOW = 1;
BICst.PERCENTAGE.NOT_SHOW = 2;
BICst.CHART_LEGENDS = {};
BICst.CHART_LEGENDS.NOT_SHOW = 1;
BICst.CHART_LEGENDS.TOP = 2;
BICst.CHART_LEGENDS.RIGHT = 3;
BICst.CHART_LEGENDS.BOTTOM = 4;
BICst.CHART_LEGENDS.LEFT = 5;
BICst.FUNNEL_SLANT_STYLE = {};
BICst.FUNNEL_SLANT_STYLE.SAME = 1;
BICst.FUNNEL_SLANT_STYLE.DIFF = 2;
BICst.MULTI_PIE_GRADIENT_STYLE = {};
BICst.MULTI_PIE_GRADIENT_STYLE.LIGHTER = 1;
BICst.MULTI_PIE_GRADIENT_STYLE.DARKER = 2;
BICst.PIE_ANGLES = {};
BICst.PIE_ANGLES.THREE_FOURTHS = 270;
BICst.PIE_ANGLES.HALF = 180;
BICst.PIE_ANGLES.TOTAL = 360;
BICst.GIS_POSITION_TYPE = {};
BICst.GIS_POSITION_TYPE.ADDRESS = 1;
BICst.GIS_POSITION_TYPE.LNG_LAT = 2;
BICst.GIS_POSITION_TYPE.LNG_FIRST = 3;
BICst.GIS_POSITION_TYPE.LAT_FIRST = 4;
BICst.DATACOLUMN = {};
BICst.DATACOLUMN.X = 96;
BICst.DATACOLUMN.Y = 112;
BICst.DATACOLUMN.Z = 128;
BICst.DATACOLUMN.XANDY = 144;
BICst.DATACOLUMN.XANDYANDSIZE = 160;
BICst.DATA_LABEL_STYLE_TYPE = {};
BICst.DATA_LABEL_STYLE_TYPE.TEXT = 143;
BICst.DATA_LABEL_STYLE_TYPE.IMG = 144;
BICst.DATA_LABEL_RANGE = {};
BICst.DATA_LABEL_RANGE.ALL = 140;
BICst.DATA_LABEL_RANGE.Classification = 141;
BICst.DATA_LABEL_RANGE.Series = 142;
BICst.SCALE_SETTING = {};
BICst.SCALE_SETTING.AUTO = 1;
BICst.SCALE_SETTING.CUSTOM = 2;
BICst.CHART_STYLE = {};
BICst.CHART_STYLE.STYLE_NORMAL = 1;
BICst.CHART_STYLE.STYLE_GRADUAL = 2;
BICst.FONT_STYLE = {};
BICst.FONT_STYLE.FONTFAMILY = "inherit";
BICst.FONT_STYLE.COLOR = "#808080";
BICst.FONT_STYLE.FONTSIZE = "12px";
BICst.AUTO = 1;
BICst.X_AXIS = 3;
BICst.NORMAL = 1;
BICst.POLYGON = 7;
BICst.NOT_SHOW = 2;
BICst.ONE2POINT = 3;
BICst.TWO2POINT = 4;
BICst.LEFT_AXIS = 0;
BICst.LNG_FIRST = 3;
BICst.LAT_FIRST = 4;
BICst.FIX_COUNT = 6;
BICst.ROTATION = -90;
BICst.RIGHT_AXIS = 1;
BICst.ZERO2POINT = 2;
BICst.NO_PROJECT = 16;
BICst.MINLIMIT = 1.0E-5;
BICst.ONE_POINTER = 1;
BICst.MULTI_POINTER = 2;
BICst.LEGEND_BOTTOM = 4;
BICst.STYLE_NORMAL = 21;
BICst.LEGEND_HEIGHT = 80;
BICst.LEGEND_WIDTH = "30.0%";
BICst.HALF_DASHBOARD = 9;
BICst.VERTICAL_TUBE = 12;
BICst.DASHBOARD_AXIS = 4;
BICst.HORIZONTAL_TUBE = 13;
BICst.RIGHT_AXIS_SECOND = 2;
BICst.PERCENT_DASHBOARD = 10;
BICst.PERCENT_SCALE_SLOT = 11;
BICst.INTERVAL = 100;
BICst.GIS_MAP_PATH = "http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}";
BICst.KNOWLEDGE_RIGHT = "<a><img src='http://webapi.amap.com/theme/v1.3/mapinfo_05.png'>&copy; 2016 AutoNavi</a>";
BICst.NUM_SEPARATORS = false;
BICst.WMS_SERVER = "wms";
BICst.DATA_CONFIG_DESIGN = {};
BICst.DATA_CONFIG_DESIGN.NO = 0;
BICst.DATA_CONFIG_DESIGN.YES = 1;
BICst.DATA_CONFIG_AUTHORITY = {};
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER = {};
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.NODE = "__package_manager_node__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.PAGE = "__package_manager_page__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.SERVER_CONNECTION = "__package_server_connection__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.DATA_CONNECTION = "__package_data_connection__";
BICst.DATA_CONFIG_AUTHORITY.DATA_CONNECTION = {};
BICst.DATA_CONFIG_AUTHORITY.DATA_CONNECTION.NODE = "__data_connection_node__";
BICst.DATA_CONFIG_AUTHORITY.DATA_CONNECTION.PAGE = "__data_connection_page__";
BICst.DATA_CONFIG_AUTHORITY.MULTI_PATH_SETTING = "__multi_path_setting__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_AUTHORITY = "__package_authority__";
BICst.DATA_CONFIG_AUTHORITY.FINE_INDEX_UPDATE = "__fine_index_update__";
BICst.GLOBAL_UPDATE_TYPE = {};
BICst.GLOBAL_UPDATE_TYPE.PART_UPDATE = "_part_update_";
BICst.GLOBAL_UPDATE_TYPE.COMPLETE_UPDATE = "_complete_update_";
BICst.GLOBAL_UPDATE_TYPE.META_UPDATE = "_meta_update_";
BICst.CUBE_UPDATE_TYPE = {};
BICst.CUBE_UPDATE_TYPE.GLOBAL_UPDATE = "__global_update__";
BICst.CUBE_UPDATE_TYPE.SINGLETABLE_UPDATE = "__singleTable_update__";
BICst.SINGLE_TABLE_UPDATE = {};
BICst.SINGLE_TABLE_UPDATE.TOGETHER = 0;
BICst.SINGLE_TABLE_UPDATE.NEVER = 1;
BICst.SINGLE_TABLE_UPDATE_TYPE = {};
BICst.SINGLE_TABLE_UPDATE_TYPE.ALL = 0;
BICst.SINGLE_TABLE_UPDATE_TYPE.PART = 1;
BICst.SINGLE_TABLE_UPDATE_TYPE.NEVER = 2;
BICst.UPDATE_FREQUENCY = {};
BICst.UPDATE_FREQUENCY.EVER_DAY = 0;
BICst.UPDATE_FREQUENCY.EVER_SUNDAY = 1;
BICst.UPDATE_FREQUENCY.EVER_MONDAY = 2;
BICst.UPDATE_FREQUENCY.EVER_TUESDAY = 3;
BICst.UPDATE_FREQUENCY.EVER_WEDNESDAY = 4;
BICst.UPDATE_FREQUENCY.EVER_THURSDAY = 5;
BICst.UPDATE_FREQUENCY.EVER_FRIDAY = 6;
BICst.UPDATE_FREQUENCY.EVER_SATURDAY = 7;
BICst.UPDATE_FREQUENCY.EVER_MONTH = 10;
BICst.REQ_DATA_TYPE = {};
BICst.REQ_DATA_TYPE.REQ_GET_ALL_DATA = -1;
BICst.REQ_DATA_TYPE.REQ_GET_DATA_LENGTH = 0;
BICst.TRANS_TYPE = {};
BICst.TRANS_TYPE.READ_FROM_DB = "db";
BICst.TRANS_TYPE.READ_FROM_TABLEDATA = "tabledata";
BICst.TRANS_TYPE.CHOOSE = "choose";
BICst.CONNECTION = {};
BICst.CONNECTION.ETL_CONNECTION = "__FR_BI_ETL__";
BICst.CONNECTION.SERVER_CONNECTION = "__FR_BI_SERVER__";
BICst.CONNECTION.SQL_CONNECTION = "__FR_BI_SQL__";
BICst.CONNECTION.EXCEL_CONNECTION = "__FR_BI_EXCEL__";
BICst.COLUMN = {};
BICst.COLUMN.NUMBER = 32;
BICst.COLUMN.STRING = 16;
BICst.COLUMN.DATE = 48;
BICst.COLUMN.COUNTER = 64;
BICst.COLUMN.ROW = 80;
BICst.CLASS = {};
BICst.CLASS.INTEGER = 0;
BICst.CLASS.LONG = 1;
BICst.CLASS.DOUBLE = 2;
BICst.CLASS.FLOAT = 3;
BICst.CLASS.DATE = 4;
BICst.CLASS.STRING = 5;
BICst.CLASS.BOOLEAN = 6;
BICst.CLASS.TIMESTAMP = 7;
BICst.CLASS.DECIMAL = 8;
BICst.CLASS.TIME = 9;
BICst.CLASS.BYTE = 10;
BICst.CLASS.ROW = 16;
BICst.SYSTEM_USER_NAME = "__system_user_name__";
BICst.LAST_UPDATE_TIME = "__last_update_time__";
BICst.CURRENT_UPDATE_TIME = "__current_update_time__";
BICst.FUNCTION = {};
BICst.FUNCTION.TEXT = 1;
BICst.FUNCTION.MATH = 2;
BICst.FUNCTION.DATE = 3;
BICst.FUNCTION.ARRAY = 4;
BICst.FUNCTION.LOGIC = 5;
BICst.FUNCTION.OTHER = 6;

246
docs/case.js

@ -3527,7 +3527,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
type: "bi.center_adapt",
items: [{
type: "bi.layout",
cls: "bubble-combo-triangle-" + direction
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
}]
});
pos.el = this.triangle;
@ -3592,6 +3592,10 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
showView: function () {
this.combo && this.combo.showView();
},
hasView: function () {
return BI.isNotNull(this.combo.getView());
}
});
@ -3663,7 +3667,7 @@ BI.BubblePopupView = BI.inherit(BI.PopupView, {
}
this.line = BI.createWidget(op, {
type: "bi.layout",
cls: "bubble-popup-line"
cls: "bubble-popup-line bi-high-light-background"
});
pos.el = this.line;
BI.createWidget({
@ -4899,167 +4903,6 @@ BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, {
}
});
BI.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/**
* 根据内容自适应长度的输入框
* @class BI.AdaptiveEditor
* @extends BI.Single
*/
BI.AdaptiveEditor = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.AdaptiveEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-adapt-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
mouseOut: false,
allowBlank: true,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.AdaptiveEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.sign_editor",
element: this,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
mouseOut: o.mouseOut,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_FOCUS);
});
this.editor.on(BI.SignEditor.EVENT_BLUR, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_BLUR);
});
this.editor.on(BI.SignEditor.EVENT_CLICK, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_CLICK);
});
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () {
self._checkEditorLength();
self.fireEvent(BI.AdaptiveEditor.EVENT_CHANGE);
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.AdaptiveEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.SignEditor.EVENT_VALID, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_VALID);
});
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_CONFIRM);
});
this.editor.on(BI.SignEditor.EVENT_START, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_START);
});
this.editor.on(BI.SignEditor.EVENT_PAUSE, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_STOP);
});
this.editor.on(BI.SignEditor.EVENT_SPACE, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_SPACE);
});
this.editor.on(BI.SignEditor.EVENT_ERROR, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_ERROR);
});
this.editor.on(BI.SignEditor.EVENT_ENTER, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_ENTER);
});
this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_RESTRICT);
});
this.editor.on(BI.SignEditor.EVENT_EMPTY, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_EMPTY);
});
this._checkEditorLength();
},
_checkEditorLength: function () {
var o = this.options;
this.element.width(BI.DOM.getTextSizeWidth(this.getValue(), 14) + 2 * o.hgap + o.lgap + o.rgap);
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
isValid: function () {
return this.editor.isValid();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
setValue: function (k) {
this.editor.setValue(k);
this._checkEditorLength();
},
getValue: function () {
return this.editor.getValue();
},
getState: function () {
return this.editor.getState();
},
setState: function (v) {
}
});
BI.AdaptiveEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.AdaptiveEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.AdaptiveEditor.EVENT_BLUR = "EVENT_BLUR";
BI.AdaptiveEditor.EVENT_CLICK = "EVENT_CLICK";
BI.AdaptiveEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.AdaptiveEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.AdaptiveEditor.EVENT_START = "EVENT_START";
BI.AdaptiveEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.AdaptiveEditor.EVENT_STOP = "EVENT_STOP";
BI.AdaptiveEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.AdaptiveEditor.EVENT_VALID = "EVENT_VALID";
BI.AdaptiveEditor.EVENT_ERROR = "EVENT_ERROR";
BI.AdaptiveEditor.EVENT_ENTER = "EVENT_ENTER";
BI.AdaptiveEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.AdaptiveEditor.EVENT_SPACE = "EVENT_SPACE";
BI.AdaptiveEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.adapt_editor", BI.AdaptiveEditor);/**
* 有清楚按钮的文本框
* Created by GUY on 2015/9/29.
* @class BI.SmallTextEditor
@ -5402,7 +5245,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
setEnable: function (b) {
BI.Editor.superclass.setEnable.apply(this, arguments);
this.editor && this.editor.setEnable(b);
this.clear.setEnabled(b);
this.clear.setEnable(b);
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";
@ -5447,9 +5290,9 @@ BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/**
* 带标记的文本框
* Created by GUY on 2016/1/25.
* @class BI.ShelterEditor
* @extends BI.Single
* @extends BI.Widget
*/
BI.ShelterEditor = BI.inherit(BI.Single, {
BI.ShelterEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -5494,6 +5337,9 @@ BI.ShelterEditor = BI.inherit(BI.Single, {
this.text = BI.createWidget({
type: "bi.text_button",
cls: "shelter-editor-text",
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: o.textAlign,
height: o.height,
hgap: 4
@ -5599,6 +5445,14 @@ BI.ShelterEditor = BI.inherit(BI.Single, {
this.text.visible();
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
focus: function () {
this._showInput();
this.editor.focus();
@ -5697,7 +5551,7 @@ BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/**
* @class BI.SignInitialEditor
* @extends BI.Single
*/
BI.SignInitialEditor = BI.inherit(BI.Single, {
BI.SignInitialEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -5860,9 +5714,9 @@ BI.shortcut("bi.sign_initial_editor", BI.SignInitialEditor);/**
* 带标记的文本框
* Created by GUY on 2015/8/28.
* @class BI.SignEditor
* @extends BI.Single
* @extends BI.Widget
*/
BI.SignEditor = BI.inherit(BI.Single, {
BI.SignEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -5906,6 +5760,9 @@ BI.SignEditor = BI.inherit(BI.Single, {
this.text = BI.createWidget({
type: "bi.text_button",
cls: "sign-editor-text",
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
height: o.height,
hgap: 4,
@ -6016,6 +5873,14 @@ BI.SignEditor = BI.inherit(BI.Single, {
this.text.visible();
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
focus: function () {
this._showInput();
this.editor.focus();
@ -6053,7 +5918,7 @@ BI.SignEditor = BI.inherit(BI.Single, {
return this.editor.isValid();
},
setValid: function(v){
setValid: function (v) {
BI.SignEditor.superclass.setValid.apply(this, arguments);
this.editor.setValid(v);
},
@ -6116,7 +5981,7 @@ BI.shortcut("bi.sign_editor", BI.SignEditor);/**
* @class BI.StateEditor
* @extends BI.Single
*/
BI.StateEditor = BI.inherit(BI.Single, {
BI.StateEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -6345,15 +6210,15 @@ BI.StateEditor = BI.inherit(BI.Single, {
return;
}
if (BI.isString(v)) {
if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setTitle("");
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(v);
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
}
// if (BI.isEmpty(v)) {
// this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
// this.text.setTitle("");
// this.text.element.addClass("state-editor-infinite-text");
// } else {
this.text.setText(v);
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
// }
return;
}
if (BI.isArray(v)) {
@ -6396,7 +6261,7 @@ BI.shortcut("bi.state_editor", BI.StateEditor);/**
* @class BI.SimpleStateEditor
* @extends BI.Single
*/
BI.SimpleStateEditor = BI.inherit(BI.Single, {
BI.SimpleStateEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -6655,7 +6520,7 @@ BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/**
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Single, {
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -6748,7 +6613,7 @@ BI.TextEditor = BI.inherit(BI.Single, {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR);
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);
@ -7177,6 +7042,13 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.check();
},
removeItemAt: function (indexes) {
indexes = indexes || [];
BI.removeAt(this.options.items, indexes);
this.button_group.removeItemAt.apply(this.button_group, arguments);
this.check();
},
populate: function (items) {
var self = this, o = this.options;
if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法
@ -7897,8 +7769,8 @@ BI.SortList = BI.inherit(BI.Widget, {
containment: o.containment || this.element,
connectWith: o.connectWith || ".bi-sort-list",
items: ".sort-item",
cursor: "drag",
tolerance: "intersect",
cursor: o.cursor || "drag",
tolerance: o.tolerance || "intersect",
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({
@ -11335,10 +11207,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
}
},
@ -11976,7 +11846,7 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, {
_init: function () {
BI.ZeroClip.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.nextTick(function () {
self.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf",

7600
docs/chart.js

File diff suppressed because it is too large Load Diff

63
docs/core.css

@ -3047,6 +3047,9 @@ i {
background-color: #3f8ce8;
color: #ffffff;
}
.bi-high-light-border {
border-color: #178cdf;
}
.bi-water-mark {
color: #cccccc;
cursor: text;
@ -3063,10 +3066,20 @@ i {
.bi-theme-dark .bi-resizer {
background: #ffffff;
}
.bi-mask {
color: #ffffff;
background-color: rgba(26, 26, 26, 0.2);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#331a1a1a,endColorstr=#331a1a1a);
}
.bi-theme-dark .bi-mask {
color: #242640;
background-color: rgba(255, 255, 255, 0.2);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff,endColorstr=#33ffffff);
}
.bi-z-index-mask {
color: #ffffff;
background-color: rgba(26, 26, 26, 0.5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a);
background-color: rgba(26, 26, 26, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d1a1a1a,endColorstr=#4d1a1a1a);
}
.bi-list-item:hover,
.bi-list-item.hover {
@ -3102,6 +3115,10 @@ i {
.bi-theme-dark .bi-list-item.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-border:active,
.bi-list-item-border.active {
border: 1px solid #178cdf;
}
.bi-list-item-simple {
color: #999999;
}
@ -3200,6 +3217,48 @@ i {
.bi-theme-dark .bi-list-item-active.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-active2:hover,
.bi-list-item-active2.hover {
color: #1a1a1a;
background-color: #ffffff;
}
.bi-list-item-active2.active,
.bi-list-item-active2:active {
color: #3f8ce8;
background-color: #ffffff;
}
.bi-list-item-active2.disabled,
.bi-list-item-active2.disabled:hover,
.bi-list-item-active2.disabled:active {
background-color: transparent !important;
color: #cccccc !important;
}
.bi-list-item-active2.disabled .bi-high-light,
.bi-list-item-active2.disabled:hover .bi-high-light,
.bi-list-item-active2.disabled:active .bi-high-light {
color: #cccccc !important;
}
.bi-theme-dark .bi-list-item-active2:hover,
.bi-theme-dark .bi-list-item-active2.hover {
color: #ffffff;
background-color: #242640;
}
.bi-theme-dark .bi-list-item-active2.active,
.bi-theme-dark .bi-list-item-active2:active {
color: #3f8ce8;
background-color: #242640;
}
.bi-theme-dark .bi-list-item-active2.disabled,
.bi-theme-dark .bi-list-item-active2.disabled:hover,
.bi-theme-dark .bi-list-item-active2.disabled:active {
background-color: transparent !important;
color: #666666 !important;
}
.bi-theme-dark .bi-list-item-active2.disabled .bi-high-light,
.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-high-light,
.bi-theme-dark .bi-list-item-active2.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-select:hover,
.bi-list-item-select.hover {
color: #1a1a1a;

306
docs/core.js

@ -14062,6 +14062,26 @@ if (!window.BI) {
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
},
isIE9Below: function () {
if (!BI.isIE()) {
return false;
}
var version = 0;
var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/);
var v2 = agent.match(/(?:trident.*rv:([\w.]+))/);
if (v1 && v2 && v1[1] && v2[1]) {
version = Math.max(v1[1] * 1, v2[1] * 1);
} else if (v1 && v1[1]) {
version = v1[1] * 1;
} else if (v2 && v2[1]) {
version = v2[1] * 1;
} else {
version = 0;
}
return version < 9;
},
isEdge: function () {
return /edge/i.test(navigator.userAgent.toLowerCase());
},
@ -14487,11 +14507,12 @@ BI.Widget = BI.inherit(BI.OB, {
setVisible: function (visible) {
if (visible === true) {
this.options.invisible = false;
this.element.show();
//用this.element.show()会把display属性改成block
this.element.css("display", "");
this._mount();
} else if (visible === false) {
this.options.invisible = true;
this.element.hide();
this.element.css("display", "none");
}
this.fireEvent(BI.Events.VIEW, visible);
},
@ -21240,6 +21261,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
type: "bi.tooltip",
text: text,
level: level,
stopEvent: true,
height: this._const.height
});
},
@ -21434,7 +21456,7 @@ BI.FloatBoxRouter = BI.inherit(BI.WRouter, {
if(this.controller){
this.controller.remove(url);
delete this.store[url];
this.views[url] && this.views[url].destroy();
this.views[url] && this.views[url].model.destroy();
delete this.views[url];
}
return this;
@ -22547,7 +22569,9 @@ BI.extend(jQuery, {
}
break;
}
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
if(needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
}
return position;
}
});/**
@ -22689,6 +22713,9 @@ $(function () {
//获取对比颜色
getContrastColor: function (color) {
if (!color) {
return "";
}
if (this.isDarkColor(color)) {
return "#ffffff";
}
@ -23831,6 +23858,32 @@ Date.prototype.getQuarterStartMonth = function () {
}
return quarterStartMonth;
};
//指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime());
var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if(day > monthDay){
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
};
//获得本周的起始日期
Date.prototype.getWeekStartDate = function () {
var w = this.getDay();
return this.getOffsetDate(-w);
};
//得到本周的结束日期
Date.prototype.getWeekEndDate = function () {
var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w);
return this.getOffsetDate(offset);
};
//获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);
@ -25945,174 +25998,6 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut('bi.horizontal_float', BI.FloatHorizontalLayout);/**
* 内联布局
* @class BI.InlineCenterAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineCenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-center-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + "-" + i)) {
var t = BI.createWidget(item);
t.element.css({
"position": "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + "-" + i, w);
} else {
var w = this.getWidgetByName(this.getName() + "-" + i);
}
w.element.css({
"position": "relative",
"display": "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("cannot be added");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (!!item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineCenterAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline_center_adapt', BI.InlineCenterAdaptLayout);/**
* 内联布局
* @class BI.InlineVerticalAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineVerticalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-vertical-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
"position": "relative",
"display": "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1
});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.InlineVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline_vertical_adapt', BI.InlineVerticalAdaptLayout);/**
*自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2.
*
@ -27680,68 +27565,6 @@ BI.HorizontalCellLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut('bi.horizontal_cell', BI.HorizontalCellLayout);/**
* 内联布局
* @class BI.InlineLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function(){
this.stroke(this.options.items);
},
populate: function (items) {
BI.InlineLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline', BI.InlineLayout);/**
* 靠左对齐的自由浮动布局
* @class BI.LatticeLayout
* @extends BI.Layout
@ -28950,6 +28773,21 @@ $(function () {
return ob;
}
});
//注册滚动条
BI.Plugin.registerWidget("bi.grid_table_scrollbar", function (ob) {
if (BI.isIE9Below()) {
return BI.extend(ob, {type: "bi.native_table_scrollbar"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.grid_table_horizontal_scrollbar", function (ob) {
if (BI.isIE9Below()) {
return BI.extend(ob, {type: "bi.native_table_horizontal_scrollbar"});
} else {
return ob;
}
});
//注册控件
BI.Plugin.registerWidget("bi.grid_table", function (ob) {

231
docs/demo.js

File diff suppressed because one or more lines are too long

5
docs/index.html

@ -19,6 +19,11 @@
<script src="base.js"></script>
<script src="case.js"></script>
<script src="widget.js"></script>
<!--图表-->
<script src="vancharts-all.js"></script>
<script src="biconst.js"></script><!--图表用到的常量(直接拿的bi的常量)-->
<script src="chart.js"></script>
<script src="demo.js"></script>
</head>
<body>

32
docs/resource.css

@ -3,7 +3,7 @@
/**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
@ -51,20 +51,11 @@ body {
-moz-outline: 0 none;
outline: 0 none;
}
#wrapper {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
}
div::-webkit-scrollbar,
textarea::-webkit-scrollbar {
-webkit-appearance: none;
background-color: rgba(102, 102, 102, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666,endColorstr=#0d666666);
width: 6px;
height: 6px;
}
@ -74,11 +65,18 @@ textarea::-webkit-scrollbar-thumb {
-moz-border-radius: 0;
border-radius: 0;
background-color: rgba(102, 102, 102, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666,endColorstr=#4d666666);
}
div::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
background-color: rgba(102, 102, 102, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666,endColorstr=#b3666666);
}
.bi-theme-dark div::-webkit-scrollbar,
.bi-theme-dark textarea::-webkit-scrollbar {
-webkit-appearance: none;
background-color: rgba(204, 204, 204, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc,endColorstr=#0dcccccc);
width: 6px;
height: 6px;
}
@ -88,6 +86,12 @@ textarea::-webkit-scrollbar-thumb {
-moz-border-radius: 0;
border-radius: 0;
background-color: rgba(204, 204, 204, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc,endColorstr=#4dcccccc);
}
.bi-theme-dark div::-webkit-scrollbar-thumb:hover,
.bi-theme-dark textarea::-webkit-scrollbar-thumb:hover {
background-color: rgba(204, 204, 204, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc,endColorstr=#b3cccccc);
}
.base-line-conn-background {
background: url('icon/tree-vertical-line-1.png') repeat-y 0 0;
@ -104,7 +108,7 @@ textarea::-webkit-scrollbar-thumb {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/tree-vertical-line-2.png');
_background: none;
}
.bi-theme-dark .base-line-conn-background {
.bi-theme-dark .first-line-conn-background {
background: url('icon/dark/tree-vertical-line-2.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/dark/tree-vertical-line-2.png');
_background: none;
@ -114,7 +118,7 @@ textarea::-webkit-scrollbar-thumb {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/tree-vertical-line-3.png');
_background: none;
}
.bi-theme-dark .base-line-conn-background {
.bi-theme-dark .mid-line-conn-background {
background: url('icon/dark/tree-vertical-line-3.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/dark/tree-vertical-line-3.png');
_background: none;
@ -124,7 +128,7 @@ textarea::-webkit-scrollbar-thumb {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/tree-vertical-line-4.png');
_background: none;
}
.bi-theme-dark .base-line-conn-background {
.bi-theme-dark .last-line-conn-background {
background: url('icon/dark/tree-vertical-line-4.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/dark/tree-vertical-line-4.png');
_background: none;

167
docs/vancharts-all.js

File diff suppressed because one or more lines are too long

35
docs/widget.css

@ -190,33 +190,6 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-image-button-href .image-button-href-icon-button {
z-index: 1;
font-size: 16px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-image-button-size .image-button-size-button-group {
font-size: 12px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-upload-image .upload-image-text-button-label {
font-size: 14px;
color: #999999;
}
.bi-upload-image .upload-image-icon-button {
z-index: 1;
font-size: 16px;
}
.bi-upload-image .upload-image-delete-label {
font-size: 14px;
}
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-interactive-arrangement .interactive-arrangement-dragtag-line {
z-index: 1000000000;
background-color: #f07d0a;
@ -397,6 +370,14 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-preview-table {
-webkit-user-select: initial;
-khtml-user-select: initial;
-moz-user-select: initial;
-ms-user-select: initial;
-o-user-select: initial;
user-select: initial;
}
.bi-preview-table > div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #eff1f4;

74
docs/widget.js

@ -173,12 +173,18 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
items[1].height = 0;
} else if (o.isNeedFreeze === true) {
items[0].height = headerHeight;
items[1].height = 2;
}
this.layout.attr("items", items);
this.layout.resize();
this.scrollContainer.element.scrollTop(o.scrollTop);
try {
this.scrollContainer.element.scrollTop(o.scrollTop);
} catch (e) {
}
},
_getHeaderHeight: function () {
@ -352,7 +358,11 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
setVerticalScroll: function (scrollTop) {
if (this.options.scrollTop !== scrollTop) {
this.options.scrollTop = scrollTop;
this.scrollContainer.element.scrollTop(scrollTop);
try {
this.scrollContainer.element.scrollTop(scrollTop);
} catch (e) {
}
}
},
@ -945,7 +955,7 @@ BI.ArrangementBlock = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ArrangementBlock.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-arrangement-block bi-resizer"
baseCls: "bi-arrangement-block bi-mask"
});
},
@ -4951,7 +4961,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
self.fireEvent(BI.DateTrigger.EVENT_ERROR);
});
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () {
var value = self.editor.getState();
var value = self.editor.getValue();
if (BI.isNotNull(value)) {
self.editor.setState(value);
}
@ -9853,7 +9863,6 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
this.storeValue = v || {};
this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue);
this.trigger.setValue(this.storeValue);
},
getValue: function () {
@ -12261,7 +12270,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
var self = this, c = this.constants, o = this.options;
BI.NumericalInterval.superclass._init.apply(this, arguments)
this.smallEditor = BI.createWidget({
type: "bi.sign_editor",
type: "bi.editor",
height: o.height - 2,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true,
@ -12298,7 +12307,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
});
this.bigEditor = BI.createWidget({
type: "bi.sign_editor",
type: "bi.editor",
height: o.height - 2,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true,
@ -12525,7 +12534,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setFocusEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.SignEditor.EVENT_FOCUS, function () {
w.on(BI.Editor.EVENT_FOCUS, function () {
self._setTitle("");
switch (self._checkValidation()) {
case c.typeError:
@ -12551,7 +12560,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
},
_setBlurEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.SignEditor.EVENT_BLUR, function () {
w.on(BI.Editor.EVENT_BLUR, function () {
BI.Bubbles.hide(c.typeError);
BI.Bubbles.hide(c.numberError);
BI.Bubbles.hide(c.signalError);
@ -12573,7 +12582,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setErrorEvent: function (w) {
var c = this.constants, self = this
w.on(BI.SignEditor.EVENT_ERROR, function () {
w.on(BI.Editor.EVENT_ERROR, function () {
self._checkValidation();
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
offsetStyle: "center"
@ -12585,7 +12594,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setValidEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.SignEditor.EVENT_VALID, function () {
w.on(BI.Editor.EVENT_VALID, function () {
switch (self._checkValidation()) {
case c.numberError:
BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, {
@ -12608,7 +12617,7 @@ BI.NumericalInterval = BI.inherit(BI.Single, {
_setEditorValueChangedEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.SignEditor.EVENT_CHANGE, function () {
w.on(BI.Editor.EVENT_CHANGE, function () {
switch (self._checkValidation()) {
case c.typeError:
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
@ -13045,6 +13054,18 @@ BI.PageTable = BI.inherit(BI.Widget, {
return this.table.getVerticalScroll();
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
restore: function () {
this.table.restore();
},
@ -15797,6 +15818,9 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
items: [{
el: this.headerContainer,
height: o.headerRowSize * o.header.length - 2
}, {
el: {type: "bi.layout"},
height: 2
}, {
el: this.scrollContainer
}]
@ -15806,17 +15830,23 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
_layout: function () {
var self = this, o = this.options;
var headerHeight = o.headerRowSize * o.header.length;
var headerHeight = o.headerRowSize * o.header.length - 2;
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
items[1].height = 0;
} else if (o.isNeedFreeze === true) {
items[0].height = headerHeight;
items[1].height = 2;
}
this.layout.attr("items", items);
this.layout.resize();
this.container.setHeight(o.items.length * o.rowSize);
this.scrollContainer.element.scrollTop(o.scrollTop);
try {
this.scrollContainer.element.scrollTop(o.scrollTop);
} catch (e) {
}
},
_createHeader: function () {
@ -15925,7 +15955,11 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
setVerticalScroll: function (scrollTop) {
if (this.options.scrollTop !== scrollTop) {
this.options.scrollTop = scrollTop;
this.scrollContainer.element.scrollTop(scrollTop);
try {
this.scrollContainer.element.scrollTop(scrollTop);
} catch (e) {
}
}
},
@ -16160,6 +16194,14 @@ BI.SequenceTable = BI.inherit(BI.Widget, {
return this.table.hasRightHorizontalScroll();
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
this.sequence.setVerticalScroll(scrollTop);
@ -16769,7 +16811,7 @@ BI.YearTrigger = BI.inherit(BI.Trigger, {
self.editor.setTitle(value);
}
self.fireEvent(BI.YearTrigger.EVENT_CONFIRM);
})
});
this.editor.on(BI.SignEditor.EVENT_SPACE, function () {
if (self.editor.isValid()) {
self.editor.blur();

156
src/addons/chart/chart.combine.js

@ -0,0 +1,156 @@
/**
* 图表控件
* @class BI.CombineChart
* @extends BI.Widget
*/
BI.CombineChart = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.CombineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-combine-chart",
items: [],
xAxis: [{type: "category"}],
yAxis: [{type: "value"}],
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
});
this.CombineChart.on(BI.Chart.EVENT_CHANGE, function (obj) {
self.fireEvent(BI.CombineChart.EVENT_CHANGE, obj);
});
if (BI.isNotEmptyArray(o.items)) {
this.populate(o.items);
}
},
_formatItems: function (items) {
var result = [], self = this, o = this.options;
var yAxisIndex = 0;
BI.each(items, function (i, belongAxisItems) {
var combineItems = BI.ChartCombineFormatItemFactory.combineItems(o.types[i], belongAxisItems);
BI.each(combineItems, function (j, axisItems) {
if (BI.isArray(axisItems)) {
result = BI.concat(result, axisItems);
} else {
result.push(BI.extend(axisItems, {"yAxis": yAxisIndex}));
}
});
if (BI.isNotEmptyArray(combineItems)) {
yAxisIndex++;
}
});
var config = BI.ChartCombineFormatItemFactory.combineConfig();
config.plotOptions.click = function () {
var data = BI.clone(this.options);
data.toolTipRect = this.getTooltipRect();
var items = o.popupItemsGetter(data);
if (items && items.length === 1) {
self.fireEvent(BI.CombineChart.EVENT_ITEM_CLICK, BI.extend({}, items[0], data));
}
if (items && items.length > 1) {
self._createPopup(items, data.toolTipRect, data);
}
self.fireEvent(BI.CombineChart.EVENT_CHANGE, data);
};
return [result, config];
},
_createPopup: function (items, rect, opt) {
var self = this;
if (this.combo) {
this.combo.destroy();
}
this._doDestroy = true;
this.combo = BI.createWidget({
type: "bi.combo",
direction: "bottom",
isNeedAdjustWidth: false,
popup: {
el: BI.createWidget({
type: "bi.vertical",
cls: "bi-linkage-list",
items: BI.map(items, function (i, item) {
return {
el: BI.extend({
type: "bi.text_button",
cls: "bi-linkage-list-item",
height: 30,
handler: function () {
self.fireEvent(BI.CombineChart.EVENT_ITEM_CLICK, BI.extend({}, item, opt));
self.combo.destroy();
},
hgap: 10
}, item)
}
})
})
},
width: 0
});
BI.createWidget({
type: "bi.absolute",
element: this.element,
items: [{
el: this.combo,
top: rect.y,
left: rect.x
}]
});
this.combo.element.hover(function () {
self._doDestroy = false;
}, function () {
self._doDestroy = true;
self._debounce2Destroy();
});
this._debounce2Destroy = BI.debounce(BI.bind(destroyCombo, this.combo), 3000);
this.combo.showView();
this._debounce2Destroy();
function destroyCombo() {
if (self._doDestroy) {
this.destroy();
}
}
},
setTypes: function (types) {
this.options.types = types || [[]];
},
populate: function (items, types) {
var o = this.options;
if (BI.isNotNull(types)) {
this.setTypes(types);
}
var opts = this._formatItems(items);
BI.extend(opts[1], {
xAxis: o.xAxis,
yAxis: o.yAxis
});
var result = o.formatConfig(opts[1], opts[0]) || opts;
this.CombineChart.populate(result[0], result[1]);
},
resize: function () {
this.CombineChart.resize();
},
magnify: function () {
this.CombineChart.magnify();
}
});
BI.CombineChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.CombineChart.EVENT_ITEM_CLICK = "EVENT_ITEM_CLICK";
BI.shortcut('bi.combine_chart', BI.CombineChart);

53
src/addons/chart/chart.js

@ -0,0 +1,53 @@
/**
* 图表控件
* @class BI.Chart
* @extends BI.Widget
*/
BI.Chart = BI.inherit(BI.Pane, {
_defaultConfig: function () {
return BI.extend(BI.Chart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-chart"
})
},
_init: function () {
BI.Chart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.isSetOptions = false;
this.vanCharts = VanCharts.init(self.element[0]);
this._resizer = BI.debounce(function () {
self.vanCharts.resize();
}, 30);
BI.ResizeDetector.addResizeListener(this, function (e) {
self._resizer();
});
},
resize: function () {
if (this.isSetOptions === true) {
this._resizer();
}
},
magnify: function () {
this.vanCharts.refreshRestore()
},
populate: function (items, options) {
var self = this, o = this.options;
o.items = items;
this.config = options || {};
this.config.series = o.items;
var setOptions = function () {
self.vanCharts.setOptions(self.config);
self.isSetOptions = true;
};
BI.nextTick(setOptions);
}
});
BI.Chart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.chart', BI.Chart);

286
src/addons/chart/chart/chart.abstract.js

@ -0,0 +1,286 @@
/**
* 图表控件
* @class BI.AbstractChart
* @extends BI.Widget
*/
BI.AbstractChart = BI.inherit(BI.Widget, {
constants: {
LEFT_AXIS: 0,
RIGHT_AXIS: 1,
RIGHT_AXIS_SECOND: 2,
X_AXIS: 3,
ROTATION: -90,
NORMAL: 1,
LEGEND_BOTTOM: 4,
ZERO2POINT: 2,
ONE2POINT: 3,
TWO2POINT: 4,
MINLIMIT: 1e-5,
LEGEND_HEIGHT: 80,
LEGEND_WIDTH: "30.0%",
FIX_COUNT: 6,
STYLE_NORMAL: 21,
NO_PROJECT: 16,
DASHBOARD_AXIS: 4,
ONE_POINTER: 1,
MULTI_POINTER: 2,
HALF_DASHBOARD: 9,
PERCENT_DASHBOARD: 10,
PERCENT_SCALE_SLOT: 11,
VERTICAL_TUBE: 12,
HORIZONTAL_TUBE: 13,
LNG_FIRST: 3,
LAT_FIRST: 4,
themeColor: "#65bce7",
autoCustom: 1,
POLYGON: 7,
AUTO_CUSTOM: 1,
AUTO: 1,
NOT_SHOW: 2,
LINE_WIDTH: 1,
NUM_SEPARATORS: false,
FONT_STYLE: {
"fontFamily": "inherit",
"color": "inherit",
"fontSize": "12px"
}
},
_defaultConfig: function () {
return BI.extend(BI.AbstractChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-abstract-chart",
popupItemsGetter: BI.emptyFn
})
},
_init: function () {
BI.AbstractChart.superclass._init.apply(this, arguments);
},
/**
* 格式化坐标轴数量级及其所影响的系列的各项属性
* @param config 配置信息
* @param items 系列数据
* @param type 坐标轴数量级
* @param position 坐标轴位置
* @param formatter 系列tooltip格式化内容
*/
formatNumberLevelInYaxis: function (config, items, type, position, formatter, isPercentChart) {
var magnify = this.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (position === item.yAxis) {
if (BI.isNotNull(da.y) && !BI.isNumber(da.y)) {
da.y = BI.parseFloat(da.y);
}
if (BI.isNotNull(da.y)) {
da.y = BI.contentFormat(BI.parseFloat(da.y.div(magnify).toFixed(4)), "#.####;-#.####");
}
}
});
if (position === item.yAxis) {
item.tooltip = BI.deepClone(config.plotOptions.tooltip);
item.tooltip.formatter.valueFormat = formatter;
if(isPercentChart) {
item.tooltip.formatter.percentFormat = formatter;
item.tooltip.formatter.identifier = "${CATEGORY}${SERIES}${PERCENT}";
}
}
});
},
formatNumberLevelInXaxis: function (items, type) {
var magnify = this.calcMagnify(type);
BI.each(items, function (idx, item) {
BI.each(item.data, function (id, da) {
if (BI.isNotNull(da.x) && !BI.isNumber(da.x)) {
da.x = BI.parseFloat(da.x);
}
if (BI.isNotNull(da.x)) {
da.x = BI.contentFormat(BI.parseFloat(da.x.div(magnify).toFixed(4)), "#.####;-#.####");
}
});
})
},
formatXYDataWithMagnify: function (number, magnify) {
if (BI.isNull(number)) {
return null
}
if (!BI.isNumber(number)) {
number = BI.parseFloat(number);
}
return BI.contentFormat(BI.parseFloat(number.div(magnify).toFixed(4)), "#.####;-#.####");
},
calcMagnify: function (type) {
var magnify = 1;
switch (type) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
case BICst.TARGET_STYLE.NUM_LEVEL.PERCENT:
magnify = 1;
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
magnify = 10000;
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
magnify = 1000000;
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
magnify = 100000000;
break;
}
return magnify;
},
formatChartLegend: function (config, chartLegend) {
switch (chartLegend) {
case BICst.CHART_LEGENDS.BOTTOM:
config.legend.enabled = true;
config.legend.position = "bottom";
config.legend.maxHeight = this.constants.LEGEND_HEIGHT;
break;
case BICst.CHART_LEGENDS.RIGHT:
config.legend.enabled = true;
config.legend.position = "right";
config.legend.maxWidth = this.constants.LEGEND_WIDTH;
break;
case BICst.CHART_LEGENDS.NOT_SHOW:
default:
config.legend.enabled = false;
break;
}
},
getXYAxisUnit: function (numberLevelType, axis_unit) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
return (BI.isEmptyString(unit) && BI.isEmptyString(axis_unit)) ? unit : "(" + unit + axis_unit + ")";
},
formatTickInXYaxis: function (type, number_level, separators, isCompareBar) {
var formatter = '#.##';
switch (type) {
case this.constants.NORMAL:
formatter = '#.##';
if (separators) {
formatter = '#,###.##'
}
break;
case this.constants.ZERO2POINT:
formatter = '#0';
if (separators) {
formatter = '#,###';
}
break;
case this.constants.ONE2POINT:
formatter = '#0.0';
if (separators) {
formatter = '#,###.0';
}
break;
case this.constants.TWO2POINT:
formatter = '#0.00';
if (separators) {
formatter = '#,###.00';
}
break;
}
if (number_level === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
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)
}
},
formatDataLabel: function (state, items, config, style) {
var self = this;
if (state === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"align": "outside",
"autoAdjust": true,
style: style,
enabled: true,
formatter: {
identifier: "${VALUE}",
valueFormat: config.yAxis[item.yAxis].formatter
}
};
});
}
},
formatDataLabelForAxis: function (state, items, format, style, isPercentChart) {
var self = this;
if (state === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"align": "outside",
"autoAdjust": true,
style: style,
enabled: true,
formatter: {
identifier: "${VALUE}",
valueFormat: format,
}
};
if(isPercentChart) {
item.dataLabels.formatter.identifier = "${PERCENT}";
item.dataLabels.formatter.percentFormat = format;
}
});
}
},
setFontStyle: function (fontStyle, config) {
if (config.dataSheet) {
config.dataSheet.style = fontStyle;
}
config.xAxis[0].title.style = fontStyle;
config.xAxis[0].labelStyle = fontStyle;
config.legend.style = fontStyle;
BI.each(config.yAxis, function (idx, axis) {
axis.labelStyle = fontStyle;
axis.title.style = fontStyle;
})
},
_formatItems: function (items) {
return items;
},
populate: function (items, options) {
},
resize: function () {
},
magnify: function () {
}
});
BI.AbstractChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.AbstractChart.EVENT_ITEM_CLICK = "EVENT_ITEM_CLICK";

277
src/addons/chart/chart/chart.accumulatearea.js

@ -0,0 +1,277 @@
/**
* 图表控件
* @class BI.AccumulateAreaChart
* @extends BI.Widget
*/
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 () {
BI.AccumulateAreaChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE
}];
this.yAxis = [];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
config.colors = this.config.chartColor;
config.style = formatChartStyle(this.config.chartStyle);
formatChartLineStyle(this.config.chartLineType);
formatCordon(this.config.cordon);
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var unit = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
unit = self.getXYAxisUnit(self.config.leftYAxisNumberLevel, self.config.leftYAxisUnit);
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + unit : unit;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter, self.config.numSeparators);
break;
case self.constants.RIGHT_AXIS:
unit = self.getXYAxisUnit(self.config.rightYAxisNumberLevel, self.config.rightYAxisUnit);
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + unit : unit;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter, self.config.rightNumSeparators);
break;
}
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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) {
switch (v) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
function formatChartLineStyle(v) {
switch (v) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false;
config.plotOptions.step = true;
break;
case BICst.CHART_SHAPE.CURVE:
config.plotOptions.curve = true;
config.plotOptions.step = false;
break;
case BICst.CHART_SHAPE.NORMAL:
default:
config.plotOptions.curve = false;
config.plotOptions.step = false;
break;
}
}
function formatCordon(cordon) {
BI.each(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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
},
_formatItems: function (items) {
return BI.map(items, function (idx, item) {
var i = BI.UUID();
return BI.map(item, function (id, it) {
return BI.extend({}, it, {stack: i});
});
});
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
chartLineType: options.chartLineType || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
this.yAxis = [];
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AREA);
});
types.push(type);
});
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.AccumulateAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_area_chart', BI.AccumulateAreaChart);

280
src/addons/chart/chart/chart.accumulateaxis.js

@ -0,0 +1,280 @@
/**
* 图表控件
* @class BI.AccumulateAxisChart
* @extends BI.Widget
*/
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 () {
BI.AccumulateAxisChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE
}];
this.yAxis = [];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
axis.title.text = getTitleText(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS, self.config.showLeftYAxisTitle, self.config.leftYAxisTitle);
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
axis.title.text = getTitleText(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS, self.config.showRightYAxisTitle, self.config.rightYAxisTitle);
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
}
});
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
config.xAxis[0].title.align = "center";
BI.extend(config.xAxis[0], {
lineWidth: self.config.lineWidth,
enableTick: self.config.enableTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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() {
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function formatChartStyle() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
function getTitleText(numberLevelType, position, show, title) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
unit = unit === "" ? unit : "(" + unit + ")";
return show === true ? title + unit : unit;
}
},
_formatItems: function (items) {
return BI.map(items, function (idx, item) {
var i = BI.UUID();
return BI.map(item, function (id, it) {
return BI.extend({}, it, {stack: i});
});
});
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
this.yAxis = [];
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AXIS);
});
types.push(type);
});
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.AccumulateAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_axis_chart', BI.AccumulateAxisChart);

246
src/addons/chart/chart/chart.accumulatebar.js

@ -0,0 +1,246 @@
/**
* 图表控件
* @class BI.AccumulateBarChart
* @extends BI.Widget
*/
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 () {
BI.AccumulateBarChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
},
gridLineWidth: 0
}];
this.yAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
gridLineWidth: 0,
position: "left"
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
var unit = getXYAxisUnit(this.config.xAxisNumberLevel, this.constants.LEFT_AXIS);
var xTitle = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.X_AXIS);
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
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 + unit : unit;
config.yAxis[0].title.rotation = this.constants.ROTATION;
BI.extend(config.yAxis[0], {
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
labelRotation: this.config.textDirection,
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
maxWidth: '40%'
});
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
config.xAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + xTitle : xTitle;
config.xAxis[0].title.align = "center";
BI.extend(config.xAxis[0], {
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators),
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
showLabel: this.config.showLabel,
enableTick: this.config.enableTick,
lineWidth: this.config.lineWidth,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.xAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
if (position === self.constants.X_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
}
if (position === self.constants.LEFT_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
}
if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function (items) {
BI.each(items, function (idx, item) {
var stackId = BI.UUID();
BI.each(item, function (id, it) {
it.stack = stackId;
BI.each(it.data, function (i, t) {
var tmp = t.x;
t.x = t.y;
t.y = tmp;
})
});
});
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
xAxisStyle: options.xAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
xAxisNumberLevel: options.xAxisNumberLevel || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
minimalist_model: options.minimalist_model || false,
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.BAR);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.AccumulateBarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_bar_chart', BI.AccumulateBarChart);

194
src/addons/chart/chart/chart.accumulateradar.js

@ -0,0 +1,194 @@
/**
* 图表控件
* @class BI.AccumulateRadarChart
* @extends BI.Widget
*/
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 () {
BI.AccumulateRadarChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.radiusAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
},
gridLineWidth: 0,
position: "bottom"
}];
this.angleAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatItems: function (items) {
return BI.map(items, function (idx, item) {
var i = BI.UUID();
return BI.map(item, function (id, it) {
return BI.extend({}, it, {stack: i});
});
});
},
_formatConfig: function (config, items) {
var self = this;
delete config.zoom;
var title = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartRadarStyle();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
config.radiusAxis = this.radiusAxis;
config.angleAxis = this.angleAxis;
config.radiusAxis[0].formatter = self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators);
formatNumberLevelInYaxis(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS, config.radiusAxis[0].formatter);
config.radiusAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + title : title;
config.radiusAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
config.chartType = "radar";
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
function formatChartRadarStyle() {
switch (self.config.chartRadarType) {
case BICst.CHART_SHAPE.POLYGON:
config.plotOptions.shape = "polygon";
break;
case BICst.CHART_SHAPE.CIRCLE:
config.plotOptions.shape = "circle";
break;
}
}
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) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartRadarType: options.chartRadarType || c.NORMAL,
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
cordon: options.cordon || [],
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.RADAR);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.AccumulateRadarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.accumulate_radar_chart', BI.AccumulateRadarChart);

302
src/addons/chart/chart/chart.area.js

@ -0,0 +1,302 @@
/**
* 图表控件
* @class BI.AreaChart
* @extends BI.Widget
*/
BI.AreaChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.AreaChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-area-chart"
})
},
_init: function () {
BI.AreaChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartLineStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var title = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
title = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators),
gridLineWidth: self.config.showGridLine === true ? 1 : 0
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
title = getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
}
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function formatChartLineStyle() {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false;
config.plotOptions.step = true;
break;
case BICst.CHART_SHAPE.CURVE:
config.plotOptions.curve = true;
config.plotOptions.step = false;
break;
case BICst.CHART_SHAPE.NORMAL:
default:
config.plotOptions.curve = false;
config.plotOptions.step = false;
break;
}
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
rightYAxisSecondTitle: options.rightYAxisSecondTitle || "",
chartLineType: options.chartLineType || c.NORMAL,
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
rightYAxisSecondStyle: options.rightYAxisSecondStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
showRightYAxisSecondTitle: options.showRightYAxisSecondTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
rightYAxisSecondReversed: options.rightYAxisSecondReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
rightYAxisSecondNumberLevel: options.rightYAxisSecondNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
rightYAxisSecondUnit: options.rightYAxisSecondUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AREA);
});
types.push(type);
});
this.yAxis = [];
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.AreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.area_chart', BI.AreaChart);

276
src/addons/chart/chart/chart.axis.js

@ -0,0 +1,276 @@
/**
* 图表控件 柱状
* @class BI.AxisChart
* @extends BI.Widget
* leftYxis 左值轴属性
* rightYxis 右值轴属性
* xAxis 分类轴属性
*/
BI.AxisChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.AxisChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-axis-chart"
})
},
_init: function () {
BI.AxisChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var title;
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
title = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
title = getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTIck: self.config.enableMinorTick,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators),
gridLineWidth: self.config.showGridLine === true ? 1 : 0
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
}
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
});
var lineItem = [];
var otherItem = [];
BI.each(items, function (idx, item) {
if (item.type === "line") {
lineItem.push(item);
} else {
otherItem.push(item);
}
});
//为了给数据标签加个%,还要遍历所有的系列,唉
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
}
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"
}
});
});
}
})
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
populate: function (items, options, types) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: true
};
this.options.items = items;
this.yAxis = [];
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.AxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.axis_chart', BI.AxisChart);

241
src/addons/chart/chart/chart.bar.js

@ -0,0 +1,241 @@
/**
* 图表控件
* @class BI.BarChart
* @extends BI.Widget
*/
BI.BarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.BarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bar-chart"
})
},
_init: function () {
BI.BarChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
},
gridLineWidth: 0
}];
this.yAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
gridLineWidth: 0,
position: "left"
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
var tmp = obj.x;
obj.x = obj.y;
obj.y = tmp;
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)
});
},
_formatConfig: function (config, items) {
var self = this;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
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;
BI.extend(config.yAxis[0], {
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
labelRotation: this.config.textDirection,
enableTick: this.config.enableTick,
lineWidth: this.config.lineWidth,
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";
BI.extend(config.xAxis[0], {
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators),
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
enableTick: this.config.enableTick,
showLabel: this.config.showLabel,
lineWidth: this.config.lineWidth,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.xAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
}
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"
}
});
});
}
})
}
function getXAxisTitle(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
if (position === self.constants.X_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
}
if (position === self.constants.LEFT_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
}
unit = unit === "" ? unit : "(" + unit + ")";
return self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + unit : unit;
}
},
_formatItems: function (items) {
BI.each(items, function (idx, item) {
BI.each(item, function (id, it) {
BI.each(it.data, function (i, t) {
var tmp = t.x;
t.x = t.y;
t.y = tmp;
})
});
});
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
xAxisStyle: options.xAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
xAxisNumberLevel: options.xAxisNumberLevel || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.BAR);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.BarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.bar_chart', BI.BarChart);

282
src/addons/chart/chart/chart.bubble.js

@ -0,0 +1,282 @@
/**
* 图表控件
* @class BI.BubbleChart
* @extends BI.Widget
*/
BI.BubbleChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.BubbleChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-bubble-chart"
})
},
_init: function () {
BI.BubbleChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.yAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "left",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
delete config.zoom;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.dataLabels.formatter.identifier = "${X}${Y}${SIZE}";
config.plotOptions.shadow = this.config.bubbleStyle !== this.constants.NO_PROJECT;
config.yAxis = this.yAxis;
config.yAxis[0].formatter = self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators);
formatNumberLevelInYaxis(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.yAxis[0].title.text = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
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].lineWidth = 1;
config.yAxis[0].title.rotation = this.constants.ROTATION;
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);
config.xAxis[0].title.text = getXYAxisUnit(this.config.xAxisNumberLevel, this.constants.X_AXIS);
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.chartType = "bubble";
if (BI.isNotEmptyArray(this.config.tooltip)) {
config.plotOptions.bubble.tooltip = {
useHtml: true,
style: {
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>'}
};
}
//为了给数据标签加个%,还要遍历所有的系列,唉
if (config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"style" : self.config.chartFont,
"align": "outside",
"autoAdjust": true,
enabled: true,
formatter: {
identifier: "${X}${Y}${SIZE}",
"XFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
},
"YFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
},
"sizeFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
}
}
};
item.dataLabels.formatter.XFormat = config.xAxis[0].formatter;
item.dataLabels.formatter.YFormat = config.yAxis[0].formatter;
});
}
//全局样式图表文字
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
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]}";
}
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function (items) {
BI.each(items, function (idx, item) {
BI.each(item, function (id, it) {
BI.each(it.data, function (i, da) {
var data = da.size;
da.size = BI.contentFormat(data, '#.##;-#.##')
})
})
});
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
xAxisStyle: options.xAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
xAxisNumberLevel: options.xAxisNumberLevel || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
cordon: options.cordon || [],
tooltip: options.tooltip || [],
bubbleStyle: options.bubbleStyle || c.NO_PROJECT,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.BUBBLE);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.BubbleChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.bubble_chart', BI.BubbleChart);

373
src/addons/chart/chart/chart.comparearea.js

@ -0,0 +1,373 @@
/**
* 图表控件
* @class BI.CompareAreaChart
* @extends BI.Widget
*/
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 () {
BI.CompareAreaChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartLineStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var title = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
title = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.rotation = self.constants.ROTATION;
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + title : title;
BI.extend(axis, {
reversed: false,
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
formatNumberLevelInYaxis(self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
title = getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.rotation = self.constants.ROTATION;
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + title : title;
BI.extend(axis, {
reversed: true,
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
formatNumberLevelInYaxis(self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
}
var res = _calculateValueNiceDomain(0, self.maxes[idx]);
axis.max = res[1].mul(2);
axis.min = res[0].mul(2);
axis.tickInterval = BI.parseFloat((BI.parseFloat(axis.max).sub(BI.parseFloat(axis.min)))).div(5);
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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) {
minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
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));
var err = m / span * step;
if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
return step;
}
function _linearNiceDomain(minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
return [minValue, maxValue];
}
function formatChartStyle() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function formatChartLineStyle() {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.area = {
curve: false,
step: true
};
break;
case BICst.CHART_SHAPE.CURVE:
config.plotOptions.area = {
curve: true,
step: false
};
break;
case BICst.CHART_SHAPE.NORMAL:
default:
config.plotOptions.area = {
curve: false,
step: false
};
break;
}
}
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))) {
max = da.y;
}
}
});
if (position === item.yAxis) {
item.tooltip = BI.deepClone(config.plotOptions.tooltip);
item.tooltip.formatter.valueFormat = formatter;
}
if (BI.isNotNull(max)) {
self.maxes.push(max);
}
});
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function (items) {
var self = this;
this.maxes = [];
BI.each(items, function (idx, item) {
BI.each(item, function (id, it) {
if (idx > 0) {
BI.extend(it, {reversed: true, xAxis: 0});
} else {
BI.extend(it, {reversed: false, xAxis: 1});
}
});
});
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
chartLineType: options.chartLineType || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AREA);
});
types.push(type);
});
this.yAxis = [];
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.CompareAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.compare_area_chart', BI.CompareAreaChart);

381
src/addons/chart/chart/chart.compareaxis.js

@ -0,0 +1,381 @@
/**
* 图表控件
* @class BI.CompareAxisChart
* @extends BI.Widget
*/
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 () {
BI.CompareAxisChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}, {
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "top",
gridLineWidth: 0,
type: "category",
showLabel: false
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function(config, items){
var self = this, o = this.options;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartLineStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
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){
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
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;
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + unit : unit;
BI.extend(axis, {
reversed: false,
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
formatNumberLevelInYaxis(self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
unit = getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.rotation = self.constants.ROTATION;
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + unit : unit;
BI.extend(axis, {
reversed: true,
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
formatNumberLevelInYaxis(self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
}
var res = _calculateValueNiceDomain(0, self.maxes[idx]);
axis.max = res[1].mul(2);
axis.min = res[0].mul(2);
axis.tickInterval = BI.parseFloat((BI.parseFloat(axis.max).sub(BI.parseFloat(axis.min)))).div(5);
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
});
BI.extend(config.xAxis[1], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
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(){
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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){
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if(idx > 0 && self.yAxis.length >= idx){
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function formatChartLineStyle(){
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false;
config.plotOptions.step = true;
break;
case BICst.CHART_SHAPE.CURVE:
config.plotOptions.curve = true;
config.plotOptions.step = false;
break;
case BICst.CHART_SHAPE.NORMAL:
default:
config.plotOptions.curve = false;
config.plotOptions.step = false;
break;
}
}
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))){
max = da.y;
}
}
});
if(position === item.yAxis){
item.tooltip = BI.deepClone(config.plotOptions.tooltip);
item.tooltip.formatter.valueFormat = formatter;
}
if(BI.isNotNull(max)){
self.maxes.push(max);
}
});
}
function getXYAxisUnit(numberLevelType, position){
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS){
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
function _calculateValueNiceDomain(minValue, maxValue){
minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
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));
var err = m / span * step;
if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
return step;
}
function _linearNiceDomain(minValue, maxValue, tickInterval){
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
return [minValue, maxValue];
}
},
_formatItems: function(items){
var self = this;
this.maxes = [];
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});
}
});
});
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
chartLineType: options.chartLineType || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
this.yAxis = [];
var types = [];
BI.each(items, function(idx, axisItems){
var type = [];
BI.each(axisItems, function(id, item){
type.push(BICst.WIDGET.AXIS);
});
types.push(type);
});
BI.each(types, function(idx, type){
if(BI.isEmptyArray(type)){
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0,
reversed: idx > 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function(){
this.combineChart.magnify();
}
});
BI.CompareAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.compare_axis_chart', BI.CompareAxisChart);

253
src/addons/chart/chart/chart.comparebar.js

@ -0,0 +1,253 @@
/**
* 图表控件
* @class BI.CompareBarChart
* @extends BI.Widget
*/
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 () {
BI.CompareBarChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this;
},
gridLineWidth: 0
}];
this.yAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
gridLineWidth: 0,
position: "left"
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
var yTitle = getXYAxisUnit(this.config.xAxisNumberLevel, this.constants.LEFT_AXIS);
var xTitle = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.X_AXIS);
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
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 + yTitle : yTitle;
config.yAxis[0].title.rotation = this.constants.ROTATION;
BI.extend(config.yAxis[0], {
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
maxWidth: '40%'
});
self.formatNumberLevelInXaxis(items, this.config.leftYAxisNumberLevel);
config.xAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + xTitle : xTitle;
config.xAxis[0].title.align = "center";
BI.extend(config.xAxis[0], {
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators, true),
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
lineWidth: this.config.lineWidth,
showLabel: this.config.showLabel,
enableTick: this.config.enableTick,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.xAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
if (position === self.constants.X_AXIS) {
self.config.leftYAxisUnit !== "" && (unit = unit + self.config.leftYAxisUnit)
}
if (position === self.constants.LEFT_AXIS) {
self.config.xAxisUnit !== "" && (unit = unit + self.config.xAxisUnit)
}
if (position === self.constants.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function (items) {
var result = [];
var i = BI.UUID();
BI.each(items, function (idx, item) {
BI.each(item, function (id, it) {
BI.each(it.data, function (i, t) {
var tmp = t.x;
t.x = t.y;
t.y = tmp;
if (idx === 0) {
t.x = -t.x;
}
});
it.stack = i;
})
});
BI.each(items, function (idx, item) {
result = BI.concat(result, item);
});
return [result];
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
xAxisStyle: options.xAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
xAxisNumberLevel: options.xAxisNumberLevel || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = this._formatItems(items);
var types = [];
BI.each(this.options.items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.BAR);
});
types.push(type);
});
this.combineChart.populate(this.options.items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.CompareBarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.compare_bar_chart', BI.CompareBarChart);

398
src/addons/chart/chart/chart.dashboard.js

@ -0,0 +1,398 @@
/**
* 图表控件
* @class BI.DashboardChart
* @extends BI.Widget
*/
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)",
labelStyle: this.constants.FONT_STYLE,
"step": 0,
"showLabel": true
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
var isDashboard = BI.contains([self.constants.NORMAL, self.constants.HALF_DASHBOARD], self.config.chartDashboardType);
var isMultiPointers = self.config.numberOfPointer === self.constants.MULTI_POINTER;
formatChartDashboardStyle();
config.chartType = "gauge";
delete config.zoom;
delete config.xAxis;
delete config.yAxis;
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.gaugeAxis[0].labelStyle = this.config.chartFont;
return [items, config];
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
});
config.gaugeAxis = self.gaugeAxis;
var slotValueLAbel = {
enabled: true,
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%")
} 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, "#,###.##;-#,###.##")
} 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>';
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 label
} else if (isDashboard && BI.isNull(items[0].data[0].z)) {
return label
}
return '<div style="text-align: center">' + this.category + '</div>' + label;
},
style: self.config.chartFont,
useHtml: true
};
switch (self.config.chartDashboardType) {
case BICst.CHART_SHAPE.HALF_DASHBOARD:
setPlotOptions("pointer_semi", bands, slotValueLAbel, percentageLabel);
break;
case BICst.CHART_SHAPE.PERCENT_DASHBOARD:
setPlotOptions("ring", bands, slotValueLAbel, percentageLabel);
break;
case BICst.CHART_SHAPE.PERCENT_SCALE_SLOT:
setPlotOptions("slot", bands, slotValueLAbel, percentageLabel);
break;
case BICst.CHART_SHAPE.HORIZONTAL_TUBE:
BI.extend(slotValueLAbel, {
align: "bottom"
});
BI.extend(percentageLabel, {
align: "bottom"
});
setPlotOptions("thermometer", bands, slotValueLAbel, percentageLabel, "horizontal", "vertical");
break;
case BICst.CHART_SHAPE.VERTICAL_TUBE:
BI.extend(slotValueLAbel, {
align: "left"
});
BI.extend(percentageLabel, {
align: "left"
});
setPlotOptions("thermometer", bands, slotValueLAbel, percentageLabel, "vertical", "horizontal");
break;
case BICst.CHART_SHAPE.NORMAL:
default:
setPlotOptions("pointer", bands, slotValueLAbel, percentageLabel);
break;
}
changeMaxMinScale();
formatNumberLevelInYaxis(self.config.dashboardNumberLevel, self.constants.LEFT_AXIS);
if (self.config.dashboardNumberLevel === BICst.TARGET_STYLE.NUM_LEVEL.PERCENT) {
config.gaugeAxis[0].formatter = function () {
var scaleValue = this;
if (self.config.numSeparators) {
scaleValue = BI.contentFormat(scaleValue, '#,##0%;-#,##0%')
} else {
scaleValue = BI.contentFormat(scaleValue, '#0.00%')
}
return scaleValue + getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS);
};
} else {
config.gaugeAxis[0].formatter = function () {
var value = this;
if (self.config.numSeparators) {
value = BI.contentFormat(value, "#,###;-#,###")
}
return value + getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS);
};
}
}
function setPlotOptions(style, bands, slotValueLAbel, percentageLabel, thermometerLayout, layout) {
config.style = style;
config.plotOptions.bands = bands;
config.plotOptions.valueLabel = slotValueLAbel;
config.plotOptions.percentageLabel = percentageLabel;
config.plotOptions.thermometerLayout = thermometerLayout;
config.plotOptions.layout = layout;
}
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) {
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)
};
if (self.config.numSeparators) {
config.plotOptions.tooltip.formatter.valueFormat = function () {
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%')
};
if (self.config.numSeparators) {
config.plotOptions.tooltip.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], '#,##0%;-#,##0%')
};
}
}
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
if (position === self.constants.DASHBOARD_AXIS) {
self.config.dashboardUnit !== "" && (unit = unit + self.config.dashboardUnit)
}
return unit;
}
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
}
});
switch (change) {
case BICst.SCALE_SETTING.AUTO:
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
});
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
});
return bands;
}
}
}
function _calculateValueNiceDomain(minValue, maxValue) {
minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
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));
var err = m / span * step;
if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
return step;
}
function _linearNiceDomain(minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
return [minValue, maxValue];
}
},
_formatItems: function (items) {
if (items.length === 0) {
return [];
}
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) {//单个系列
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) {
BI.each(items[0], function (idx, item) {
result.push({
data: [BI.extend(item.data[0], {
x: item.name
})],
name: BI.UUID()
})
});
return [result]
}
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,
name: ""
}]];
}
} else {
var others = [];
if (BI.isNotNull(items[0][0].data[0].z)) {
BI.each(items[0], function (idx, item) {
BI.each(item.data, function (id, da) {
others.push({
data: [BI.extend({}, da, {
x: item.name,
y: da.y
})],
name: da.x
})
})
});
return [others];
}
}
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants, o = this.options;
this.config = {
dashboardNumberLevel: options.dashboardNumberLevel || c.NORMAL,
dashboardUnit: options.dashboardUnit || "",
chartDashboardType: options.chartDashboardType || c.NORMAL,
numberOfPointer: options.numberOfPointer || c.ONE_POINTER,
bandsStyles: options.bandsStyles || [],
autoCustomStyle: options.autoCustom || c.AUTO,
minScale: options.minScale,
maxScale: options.maxScale,
showPercentage: options.showPercentage || c.NOT_SHOW,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
o.items = this._formatItems(items);
var types = [];
BI.each(o.items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.DASHBOARD);
});
types.push(type);
});
this.combineChart.populate(o.items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.DashboardChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.dashboard_chart', BI.DashboardChart);

103
src/addons/chart/chart/chart.donut.js

@ -0,0 +1,103 @@
/**
* 图表控件
* @class BI.DonutChart
* @extends BI.Widget
*/
BI.DonutChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.DonutChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-donut-chart"
})
},
_init: function () {
BI.DonutChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function(config, items){
var self = this;
delete config.zoom;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.innerRadius = "50.0%";
config.chartType = "pie";
config.plotOptions.dataLabels.align = "outside";
config.plotOptions.dataLabels.connectorWidth = "outside";
config.plotOptions.dataLabels.style = this.config.chartFont;
config.plotOptions.dataLabels.formatter.identifier = "${VALUE}${PERCENT}";
delete config.xAxis;
delete config.yAxis;
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(){
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function(idx, axisItems){
var type = [];
BI.each(axisItems, function(id, item){
type.push(BICst.WIDGET.DONUT);
});
types.push(type);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function(){
this.combineChart.magnify();
}
});
BI.DonutChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.donut_chart', BI.DonutChart);

310
src/addons/chart/chart/chart.fallaxis.js

@ -0,0 +1,310 @@
/**
* 图表控件
* @class BI.FallAxisChart
* @extends BI.Widget
*/
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 () {
BI.FallAxisChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.yAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "left",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_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;
config.style = formatChartStyle();
formatCordon();
config.legend.enabled = false;
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.dataSheet.enabled = this.config.showDataTable;
if(config.dataSheet.enabled === true){
config.xAxis[0].showLabel = false;
}
config.zoom.zoomTool.enabled = this.config.showZoom;
if(this.config.showZoom === true){
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.extend(config.yAxis[0], {
lineWidth: this.config.lineWidth,
showLabel: this.config.showLabel,
enableTick: this.config.enableTick,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators)
});
formatNumberLevelInYaxis(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS, config.yAxis[0].formatter);
config.yAxis[0].title.rotation = this.constants.ROTATION;
config.yAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + yTitle : yTitle;
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
enableMinorTick: this.config.enableMinorTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
});
//为了给数据标签加个%,还要遍历所有的系列,唉
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,
enabled: true,
formatter: {
identifier: "${VALUE}",
valueFormat: config.yAxis[0].formatter
}
};
});
}
//全局样式的图表文字
this.setFontStyle(this.config.chartFont, config);
return [items, config];
function formatChartStyle(){
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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){
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if(idx > 0 && self.yAxis.length >= idx){
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
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){
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS){
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function(items){
var o = this.options;
if(BI.isEmptyArray(items)){
return [];
}
items = items[0];
var tables = [], sum = 0;
var colors = this.config.chartColor || [];
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){
tables.push([t.x, t.y, sum + t.y, t]);
}else{
tables.push([t.x, t.y, sum, t]);
}
sum += t.y;
});
});
return [BI.map(BI.makeArray(2, null), function(idx, item){
return {
"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){
axis.color = cell[2 - idx] < 0 ? colors[1] : colors[0];
}else{
axis.color = "rgba(0,0,0,0)";
axis.borderColor = "rgba(0,0,0,0)";
axis.borderWidth = 0;
axis.clickColor = "rgba(0,0,0,0)";
axis.mouseOverColor = "rgba(0,0,0,0)";
axis.tooltip = {
enable: false
}
}
return axis;
}),
stack: "stackedFall",
name: idx === 1 ? items[0].name : BI.UUID()
};
})];
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || ["#5caae4", "#70cc7f", "#ebbb67", "#e97e7b", "#6ed3c9"],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function(idx, axisItems){
var type = [];
BI.each(axisItems, function(id, item){
type.push(BICst.WIDGET.AXIS);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function(){
this.combineChart.magnify();
}
});
BI.FallAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.fall_axis_chart', BI.FallAxisChart);

87
src/addons/chart/chart/chart.forcebubble.js

@ -0,0 +1,87 @@
/**
* 图表控件
* @class BI.ForceBubbleChart
* @extends BI.Widget
*/
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 () {
BI.ForceBubbleChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
config.chartType = 'forceBubble';
config.colors = this.config.chartColor;
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.force = true;
config.plotOptions.shadow = this.config.bubbleStyle !== this.constants.NO_PROJECT;
config.plotOptions.dataLabels.enabled = true;
config.plotOptions.dataLabels.align = "inside";
config.plotOptions.dataLabels.style = this.config.chartFont;
config.plotOptions.dataLabels.formatter.identifier = "${CATEGORY}${VALUE}";
delete config.xAxis;
delete config.yAxis;
delete config.zoom;
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];
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartColor: options.chartColor || [],
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
bubbleStyle: options.bubbleStyle || c.NO_PROJECT,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.FORCE_BUBBLE);
});
types.push(type);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.ForceBubbleChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.force_bubble_chart', BI.ForceBubbleChart);

160
src/addons/chart/chart/chart.gismap.js

@ -0,0 +1,160 @@
/**
* 图表控件
* @class BI.GISMapChart
* @extends BI.Widget
*/
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 () {
BI.GISMapChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
delete config.dataSheet;
delete config.legend;
delete config.zoom;
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
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 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>';
return a;
};
config.plotOptions.tooltip.shared = true;
config.plotOptions.tooltip.formatter = function () {
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>');
});
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>"
};
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
} else {
config.geo.tileLayer = this.config.backgroundLayerInfo.url;
}
}
config.chartType = "pointMap";
config.plotOptions.icon = {
iconUrl: BICst.GIS_ICON_PATH,
iconSize: [24, 24]
};
config.plotOptions.marker = {
symbol: BICst.GIS_ICON_PATH,
width: 24,
height: 24,
enable: true
};
delete config.xAxis;
delete config.yAxis;
return [items, config];
},
_checkLngLatValid: function (lnglat) {
if (lnglat.length < 2) {
return false;
}
return lnglat[0] <= 180 && lnglat[0] >= -180 && lnglat[1] <= 90 && lnglat[1] >= -90;
},
_formatItems: function (items) {
var self = this;
var results = [];
BI.each(items, function (idx, item) {
var result = [];
BI.each(item, function (id, it) {
var res = [];
BI.each(it.data, function (i, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1);
var lnglat = da.x.split(",");
if (self.config.lnglat === self.constants.LAT_FIRST) {
var lng = lnglat[1];
lnglat[1] = lnglat[0];
lnglat[0] = lng;
}
da.lnglat = lnglat;
da.value = da.y;
da.name = BI.isNotNull(da.z) ? da.z : da.lnglat;
if (self._checkLngLatValid(da.lnglat)) {
res.push(da);
}
});
if (BI.isNotEmptyArray(res)) {
result.push(BI.extend(it, {
data: res
}));
}
});
if (BI.isNotEmptyArray(result)) {
results.push(result);
}
});
return results;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
lnglat: options.lnglat || c.LNG_FIRST,
chartFont: options.chartFont || c.FONT_STYLE,
showBackgroundLayer: options.showBackgroundLayer || false,
backgroundLayerInfo: options.backgroundLayerInfo
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function () {
type.push(BICst.WIDGET.GIS_MAP);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.GISMapChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.gis_map_chart', BI.GISMapChart);

297
src/addons/chart/chart/chart.line.js

@ -0,0 +1,297 @@
/**
* 图表控件
* @class BI.LineChart
* @extends BI.Widget
*/
BI.LineChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.LineChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-line-chart"
})
},
_init: function () {
BI.LineChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartLineStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var title = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
axis.title.rotation = self.constants.ROTATION;
title = getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + title : title;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
title = getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
}
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function formatChartLineStyle() {
switch (self.config.chartLineType) {
case BICst.CHART_SHAPE.RIGHT_ANGLE:
config.plotOptions.curve = false;
config.plotOptions.step = true;
break;
case BICst.CHART_SHAPE.CURVE:
config.plotOptions.curve = true;
config.plotOptions.step = false;
break;
case BICst.CHART_SHAPE.NORMAL:
default:
config.plotOptions.curve = false;
config.plotOptions.step = false;
break;
}
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
chartLineType: options.chartLineType || c.NORMAL,
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.LINE);
});
types.push(type);
});
this.yAxis = [];
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.LineChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.line_chart', BI.LineChart);

361
src/addons/chart/chart/chart.map.js

@ -0,0 +1,361 @@
/**
* 图表控件
* @class BI.MapChart
* @extends BI.Widget
*/
BI.MapChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.MapChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-map-chart"
})
},
_init: function () {
BI.MapChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, c = this.constants;
formatRangeLegend();
delete config.legend;
delete config.zoom;
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.tooltip.shared = true;
var formatterArray = [];
BI.each(items, function (idx, item) {
if (BI.has(item, "settings")) {
formatterArray.push(formatToolTipAndDataLabel(item.settings.format || c.NORMAL, item.settings.num_level || c.NORMAL,
item.settings.unit || "", item.settings.numSeparators || c.NUM_SEPARATORS));
}
});
config.plotOptions.tooltip.formatter = function () {
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>');
return tip;
};
config.plotOptions.dataLabels.formatter.valueFormat = function () {
return BI.contentFormat(arguments[0], formatterArray[0]);
};
config.plotOptions.dataLabels.style = this.config.chartFont;
config.plotOptions.bubble.dataLabels = config.plotOptions.dataLabels;
config.plotOptions.bubble.dataLabels.formatter.identifier = "${SIZE}";
config.plotOptions.bubble.tooltip = config.plotOptions.tooltip;
config.geo = this.config.geo;
if (this.config.showBackgroundLayer === true && BI.isNotNull(this.config.backgroundLayerInfo)) {
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
} else {
config.geo.tileLayer = this.config.backgroundLayerInfo.url;
}
}
if (this.config.initDrillPath.length > 1) {
config.initDrillPath = this.config.initDrillPath;
}
config.dTools.enabled = true;
config.dTools.click = function (point) {
point = point || {};
var pointOption = point.options || {};
self.fireEvent(BI.MapChart.EVENT_CLICK_DTOOL, pointOption);
};
config.chartType = "areaMap";
delete config.xAxis;
delete config.yAxis;
var find = BI.find(items, function (idx, item) {
return BI.has(item, "type") && item.type === "areaMap";
});
if (BI.isNull(find)) {
items.push({
type: "areaMap",
data: []
})
}
return [items, config];
function formatRangeLegend() {
config.rangeLegend.enabled = true;
switch (self.config.chartLegend) {
case BICst.CHART_LEGENDS.BOTTOM:
config.rangeLegend.visible = true;
config.rangeLegend.position = "bottom";
break;
case BICst.CHART_LEGENDS.RIGHT:
config.rangeLegend.visible = true;
config.rangeLegend.position = "right";
break;
case BICst.CHART_LEGENDS.NOT_SHOW:
config.rangeLegend.visible = false;
break;
}
config.rangeLegend.continuous = false;
config.rangeLegend.range = getRangeStyle(self.config.mapStyles, self.config.autoCustom, self.config.themeColor);
config.rangeLegend.formatter = function () {
var to = this.to;
if (BI.isNotEmptyArray(items) && BI.has(items[0], "settings")) {
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)
}
return to
};
}
function formatToolTipAndDataLabel(format, numberLevel, unit, numSeparators) {
var formatter = '#.##';
switch (format) {
case self.constants.NORMAL:
formatter = '#.##';
if (numSeparators) formatter = '#,###.##';
break;
case self.constants.ZERO2POINT:
formatter = '#0';
if (numSeparators) formatter = '#,###';
break;
case self.constants.ONE2POINT:
formatter = '#0.0';
if (numSeparators) formatter = '#,###.0';
break;
case self.constants.TWO2POINT:
formatter = '#0.00';
if (numSeparators) formatter = '#,###.00';
break;
}
switch (numberLevel) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
formatter += '';
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
formatter += BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
formatter += BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
formatter += BI.i18nText("BI-Yi");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.PERCENT:
formatter += '%';
break;
}
return formatter + unit;
}
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
}
})
});
switch (change) {
case BICst.SCALE_SETTING.AUTO:
defaultStyle.color = defaultColor;
return defaultStyle;
case BICst.SCALE_SETTING.CUSTOM:
if (styles.length !== 0) {
var maxScale = _calculateValueNiceDomain(0, self.max)[1];
BI.each(styles, function (idx, style) {
if (style.range.max) {
range.push({
color: style.color || "rgba(255,255,255,0)",
from: style.range.min,
to: style.range.max
});
} else {
var to = style.range.min < maxScale ? maxScale : 266396;
range.push({
color: style.color || "rgba(255,255,255,0)",
from: style.range.min,
to: to,
});
}
color = style.color;
conditionMax = style.range.max
});
conditionMin = BI.parseFloat(styles[0].range.min);
if (conditionMin !== 0) {
range.push({
color: "#808080",
from: 0,
to: conditionMin
});
}
if (conditionMax && conditionMax < maxScale) {
range.push({
color: color || "rgba(255,255,255,0)",
from: conditionMax,
to: maxScale
});
}
return range;
} else {
defaultStyle.color = defaultColor;
return defaultStyle;
}
}
}
function _calculateValueNiceDomain(minValue, maxValue) {
minValue = Math.min(0, minValue);
var tickInterval = _linearTickInterval(minValue, maxValue);
return _linearNiceDomain(minValue, maxValue, tickInterval);
}
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));
var err = m / span * step;
if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
return step;
}
function _linearNiceDomain(minValue, maxValue, tickInterval) {
minValue = VanUtils.accMul(Math.floor(minValue / tickInterval), tickInterval);
maxValue = VanUtils.accMul(Math.ceil(maxValue / tickInterval), tickInterval);
return [minValue, maxValue];
}
},
_formatDrillItems: function (items) {
var self = this;
BI.each(items.series, function (idx, da) {
var hasArea = false;
BI.each(da.data, function (idx, data) {
data.y = self.formatXYDataWithMagnify(data.y, 1);
if (BI.has(da, "settings")) {
data.y = self.formatXYDataWithMagnify(data.y, self.calcMagnify(da.settings.num_level || self.constants.NORMAL));
}
if (BI.has(da, "type") && da.type == "bubble") {
data.name = data.x;
data.size = data.y;
} else {
data.name = data.x;
data.value = data.y;
}
if (BI.has(da, "type") && da.type === "areaMap") {
hasArea = true;
}
if (BI.has(data, "drilldown")) {
self._formatDrillItems(data.drilldown);
}
});
if (hasArea === false) {
items.series.push({
type: "areaMap",
data: []
});
}
});
},
_formatItems: function (items) {
var self = this;
this.max = null;
this.min = null;
BI.each(items, function (idx, item) {
BI.each(item, function (id, it) {
BI.each(it.data, function (i, da) {
da.y = self.formatXYDataWithMagnify(da.y, 1);
if (BI.has(it, "settings")) {
da.y = self.formatXYDataWithMagnify(da.y, self.calcMagnify(it.settings.num_level || self.constants.NORMAL));
}
if ((BI.isNull(self.max) || BI.parseFloat(da.y) > BI.parseFloat(self.max)) && id === 0) {
self.max = da.y;
}
if ((BI.isNull(self.min) || BI.parseFloat(da.y) < BI.parseFloat(self.min)) && id === 0) {
self.min = da.y;
}
if (BI.has(it, "type") && it.type == "bubble") {
da.name = da.x;
da.size = da.y;
} else {
da.name = da.x;
da.value = da.y;
}
if (BI.has(da, "drilldown")) {
self._formatDrillItems(da.drilldown);
}
});
})
});
return items;
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
geo: options.geo,
initDrillPath: options.initDrillPath || [],
tooltip: options.tooltip || "",
themeColor: options.themeColor || "#65bce7",
mapStyles: options.mapStyles || [],
autoCustom: options.autoCustom || c.AUTO_CUSTOM,
showBackgroundLayer: options.showBackgroundLayer || false,
backgroundLayerInfo: options.backgroundLayerInfo,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.MAP);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.MapChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.MapChart.EVENT_CLICK_DTOOL = "EVENT_CLICK_DTOOL";
BI.shortcut('bi.map_chart', BI.MapChart);

322
src/addons/chart/chart/chart.multiaxis.js

@ -0,0 +1,322 @@
/**
* 图表控件
* @class BI.MultiAxisChart
* @extends BI.Widget
* leftYxis 左值轴属性
* rightYxis 右值轴属性
* xAxis 分类轴属性
*/
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 () {
BI.MultiAxisChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
},
position: "bottom",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
config.colors = this.config.chartColor;
config.style = this.formatChartStyle();
this.formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var title = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
title = self.getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
title = self.getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS_SECOND:
title = self.getXYAxisUnit(self.config.rightYAxisSecondNumberLevel, self.constants.RIGHT_AXIS_SECOND);
axis.title.text = self.config.showRightYAxisSecondTitle === true ? self.config.rightYAxisSecondTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisSecondReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisSecondStyle, self.config.rightYAxisSecondNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisSecondNumberLevel, idx, axis.formatter);
break;
default:
break;
}
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
});
//为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
if (config.dataSheet) {
config.dataSheet.style = this.config.chartFont;
}
config.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont;
config.legend.style = this.config.chartFont;
config.plotOptions.dataLabels.style = this.config.chartFont;
BI.each(config.yAxis, function (idx, axis) {
axis.title.style = self.config.chartFont;
});
return [items, config];
},
formatChartStyle: function () {
switch (this.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
},
formatCordon: function () {
var self = this;
var magnify = 1;
BI.each(this.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) {
magnify = self.calcMagnify(self.config.xAxisNumberLevel);
self.xAxis[0].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
},
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
default:
break;
}
self.yAxis[idx - 1].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
},
"text": t.text,
"align": "left"
}
});
});
}
})
},
getXYAxisUnit: function (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
default:
break;
}
if (position === this.constants.X_AXIS) {
this.config.xAxisUnit !== "" && (unit = unit + this.config.xAxisUnit)
}
if (position === this.constants.LEFT_AXIS) {
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit)
}
if (position === this.constants.RIGHT_AXIS) {
this.config.rightYAxisUnit !== "" && (unit = unit + this.config.rightYAxisUnit)
}
if (position === this.constants.RIGHT_AXIS_SECOND) {
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit)
}
return unit === "" ? unit : "(" + unit + ")";
},
populate: function (items, options, types) {
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
rightYAxisSecondTitle: options.rightYAxisSecondTitle || "",
chartColor: options.chartColor || ["#5caae4", "#70cc7f", "#ebbb67", "#e97e7b", "#6ed3c9"],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
rightYAxisSecondStyle: options.rightYAxisSecondStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
showRightYAxisSecondTitle: options.showRightYAxisSecondTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
rightYAxisSecondReversed: options.rightYAxisSecondReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
rightYAxisSecondNumberLevel: options.rightYAxisSecondNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
rightYAxisSecondUnit: options.rightYAxisSecondUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
this.yAxis = [];
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
},
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.MultiAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.multi_axis_chart', BI.MultiAxisChart);

324
src/addons/chart/chart/chart.multiaxiscombine.js

@ -0,0 +1,324 @@
/**
* 图表控件
* @class BI.MultiAxisChart
* @extends BI.Widget
* leftYxis 左值轴属性
* rightYxis 右值轴属性
* xAxis 分类轴属性
*/
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 () {
BI.MultiAxisCombineChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
},
position: "bottom",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this, o = this.options;
config.colors = this.config.chartColor;
config.style = this.formatChartStyle();
this.formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
BI.each(config.yAxis, function (idx, axis) {
var title = "";
switch (axis.axisIndex) {
case self.constants.LEFT_AXIS:
title = self.getXYAxisUnit(self.config.leftYAxisNumberLevel, self.constants.LEFT_AXIS);
axis.title.text = self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
axis.labelStyle.color = axis.lineColor = axis.tickColor = config.colors[0];
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.leftYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.leftYAxisStyle, self.config.leftYAxisNumberLevel, self.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.leftYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS:
title = self.getXYAxisUnit(self.config.rightYAxisNumberLevel, self.constants.RIGHT_AXIS);
axis.title.text = self.config.showRightYAxisTitle === true ? self.config.rightYAxisTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
axis.labelStyle.color = axis.lineColor = axis.tickColor = config.colors[1];
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisStyle, self.config.rightYAxisNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisNumberLevel, idx, axis.formatter);
break;
case self.constants.RIGHT_AXIS_SECOND:
title = self.getXYAxisUnit(self.config.rightYAxisSecondNumberLevel, self.constants.RIGHT_AXIS_SECOND);
axis.title.text = self.config.showRightYAxisSecondTitle === true ? self.config.rightYAxisSecondTitle + title : title;
axis.title.rotation = self.constants.ROTATION;
axis.labelStyle.color = axis.lineColor = axis.tickColor = config.colors[2];
BI.extend(axis, {
lineWidth: self.config.lineWidth,
showLabel: self.config.showLabel,
enableTick: self.config.enableTick,
reversed: self.config.rightYAxisSecondReversed,
enableMinorTick: self.config.enableMinorTick,
gridLineWidth: self.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(self.config.rightYAxisSecondStyle, self.config.rightYAxisSecondNumberLevel, self.config.rightNumSeparators)
});
self.formatNumberLevelInYaxis(config, items, self.config.rightYAxisSecondNumberLevel, idx, axis.formatter);
break;
default:
break;
}
});
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
maxHeight: '40%'
});
//为了给数据标签加个%,还要遍历所有的系列,唉
this.formatDataLabel(config.plotOptions.dataLabels.enabled, items, config, this.config.chartFont);
//全局样式的图表文字
if (config.dataSheet) {
config.dataSheet.style = this.config.chartFont;
}
config.xAxis[0].title.style = config.xAxis[0].labelStyle = this.config.chartFont;
config.legend.style = this.config.chartFont;
config.plotOptions.dataLabels.style = this.config.chartFont;
BI.each(config.yAxis, function (idx, axis) {
axis.title.style = self.config.chartFont;
});
return [items, config];
},
formatChartStyle: function () {
switch (this.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
},
formatCordon: function () {
var self = this;
var magnify = 1;
BI.each(this.config.cordon, function (idx, cor) {
if (idx === 0 && self.xAxis.length > 0) {
magnify = self.calcMagnify(self.config.xAxisNumberLevel);
self.xAxis[0].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
},
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
default:
break;
}
self.yAxis[idx - 1].plotLines = BI.map(cor, function (i, t) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": {
"fontFamily": "inherit",
"color": "#808080",
"fontSize": "12px",
"fontWeight": ""
},
"text": t.text,
"align": "left"
}
});
});
}
})
},
getXYAxisUnit: function (numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
default:
break;
}
if (position === this.constants.X_AXIS) {
this.config.xAxisUnit !== "" && (unit = unit + this.config.xAxisUnit)
}
if (position === this.constants.LEFT_AXIS) {
this.config.leftYAxisUnit !== "" && (unit = unit + this.config.leftYAxisUnit)
}
if (position === this.constants.RIGHT_AXIS) {
this.config.rightYAxisUnit !== "" && (unit = unit + this.config.rightYAxisUnit)
}
if (position === this.constants.RIGHT_AXIS_SECOND) {
this.config.rightYAxisSecondUnit !== "" && (unit = unit + this.config.rightYAxisSecondUnit)
}
return unit === "" ? unit : "(" + unit + ")";
},
populate: function (items, options, types) {
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
rightYAxisTitle: options.rightYAxisTitle || "",
rightYAxisSecondTitle: options.rightYAxisSecondTitle || "",
chartColor: options.chartColor || ["#5caae4", "#70cc7f", "#ebbb67", "#e97e7b", "#6ed3c9"],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
rightYAxisStyle: options.rightYAxisStyle || c.NORMAL,
rightYAxisSecondStyle: options.rightYAxisSecondStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
showRightYAxisTitle: options.showRightYAxisTitle || false,
showRightYAxisSecondTitle: options.showRightYAxisSecondTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
rightYAxisReversed: options.rightYAxisReversed || false,
rightYAxisSecondReversed: options.rightYAxisSecondReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
rightYAxisNumberLevel: options.rightYAxisNumberLevel || c.NORMAL,
rightYAxisSecondNumberLevel: options.rightYAxisSecondNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
rightYAxisUnit: options.rightYAxisUnit || "",
rightYAxisSecondUnit: options.rightYAxisSecondUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
this.yAxis = [];
BI.each(types, function (idx, type) {
if (BI.isEmptyArray(type)) {
return;
}
var newYAxis = {
type: "value",
title: {
style: {"fontFamily": "inherit", "color": "#808080", "fontSize": "12px", "fontWeight": ""}
},
labelStyle: {
"fontFamily": "inherit", "color": "#808080", "fontSize": "12px"
},
position: idx > 0 ? "right" : "left",
lineWidth: 1,
axisIndex: idx,
gridLineWidth: 0
};
self.yAxis.push(newYAxis);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.MultiAxisCombineChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.multi_axis_combine_chart', BI.MultiAxisCombineChart);

245
src/addons/chart/chart/chart.percentaccumulatearea.js

@ -0,0 +1,245 @@
/**
* 图表控件
* @class BI.PercentAccumulateAreaChart
* @extends BI.Widget
*/
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 () {
BI.PercentAccumulateAreaChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.yAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "left",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
config.yAxis[0].title.text = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.yAxis[0].title.rotation = this.constants.ROTATION;
BI.extend(config.yAxis[0], {
lineWidth: this.config.lineWidth,
showLabel: this.config.showLabel,
enableTick: this.config.enableTick,
reversed: this.config.leftYAxisReversed,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS, config.yAxis[0].formatter, true);
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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)
}
unit = unit === "" ? unit : "(" + unit + ")";
return self.config.showLeftYAxisTitle === true ? self.config.leftYAxisTitle + unit : unit
}
},
_formatItems: function (items) {
return BI.map(items, function (idx, item) {
var i = BI.UUID();
return BI.map(item, function (id, it) {
return BI.extend({}, it, {stack: i, stackByPercent: true});
});
});
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AREA);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.PercentAccumulateAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.percent_accumulate_area_chart', BI.PercentAccumulateAreaChart);

240
src/addons/chart/chart/chart.percentaccumulateaxis.js

@ -0,0 +1,240 @@
/**
* 图表控件 百分比堆积柱状
* @class BI.PercentAccumulateAxisChart
* @extends BI.Widget
*/
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 () {
BI.PercentAccumulateAxisChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.yAxis = [{
type: "value",
title: {
style: self.constants.FONT_STYLE
},
labelStyle: self.constants.FONT_STYLE,
position: "left",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_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;
config.style = formatChartStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
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) {
delete config.dataSheet;
delete config.zoom.zoomType;
}
config.yAxis = this.yAxis;
config.yAxis[0].title.rotation = this.constants.ROTATION;
config.yAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + yTitle : yTitle;
BI.extend(config.yAxis[0], {
lineWidth: this.config.lineWidth,
showLabel: this.config.showLabel,
enableTick: this.config.enableTick,
reversed: this.config.leftYAxisReversed,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators)
});
self.formatNumberLevelInYaxis(config, items, this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS, config.yAxis[0].formatter, true);
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function (items) {
return BI.map(items, function (idx, item) {
var i = BI.UUID();
return BI.map(item, function (id, it) {
return BI.extend({}, it, {stack: i, stackByPercent: true});
});
});
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showDataTable: options.showDataTable || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
showZoom: options.showZoom || false,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.AXIS);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.PercentAccumulateAxisChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.percent_accumulate_axis_chart', BI.PercentAccumulateAxisChart);

153
src/addons/chart/chart/chart.pie.js

@ -0,0 +1,153 @@
/**
* 图表控件
* @class BI.PieChart
* @extends BI.Widget
*/
BI.PieChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.PieChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-pie-chart"
})
},
_init: function () {
BI.PieChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function(config, items){
var self = this, o = this.options;
delete config.zoom;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartPieStyle();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.tooltip.formatter.identifier = "${CATEGORY}${SERIES}${VALUE}${PERCENT}";
config.chartType = "pie";
delete config.xAxis;
delete config.yAxis;
config.plotOptions.dataLabels.align = "outside";
config.plotOptions.dataLabels.connectorWidth = "outside";
config.plotOptions.dataLabels.formatter.identifier = "${VALUE}${PERCENT}";
config.plotOptions.dataLabels.style = this.config.chartFont;
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(){
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
function formatChartPieStyle(){
switch (self.config.chartPieType){
case BICst.CHART_SHAPE.EQUAL_ARC_ROSE:
config.plotOptions.roseType = "sameArc";
break;
case BICst.CHART_SHAPE.NOT_EQUAL_ARC_ROSE:
config.plotOptions.roseType = "differentArc";
break;
case BICst.CHART_SHAPE.NORMAL:
default:
delete config.plotOptions.roseType;
break;
}
config.plotOptions.innerRadius = self.config.chartInnerRadius + "%";
config.plotOptions.endAngle = self.config.chartTotalAngle;
}
},
//目前饼图不会有多个系列,如果有多个就要把它们合并在一起
_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){
var seriesItem = [];
var obj = {data: [], name: ""};
seriesItem.push(obj);
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;
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
chartPieType: options.chartPieType || c.NORMAL,
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
chartInnerRadius: options.chartInnerRadius || 0,
chartTotalAngle: options.chartTotalAngle || BICst.PIE_ANGLES.TOTAL,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function(idx, axisItems){
var type = [];
BI.each(axisItems, function(id, item){
type.push(BICst.WIDGET.PIE);
});
types.push(type);
});
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function(){
this.combineChart.magnify();
}
});
BI.PieChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.pie_chart', BI.PieChart);

185
src/addons/chart/chart/chart.radar.js

@ -0,0 +1,185 @@
/**
* 图表控件
* @class BI.RadarChart
* @extends BI.Widget
*/
BI.RadarChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.RadarChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-radar-chart"
})
},
_init: function () {
BI.RadarChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.radiusAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
formatter: function () {
return this > 0 ? this : (-1) * this
},
gridLineWidth: 0,
position: "bottom"
}];
this.angleAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
delete config.zoom;
var title = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatChartRadarStyle();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
config.radiusAxis = this.radiusAxis;
config.angleAxis = this.angleAxis;
config.radiusAxis[0].formatter = self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators);
formatNumberLevelInYaxis(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS, config.radiusAxis[0].formatter);
config.radiusAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + title : title;
config.radiusAxis[0].gridLineWidth = this.config.showGridLine === true ? 1 : 0;
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
function formatChartRadarStyle() {
switch (self.config.chartRadarType) {
case BICst.CHART_SHAPE.POLYGON:
config.plotOptions.shape = "polygon";
break;
case BICst.CHART_SHAPE.CIRCLE:
config.plotOptions.shape = "circle";
break;
}
}
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) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
chartRadarType: options.chartRadarType || c.POLYGON,
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.STYLE_NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
cordon: options.cordon || [],
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.RADAR);
});
types.push(type);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.RadarChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.radar_chart', BI.RadarChart);

284
src/addons/chart/chart/chart.rangearea.js

@ -0,0 +1,284 @@
/**
* 图表控件
* @class BI.RangeAreaChart
* @extends BI.Widget
* 范围面积图的构造范围的两组item的必须有对应y值item1完全大于item2
*/
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 () {
BI.RangeAreaChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "category",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.yAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "left",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
var title = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
config.colors = this.config.chartColor;
config.style = formatChartStyle();
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.connectNulls = this.config.nullContinue;
config.yAxis = this.yAxis;
config.yAxis[0].title.rotation = this.constants.ROTATION;
config.yAxis[0].title.text = this.config.showLeftYAxisTitle === true ? this.config.leftYAxisTitle + title : title;
BI.extend(config.yAxis[0], {
lineWidth: this.config.lineWidth,
showLabel: this.config.showLabel,
enableTick: this.config.enableTick,
enableMinorTick: this.config.enableMinorTick,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
reversed: config.yAxis[0].reversed = this.config.leftYAxisReversed,
formatter: self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators)
});
formatNumberLevelInYaxis(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS, config.yAxis[0].formatter);
config.xAxis[0].title.align = "center";
config.xAxis[0].title.text = this.config.showXAxisTitle === true ? this.config.xAxisTitle : "";
BI.extend(config.xAxis[0], {
lineWidth: this.config.lineWidth,
enableTick: this.config.enableTick,
labelRotation: this.config.textDirection,
gridLineWidth: this.config.showGridLine === true ? 1 : 0,
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style" : self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
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) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
_formatItems: function (data) {
var o = this.options;
var items = [];
BI.each(data, function (idx, item) {
items = BI.concat(items, item);
});
if (BI.isEmptyArray(items)) {
return [];
}
if (items.length === 1) {
return [items];
}
var colors = this.config.chartColor || [];
if (BI.isEmptyArray(colors)) {
colors = ["#5caae4"];
}
var seriesMinus = [];
BI.each(items[0].data, function (idx, item) {
var res = items[1].data[idx].y - item.y;
seriesMinus.push({
x: items[1].data[idx].x,
y: res,
targetIds: items[1].data[idx].targetIds
});
});
items[1] = {
data: seriesMinus,
name: items[1].name,
stack: "stackedArea",
fillColor: colors[0]
};
BI.each(items, function (idx, item) {
if (idx === 0) {
BI.extend(item, {
name: items[0].name,
fillColorOpacity: 0,
stack: "stackedArea",
marker: {enabled: false},
fillColor: "#000000"
});
}
});
return [items];
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
chartStyle: options.chartStyle || c.NORMAL,
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
leftYAxisReversed: options.leftYAxisReversed || false,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
textDirection: options.textDirection || 0,
cordon: options.cordon || [],
lineWidth: BI.isNull(options.lineWidth) ? 1 : options.lineWidth,
showLabel: BI.isNull(options.showLabel) ? true : options.showLabel,
enableTick: BI.isNull(options.enableTick) ? true : options.enableTick,
enableMinorTick: BI.isNull(options.enableMinorTick) ? true : options.enableMinorTick,
numSeparators: options.numSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE,
nullContinue: options.nullContinue || false
};
this.options.items = items;
var types = [];
var type = [];
BI.each(items, function (idx, axisItems) {
type.push(BICst.WIDGET.AREA);
});
if (BI.isNotEmptyArray(type)) {
types.push(type);
}
this.combineChart.populate(this._formatItems(items), types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.RangeAreaChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.range_area_chart', BI.RangeAreaChart);

266
src/addons/chart/chart/chart.scatter.js

@ -0,0 +1,266 @@
/**
* 图表控件
* @class BI.ScatterChart
* @extends BI.Widget
*/
BI.ScatterChart = BI.inherit(BI.AbstractChart, {
_defaultConfig: function () {
return BI.extend(BI.ScatterChart.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-scatter-chart"
})
},
_init: function () {
BI.ScatterChart.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.xAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "bottom",
gridLineWidth: 0
}];
this.yAxis = [{
type: "value",
title: {
style: this.constants.FONT_STYLE
},
labelStyle: this.constants.FONT_STYLE,
position: "left",
gridLineWidth: 0
}];
this.combineChart = BI.createWidget({
type: "bi.combine_chart",
xAxis: this.xAxis,
popupItemsGetter: o.popupItemsGetter,
formatConfig: BI.bind(this._formatConfig, this),
element: this.element
});
this.combineChart.on(BI.CombineChart.EVENT_CHANGE, function (obj) {
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)
});
},
_formatConfig: function (config, items) {
var self = this;
delete config.zoom;
config.colors = this.config.chartColor;
config.style = formatChartStyle();
config.plotOptions.marker = {"symbol": "circle", "radius": 4.5, "enabled": true};
formatCordon();
this.formatChartLegend(config, this.config.chartLegend);
config.plotOptions.dataLabels.enabled = this.config.showDataLabel;
config.plotOptions.dataLabels.formatter.identifier = "${X}${Y}";
config.yAxis = this.yAxis;
config.xAxis = this.xAxis;
config.yAxis[0].formatter = self.formatTickInXYaxis(this.config.leftYAxisStyle, this.config.leftYAxisNumberLevel, this.config.numSeparators);
formatNumberLevelInYaxis(this.config.leftYAxisNumberLevel);
config.yAxis[0].title.text = getXYAxisUnit(this.config.leftYAxisNumberLevel, this.constants.LEFT_AXIS);
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.xAxis[0].formatter = self.formatTickInXYaxis(this.config.xAxisStyle, this.config.xAxisNumberLevel, this.config.rightNumSeparators);
formatNumberLevelInXaxis(this.config.xAxisNumberLevel);
config.xAxis[0].title.text = getXYAxisUnit(this.config.xAxisNumberLevel, this.constants.X_AXIS);
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.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>'
};
}
if (config.plotOptions.dataLabels.enabled === true) {
BI.each(items, function (idx, item) {
item.dataLabels = {
"style": self.config.chartFont,
"align": "outside",
"autoAdjust": true,
enabled: true,
formatter: {
identifier: "${X}${Y}",
"XFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
},
"YFormat": function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
}
}
};
item.dataLabels.formatter.XFormat = config.xAxis[0].formatter;
item.dataLabels.formatter.YFormat = config.yAxis[0].formatter;
});
}
//全局样式图表文字
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() {
switch (self.config.chartStyle) {
case BICst.CHART_STYLE.STYLE_GRADUAL:
return "gradual";
case BICst.CHART_STYLE.STYLE_NORMAL:
default:
return "normal";
}
}
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) {
return BI.extend(t, {
value: t.value.div(magnify),
width: 1,
label: {
"style": self.config.chartFont,
"text": t.text,
"align": "top"
}
});
});
}
if (idx > 0 && self.yAxis.length >= idx) {
var magnify = 1;
switch (idx - 1) {
case self.constants.LEFT_AXIS:
magnify = self.calcMagnify(self.config.leftYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS:
magnify = self.calcMagnify(self.config.rightYAxisNumberLevel);
break;
case self.constants.RIGHT_AXIS_SECOND:
magnify = self.calcMagnify(self.config.rightYAxisSecondNumberLevel);
break;
}
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"
}
});
});
}
})
}
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) {
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);
})
});
}
function getXYAxisUnit(numberLevelType, position) {
var unit = "";
switch (numberLevelType) {
case BICst.TARGET_STYLE.NUM_LEVEL.NORMAL:
unit = "";
break;
case BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND:
unit = BI.i18nText("BI-Wan");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.MILLION:
unit = BI.i18nText("BI-Million");
break;
case BICst.TARGET_STYLE.NUM_LEVEL.YI:
unit = BI.i18nText("BI-Yi");
break;
}
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.RIGHT_AXIS) {
self.config.rightYAxisUnit !== "" && (unit = unit + self.config.rightYAxisUnit)
}
return unit === "" ? unit : "(" + unit + ")";
}
},
populate: function (items, options) {
options || (options = {});
var self = this, c = this.constants;
this.config = {
leftYAxisTitle: options.leftYAxisTitle || "",
chartColor: options.chartColor || [],
leftYAxisStyle: options.leftYAxisStyle || c.NORMAL,
xAxisStyle: options.xAxisStyle || c.NORMAL,
showXAxisTitle: options.showXAxisTitle || false,
showLeftYAxisTitle: options.showLeftYAxisTitle || false,
xAxisNumberLevel: options.xAxisNumberLevel || c.NORMAL,
leftYAxisNumberLevel: options.leftYAxisNumberLevel || c.NORMAL,
xAxisUnit: options.xAxisUnit || "",
leftYAxisUnit: options.leftYAxisUnit || "",
xAxisTitle: options.xAxisTitle || "",
chartLegend: options.chartLegend || c.LEGEND_BOTTOM,
showDataLabel: options.showDataLabel || false,
showGridLine: BI.isNull(options.showGridLine) ? true : options.showGridLine,
cordon: options.cordon || [],
tooltip: options.tooltip || [],
numSeparators: options.numSeparators || false,
rightNumSeparators: options.rightNumSeparators || false,
chartFont: options.chartFont || c.FONT_STYLE
};
this.options.items = items;
var types = [];
BI.each(items, function (idx, axisItems) {
var type = [];
BI.each(axisItems, function (id, item) {
type.push(BICst.WIDGET.SCATTER);
});
types.push(type);
});
this.combineChart.populate(items, types);
},
resize: function () {
this.combineChart.resize();
},
magnify: function () {
this.combineChart.magnify();
}
});
BI.ScatterChart.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut('bi.scatter_chart', BI.ScatterChart);

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

@ -0,0 +1,291 @@
BI.ChartCombineFormatItemFactory = {
combineItems: function (types, items) {
var calItems = BI.values(items);
return BI.map(calItems, function (idx, item) {
return BI.ChartCombineFormatItemFactory.formatItems(types[idx], item);
});
},
formatItems: function (type, items) {
var item = {};
switch (type) {
case BICst.WIDGET.BAR:
case BICst.WIDGET.ACCUMULATE_BAR:
case BICst.WIDGET.COMPARE_BAR:
item = BI.extend({"type": "bar"}, items);
break;
case BICst.WIDGET.BUBBLE:
item = BI.extend({"type": "bubble"}, items);
break;
case BICst.WIDGET.FORCE_BUBBLE:
item = BI.extend({"type": "forceBubble"}, items);
break;
case BICst.WIDGET.SCATTER:
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);
break;
case BICst.WIDGET.LINE:
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);
break;
case BICst.WIDGET.DONUT:
item = BI.extend({"type": "pie"}, items);
break;
case BICst.WIDGET.RADAR:
case BICst.WIDGET.ACCUMULATE_RADAR:
item = BI.extend({"type": "radar"}, items);
break;
case BICst.WIDGET.PIE:
item = BI.extend({"type": "pie"}, items);
break;
case BICst.WIDGET.DASHBOARD:
item = BI.extend({"type": "gauge"}, items);
break;
case BICst.WIDGET.MAP:
item = BI.extend({"type": "areaMap"}, items);
break;
case BICst.WIDGET.GIS_MAP:
item = BI.extend({"type": "pointMap"}, items);
break;
default:
item = BI.extend({"type": "column"}, items);
break;
}
return item;
},
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
},
"align": "outside",
"enabled": false
},
"percentageLabel": {
"formatter": {
"identifier": "${PERCENT}",
"valueFormat": this._contentFormat2Decimal,
"seriesFormat": this._contentFormat,
"percentFormat": this._contentFormatPercentage,
"categoryFormat": this._contentFormat
},
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
},
"align": "bottom",
"enabled": true
},
"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"
},
"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
},
"style": {
"fontFamily": "inherit", "color": "inherit", "fontSize": "12px"
},
"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
},
"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
}
}
},
"dTools": {
"enabled": false,
"style": {
"fontFamily": "Microsoft YaHei, Hiragino Sans GB W3",
"color": "#1a1a1a",
"fontSize": "12px"
},
"backgroundColor": 'white'
},
"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"
},
"position": "right",
"enabled": false
},
"rangeLegend": {
"range": {
"min": 0,
"color": [
[
0,
"rgb(182,226,255)"
],
[
0.5,
"rgb(109,196,255)"
],
[
1,
"rgb(36,167,255)"
]
],
"max": 266393
},
"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
};
},
_contentFormat: function () {
return BI.contentFormat(arguments[0], '')
},
_contentFormat2Decimal: function () {
return BI.contentFormat(arguments[0], '#.##;-#.##')
},
_contentFormatPercentage: function () {
return BI.contentFormat(arguments[0], '#.##%;-#.##%')
}
};

4
src/base/combination/combo.js

@ -132,7 +132,7 @@ BI.Combo = BI.inherit(BI.Widget, {
}
}
}, BI.EVENT_RESPONSE_TIME, true);
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function(e){
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e);
st(e);
});
@ -248,7 +248,7 @@ BI.Combo = BI.inherit(BI.Widget, {
break;
case "top":
case "top,right":
p = $.getComboPosition(this.combo, this.popupView, 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":

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

@ -158,7 +158,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
removeItemAt: function (indexes) {
BI.remove(this.buttons, indexes);
BI.removeAt(this.buttons, indexes);
this.layouts.removeItemAt(indexes);
},

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

@ -16,7 +16,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
stopPropagation: false,
selected: false,
once: false, //点击一次选中有效,再点无效
forceSelected: false, //点击即选中, 选中了就不会被取消
forceSelected: false, //点击即选中, 选中了就不会被取消,与once的区别是forceSelected不影响事件的触发
forceNotSelected: false, //无论怎么点击都不会被选中
disableSelected: false, //使能选中

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

@ -9,25 +9,25 @@
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/
BI.Button = BI.inherit(BI.BasicButton, {
_const: {
minWidth: 90
},
_defaultConfig: function () {
_defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + ' bi-button',
shadow: true,
minWidth: (props.block === true || props.clear === true) ? 0 : 90,
shadow: props.clear !== true,
isShadowShowingOnSelected: true,
readonly: true,
iconClass: "",
level: 'common',
block: false, //是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, //是否去掉边框和背景
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: 10,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
@ -39,8 +39,10 @@
_init: function () {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height)) {
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'});
} else {
this.element.css({lineHeight: o.height + 'px'});
}
if (BI.isKey(o.iconClass)) {
this.icon = BI.createWidget({
@ -87,7 +89,15 @@
value: o.value
});
}
this.element.css({"min-width": this._const.minWidth - 2 + "px"});
if (o.block === true) {
this.element.addClass("block");
}
if (o.clear === true) {
this.element.addClass("clear");
}
if (o.minWidth > 2) {
this.element.css({"min-width": o.minWidth - 2 + "px"});
}
},
doClick: function () {
@ -111,8 +121,8 @@
setEnable: function (b) {
BI.Button.superclass.setEnable.apply(this, arguments);
this.text.setEnable(b);
this.icon && this.icon.setEnable(b);
// this.text.setEnable(b);
// this.icon && this.icon.setEnable(b);
},
doRedMark: function () {

7
src/base/single/tip/tip.tooltip.js

@ -15,6 +15,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
extraCls: "bi-tooltip",
text: "",
level: "success",//success或warning
stopEvent: false,
stopPropagation: false,
height: 20
})
},
@ -23,9 +25,8 @@ BI.Tooltip = BI.inherit(BI.Tip, {
var self = this, o = this.options;
this.element.addClass("tooltip-" + o.level);
var fn = function (e) {
e.stopPropagation();
e.stopEvent();
return false;
o.stopPropagation && e.stopPropagation();
o.stopEvent && e.stopEvent();
};
this.element.bind({
"click": fn,

155
src/base/table/native.scrollbar.js

@ -0,0 +1,155 @@
/**
*
* 原生表格滚动条为了IE8的兼容
*
* Created by GUY on 2016/1/12.
* @class BI.NativeTableScrollbar
* @extends BI.Widget
*/
BI.NativeTableScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
defaultPosition: 0,
position: 0,
size: 0
})
},
render: function () {
var self = this, o = this.options;
//把滚动台size改掉
BI.GridTableScrollbar.SIZE = 16;
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrolly: true,
items: [{
type: "bi.layout",
width: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
}
},
mounted: function () {
this._populate();
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollTop(o.position);
} catch (e) {
}
this.inner.element.height(o.contentSize);
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setHeight(size);
this.options.size = size;
},
populate: function () {
this._populate();
}
});
BI.NativeTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_scrollbar", BI.NativeTableScrollbar);
BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
position: 0,
size: 0
})
},
render: function () {
var self = this, o = this.options;
//把滚动台size改掉
BI.GridTableScrollbar.SIZE = 16;
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrollx: true,
items: [{
type: "bi.layout",
height: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
}
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setWidth(size);
this.options.size = size;
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollLeft(o.position);
} catch (e) {
}
this.inner.element.width(o.contentSize);
},
populate: function () {
this._populate();
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);

6
src/base/table/table.grid.scrollbar.js

@ -154,7 +154,11 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
} else {
this._mouseMoveTracker.captureMouseMoves(e);
}
this.element[0].focus();
try {
this.element[0].focus();
} catch (e) {
}
},
_onMouseMove: function (deltaX, deltaY) {

6
src/case/combo/bubblecombo/combo.bubble.js

@ -128,7 +128,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
type: "bi.center_adapt",
items: [{
type: "bi.layout",
cls: "bubble-combo-triangle-" + direction
cls: "bubble-combo-triangle-" + direction + " bi-high-light-border"
}]
});
pos.el = this.triangle;
@ -193,6 +193,10 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
showView: function () {
this.combo && this.combo.showView();
},
hasView: function () {
return BI.isNotNull(this.combo.getView());
}
});

2
src/case/combo/bubblecombo/popup.bubble.js

@ -55,7 +55,7 @@ BI.BubblePopupView = BI.inherit(BI.PopupView, {
}
this.line = BI.createWidget(op, {
type: "bi.layout",
cls: "bubble-popup-line"
cls: "bubble-popup-line bi-high-light-background"
});
pos.el = this.line;
BI.createWidget({

162
src/case/editor/editor.adapt.js

@ -1,162 +0,0 @@
/**
* 根据内容自适应长度的输入框
* @class BI.AdaptiveEditor
* @extends BI.Single
*/
BI.AdaptiveEditor = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.AdaptiveEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-adapt-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
mouseOut: false,
allowBlank: true,
watermark: "",
errorText: "",
height: 30
})
},
_init: function () {
BI.AdaptiveEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget({
type: "bi.sign_editor",
element: this,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
mouseOut: o.mouseOut,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_FOCUS);
});
this.editor.on(BI.SignEditor.EVENT_BLUR, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_BLUR);
});
this.editor.on(BI.SignEditor.EVENT_CLICK, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_CLICK);
});
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () {
self._checkEditorLength();
self.fireEvent(BI.AdaptiveEditor.EVENT_CHANGE);
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.AdaptiveEditor.EVENT_KEY_DOWN);
});
this.editor.on(BI.SignEditor.EVENT_VALID, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_VALID);
});
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_CONFIRM);
});
this.editor.on(BI.SignEditor.EVENT_START, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_START);
});
this.editor.on(BI.SignEditor.EVENT_PAUSE, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_PAUSE);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_STOP);
});
this.editor.on(BI.SignEditor.EVENT_SPACE, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_SPACE);
});
this.editor.on(BI.SignEditor.EVENT_ERROR, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_ERROR);
});
this.editor.on(BI.SignEditor.EVENT_ENTER, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_ENTER);
});
this.editor.on(BI.SignEditor.EVENT_RESTRICT, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_RESTRICT);
});
this.editor.on(BI.SignEditor.EVENT_EMPTY, function () {
self.fireEvent(BI.AdaptiveEditor.EVENT_EMPTY);
});
this._checkEditorLength();
},
_checkEditorLength: function () {
var o = this.options;
this.element.width(BI.DOM.getTextSizeWidth(this.getValue(), 14) + 2 * o.hgap + o.lgap + o.rgap);
},
focus: function () {
this.editor.focus();
},
blur: function () {
this.editor.blur();
},
isValid: function () {
return this.editor.isValid();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
setValue: function (k) {
this.editor.setValue(k);
this._checkEditorLength();
},
getValue: function () {
return this.editor.getValue();
},
getState: function () {
return this.editor.getState();
},
setState: function (v) {
}
});
BI.AdaptiveEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.AdaptiveEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.AdaptiveEditor.EVENT_BLUR = "EVENT_BLUR";
BI.AdaptiveEditor.EVENT_CLICK = "EVENT_CLICK";
BI.AdaptiveEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.AdaptiveEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.AdaptiveEditor.EVENT_START = "EVENT_START";
BI.AdaptiveEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.AdaptiveEditor.EVENT_STOP = "EVENT_STOP";
BI.AdaptiveEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.AdaptiveEditor.EVENT_VALID = "EVENT_VALID";
BI.AdaptiveEditor.EVENT_ERROR = "EVENT_ERROR";
BI.AdaptiveEditor.EVENT_ENTER = "EVENT_ENTER";
BI.AdaptiveEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.AdaptiveEditor.EVENT_SPACE = "EVENT_SPACE";
BI.AdaptiveEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.adapt_editor", BI.AdaptiveEditor);

2
src/case/editor/editor.search.js

@ -173,7 +173,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
setEnable: function (b) {
BI.Editor.superclass.setEnable.apply(this, arguments);
this.editor && this.editor.setEnable(b);
this.clear.setEnabled(b);
this.clear.setEnable(b);
}
});
BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE";

15
src/case/editor/editor.shelter.js

@ -2,9 +2,9 @@
* 带标记的文本框
* Created by GUY on 2016/1/25.
* @class BI.ShelterEditor
* @extends BI.Single
* @extends BI.Widget
*/
BI.ShelterEditor = BI.inherit(BI.Single, {
BI.ShelterEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -49,6 +49,9 @@ BI.ShelterEditor = BI.inherit(BI.Single, {
this.text = BI.createWidget({
type: "bi.text_button",
cls: "shelter-editor-text",
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: o.textAlign,
height: o.height,
hgap: 4
@ -154,6 +157,14 @@ BI.ShelterEditor = BI.inherit(BI.Single, {
this.text.visible();
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
focus: function () {
this._showInput();
this.editor.focus();

2
src/case/editor/editor.sign.initial.js

@ -3,7 +3,7 @@
* @class BI.SignInitialEditor
* @extends BI.Single
*/
BI.SignInitialEditor = BI.inherit(BI.Single, {
BI.SignInitialEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {

17
src/case/editor/editor.sign.js

@ -2,9 +2,9 @@
* 带标记的文本框
* Created by GUY on 2015/8/28.
* @class BI.SignEditor
* @extends BI.Single
* @extends BI.Widget
*/
BI.SignEditor = BI.inherit(BI.Single, {
BI.SignEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -48,6 +48,9 @@ BI.SignEditor = BI.inherit(BI.Single, {
this.text = BI.createWidget({
type: "bi.text_button",
cls: "sign-editor-text",
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType,
textAlign: "left",
height: o.height,
hgap: 4,
@ -158,6 +161,14 @@ BI.SignEditor = BI.inherit(BI.Single, {
this.text.visible();
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
focus: function () {
this._showInput();
this.editor.focus();
@ -195,7 +206,7 @@ BI.SignEditor = BI.inherit(BI.Single, {
return this.editor.isValid();
},
setValid: function(v){
setValid: function (v) {
BI.SignEditor.superclass.setValid.apply(this, arguments);
this.editor.setValid(v);
},

20
src/case/editor/editor.state.js

@ -4,7 +4,7 @@
* @class BI.StateEditor
* @extends BI.Single
*/
BI.StateEditor = BI.inherit(BI.Single, {
BI.StateEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -233,15 +233,15 @@ BI.StateEditor = BI.inherit(BI.Single, {
return;
}
if (BI.isString(v)) {
if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setTitle("");
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(v);
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
}
// if (BI.isEmpty(v)) {
// this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
// this.text.setTitle("");
// this.text.element.addClass("state-editor-infinite-text");
// } else {
this.text.setText(v);
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
// }
return;
}
if (BI.isArray(v)) {

2
src/case/editor/editor.state.simple.js

@ -4,7 +4,7 @@
* @class BI.SimpleStateEditor
* @extends BI.Single
*/
BI.SimpleStateEditor = BI.inherit(BI.Single, {
BI.SimpleStateEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {

4
src/case/editor/editor.text.js

@ -3,7 +3,7 @@
* @class BI.TextEditor
* @extends BI.Single
*/
BI.TextEditor = BI.inherit(BI.Single, {
BI.TextEditor = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -96,7 +96,7 @@ BI.TextEditor = BI.inherit(BI.Single, {
self.fireEvent(BI.TextEditor.EVENT_STOP);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.TextEditor.EVENT_ERROR);
self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.TextEditor.EVENT_ENTER);

7
src/case/layer/pane.list.js

@ -101,6 +101,13 @@ BI.ListPane = BI.inherit(BI.Pane, {
this.check();
},
removeItemAt: function (indexes) {
indexes = indexes || [];
BI.removeAt(this.options.items, indexes);
this.button_group.removeItemAt.apply(this.button_group, arguments);
this.check();
},
populate: function (items) {
var self = this, o = this.options;
if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法

4
src/case/loader/sort.list.js

@ -60,8 +60,8 @@ BI.SortList = BI.inherit(BI.Widget, {
containment: o.containment || this.element,
connectWith: o.connectWith || ".bi-sort-list",
items: ".sort-item",
cursor: "drag",
tolerance: "intersect",
cursor: o.cursor || "drag",
tolerance: o.tolerance || "intersect",
placeholder: {
element: function ($currentItem) {
var holder = BI.createWidget({

2
src/case/trigger/trigger.text.select.js

@ -40,10 +40,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
}
},

2
src/case/zclip/zclip.js

@ -16,7 +16,7 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, {
_init: function () {
BI.ZeroClip.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.nextTick(function () {
self.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf",

15
src/config.js

@ -54,6 +54,21 @@ $(function () {
return ob;
}
});
//注册滚动条
BI.Plugin.registerWidget("bi.grid_table_scrollbar", function (ob) {
if (BI.isIE9Below()) {
return BI.extend(ob, {type: "bi.native_table_scrollbar"});
} else {
return ob;
}
});
BI.Plugin.registerWidget("bi.grid_table_horizontal_scrollbar", function (ob) {
if (BI.isIE9Below()) {
return BI.extend(ob, {type: "bi.native_table_horizontal_scrollbar"});
} else {
return ob;
}
});
//注册控件
BI.Plugin.registerWidget("bi.grid_table", function (ob) {

20
src/core/base.js

@ -1025,6 +1025,26 @@ if (!window.BI) {
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
},
isIE9Below: function () {
if (!BI.isIE()) {
return false;
}
var version = 0;
var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/);
var v2 = agent.match(/(?:trident.*rv:([\w.]+))/);
if (v1 && v2 && v1[1] && v2[1]) {
version = Math.max(v1[1] * 1, v2[1] * 1);
} else if (v1 && v1[1]) {
version = v1[1] * 1;
} else if (v2 && v2[1]) {
version = v2[1] * 1;
} else {
version = 0;
}
return version < 9;
},
isEdge: function () {
return /edge/i.test(navigator.userAgent.toLowerCase());
},

1
src/core/controller/controller.tooltips.js

@ -26,6 +26,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
type: "bi.tooltip",
text: text,
level: level,
stopEvent: true,
height: this._const.height
});
},

2
src/core/controller/router.floatbox.js

@ -87,7 +87,7 @@ BI.FloatBoxRouter = BI.inherit(BI.WRouter, {
if(this.controller){
this.controller.remove(url);
delete this.store[url];
this.views[url] && this.views[url].destroy();
this.views[url] && this.views[url].model.destroy();
delete this.views[url];
}
return this;

4
src/core/func/dom.js

@ -577,7 +577,9 @@ BI.extend(jQuery, {
}
break;
}
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
if(needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
}
return position;
}
});

3
src/core/func/function.js

@ -137,6 +137,9 @@ $(function () {
//获取对比颜色
getContrastColor: function (color) {
if (!color) {
return "";
}
if (this.isDarkColor(color)) {
return "#ffffff";
}

26
src/core/proto/date.js

@ -182,6 +182,32 @@ Date.prototype.getQuarterStartMonth = function () {
}
return quarterStartMonth;
};
//指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime());
var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if(day > monthDay){
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
};
//获得本周的起始日期
Date.prototype.getWeekStartDate = function () {
var w = this.getDay();
return this.getOffsetDate(-w);
};
//得到本周的结束日期
Date.prototype.getWeekEndDate = function () {
var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w);
return this.getOffsetDate(offset);
};
//获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);

5
src/core/widget.js

@ -208,11 +208,12 @@ BI.Widget = BI.inherit(BI.OB, {
setVisible: function (visible) {
if (visible === true) {
this.options.invisible = false;
this.element.show();
//用this.element.show()会把display属性改成block
this.element.css("display", "");
this._mount();
} else if (visible === false) {
this.options.invisible = true;
this.element.hide();
this.element.css("display", "none");
}
this.fireEvent(BI.Events.VIEW, visible);
},

98
src/core/wrapper/layout/adapt/inline.center.js

@ -1,98 +0,0 @@
/**
* 内联布局
* @class BI.InlineCenterAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineCenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-center-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + "-" + i)) {
var t = BI.createWidget(item);
t.element.css({
"position": "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + "-" + i, w);
} else {
var w = this.getWidgetByName(this.getName() + "-" + i);
}
w.element.css({
"position": "relative",
"display": "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("cannot be added");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (!!item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineCenterAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline_center_adapt', BI.InlineCenterAdaptLayout);

72
src/core/wrapper/layout/adapt/inline.vertical.js

@ -1,72 +0,0 @@
/**
* 内联布局
* @class BI.InlineVerticalAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineVerticalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-vertical-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
"position": "relative",
"display": "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1
});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
populate: function (items) {
BI.InlineVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline_vertical_adapt', BI.InlineVerticalAdaptLayout);

63
src/core/wrapper/layout/layout.inline.js

@ -1,63 +0,0 @@
/**
* 内联布局
* @class BI.InlineLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
})
}
if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
})
}
if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
})
}
if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
})
}
return w;
},
resize: function(){
this.stroke(this.options.items);
},
populate: function (items) {
BI.InlineLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut('bi.inline', BI.InlineLayout);

3
src/css/base/combo/popup.bubble.css

@ -6,6 +6,3 @@
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.bi-bubble-popup-view .bubble-popup-line {
background-color: #3f8ce8;
}

101
src/css/base/single/button/button.css

@ -12,60 +12,96 @@
cursor: pointer;
font-size: 14px;
}
.bi-button.button-common,
.bi-button.button-common .b-font {
color: #ffffff;
.bi-button.block {
font-size: inherit;
border-width: 0;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.bi-button.clear {
font-size: inherit;
border-width: 0;
background-color: transparent;
}
.bi-button.clear:hover,
.bi-button.clear:active {
opacity: 0.75;
filter: alpha(opacity=75);
}
.bi-button.button-common,
.bi-button.button-common .b-font:before {
color: #ffffff;
}
.bi-button.button-common.clear,
.bi-button.button-common.clear .b-font:before {
color: #3f8ce8;
}
.bi-button.button-ignore {
background-color: #ffffff;
border-color: #d4dadd;
}
.bi-button.button-ignore,
.bi-button.button-ignore .b-font {
.bi-button.button-ignore .b-font:before {
color: #1a1a1a;
}
.bi-button.button-ignore.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-success {
background-color: #58cc7d;
border-color: #58cc7d;
}
.bi-button.button-success,
.bi-button.button-success .b-font {
color: #ffffff;
}
.bi-button.button-success .b-font:before {
color: #ffffff;
}
.bi-button.button-success.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-success.clear,
.bi-button.button-success.clear .b-font:before {
color: #0c6d23;
}
.bi-button.button-warning {
background-color: #e85050;
border-color: #e85050;
}
.bi-button.button-warning,
.bi-button.button-warning .b-font {
color: #ffffff;
}
.bi-button.button-warning .b-font:before {
color: #ffffff;
}
.bi-button.button-warning.clear {
background-color: transparent;
border-width: 0;
}
.bi-button.button-warning.clear,
.bi-button.button-warning.clear .b-font:before {
color: #e85050;
}
.bi-button.button-common.disabled,
.bi-button.button-success.disabled,
.bi-button.button-warning.disabled {
.bi-button.button-warning.disabled,
.bi-button.button-common.disabled.base-disabled,
.bi-button.button-success.disabled.base-disabled,
.bi-button.button-warning.disabled.base-disabled {
background: #cccccc !important;
border-color: #c4c6c6 !important;
border-color: #cccccc !important;
}
.bi-button.button-common.disabled,
.bi-button.button-success.disabled,
.bi-button.button-warning.disabled,
.bi-button.button-common.disabled .b-font,
.bi-button.button-success.disabled .b-font,
.bi-button.button-warning.disabled .b-font {
color: #ffffff !important;
}
.bi-button.button-common.disabled.base-disabled,
.bi-button.button-success.disabled.base-disabled,
.bi-button.button-warning.disabled.base-disabled,
.bi-button.button-common.disabled .b-font:before,
.bi-button.button-success.disabled .b-font:before,
.bi-button.button-warning.disabled .b-font:before {
.bi-button.button-warning.disabled .b-font:before,
.bi-button.button-common.disabled.base-disabled .b-font:before,
.bi-button.button-success.disabled.base-disabled .b-font:before,
.bi-button.button-warning.disabled.base-disabled .b-font:before {
color: #ffffff !important;
}
.bi-button.button-ignore.disabled {
@ -73,12 +109,37 @@
border-color: #d4dadd !important;
}
.bi-button.button-ignore.disabled,
.bi-button.button-ignore.disabled .b-font {
.bi-button.button-ignore.disabled .b-font:before {
color: #cccccc !important;
}
.bi-button.button-ignore.disabled .b-font:before {
.bi-button.button-common.disabled.clear,
.bi-button.button-success.disabled.clear,
.bi-button.button-warning.disabled.clear,
.bi-button.button-ignore.disabled.clear {
background: transparent !important;
border-width: 0 !important;
}
.bi-button.button-common.disabled.clear,
.bi-button.button-success.disabled.clear,
.bi-button.button-warning.disabled.clear,
.bi-button.button-ignore.disabled.clear,
.bi-button.button-common.disabled.clear .b-font:before,
.bi-button.button-success.disabled.clear .b-font:before,
.bi-button.button-warning.disabled.clear .b-font:before,
.bi-button.button-ignore.disabled.clear .b-font:before {
color: #cccccc !important;
}
.bi-button.button-common.disabled.clear:hover,
.bi-button.button-success.disabled.clear:hover,
.bi-button.button-warning.disabled.clear:hover,
.bi-button.button-ignore.disabled.clear:hover,
.bi-button.button-common.disabled.clear:active,
.bi-button.button-success.disabled.clear:active,
.bi-button.button-warning.disabled.clear:active,
.bi-button.button-ignore.disabled.clear:active {
opacity: 1;
filter: alpha(opacity=100);
}
.bi-basic-button.button-common .bi-button-mask,
.bi-basic-button.button-success .bi-button-mask,
.bi-basic-button.button-warning .bi-button-mask {

6
src/css/base/single/editor/editor.textarea.css

@ -12,3 +12,9 @@
.bi-textarea-editor .textarea-editor-content {
border: none;
}
.bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #d4dadd;
}
.bi-theme-dark .bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #525466;
}

4
src/css/base/table/table.grid.scrollbar.css

@ -100,13 +100,13 @@
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-faceActive:after {
.public-scrollbar-face-active:after {
background-color: rgba(102, 102, 102, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666,endColorstr=#b3666666);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-faceActive:after {
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(204, 204, 204, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc,endColorstr=#b3cccccc);
}

63
src/css/core/utils/common.css

@ -94,6 +94,9 @@
background-color: #3f8ce8;
color: #ffffff;
}
.bi-high-light-border {
border-color: #178cdf;
}
.bi-water-mark {
color: #cccccc;
cursor: text;
@ -110,10 +113,20 @@
.bi-theme-dark .bi-resizer {
background: #ffffff;
}
.bi-mask {
color: #ffffff;
background-color: rgba(26, 26, 26, 0.2);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#331a1a1a,endColorstr=#331a1a1a);
}
.bi-theme-dark .bi-mask {
color: #242640;
background-color: rgba(255, 255, 255, 0.2);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff,endColorstr=#33ffffff);
}
.bi-z-index-mask {
color: #ffffff;
background-color: rgba(26, 26, 26, 0.5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a);
background-color: rgba(26, 26, 26, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d1a1a1a,endColorstr=#4d1a1a1a);
}
.bi-list-item:hover,
.bi-list-item.hover {
@ -149,6 +162,10 @@
.bi-theme-dark .bi-list-item.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-border:active,
.bi-list-item-border.active {
border: 1px solid #178cdf;
}
.bi-list-item-simple {
color: #999999;
}
@ -247,6 +264,48 @@
.bi-theme-dark .bi-list-item-active.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-active2:hover,
.bi-list-item-active2.hover {
color: #1a1a1a;
background-color: #ffffff;
}
.bi-list-item-active2.active,
.bi-list-item-active2:active {
color: #3f8ce8;
background-color: #ffffff;
}
.bi-list-item-active2.disabled,
.bi-list-item-active2.disabled:hover,
.bi-list-item-active2.disabled:active {
background-color: transparent !important;
color: #cccccc !important;
}
.bi-list-item-active2.disabled .bi-high-light,
.bi-list-item-active2.disabled:hover .bi-high-light,
.bi-list-item-active2.disabled:active .bi-high-light {
color: #cccccc !important;
}
.bi-theme-dark .bi-list-item-active2:hover,
.bi-theme-dark .bi-list-item-active2.hover {
color: #ffffff;
background-color: #242640;
}
.bi-theme-dark .bi-list-item-active2.active,
.bi-theme-dark .bi-list-item-active2:active {
color: #3f8ce8;
background-color: #242640;
}
.bi-theme-dark .bi-list-item-active2.disabled,
.bi-theme-dark .bi-list-item-active2.disabled:hover,
.bi-theme-dark .bi-list-item-active2.disabled:active {
background-color: transparent !important;
color: #666666 !important;
}
.bi-theme-dark .bi-list-item-active2.disabled .bi-high-light,
.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-high-light,
.bi-theme-dark .bi-list-item-active2.disabled:active .bi-high-light {
color: #666666 !important;
}
.bi-list-item-select:hover,
.bi-list-item-select.hover {
color: #1a1a1a;

26
src/css/resource/app.css

@ -3,7 +3,7 @@
/**** custom color(自定义颜色,用于特定场景) ****/
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
src: url('font/iconfont.eot'), /* IE6-IE8 */ url('font/iconfont.woff') format('woff'), /* chrome、firefox */ url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('font/iconfont.svg#svgFontName') format('svg');
/* iOS 4.1- */
}
@ -51,20 +51,11 @@ body {
-moz-outline: 0 none;
outline: 0 none;
}
#wrapper {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
}
div::-webkit-scrollbar,
textarea::-webkit-scrollbar {
-webkit-appearance: none;
background-color: rgba(102, 102, 102, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666,endColorstr=#0d666666);
width: 6px;
height: 6px;
}
@ -74,11 +65,18 @@ textarea::-webkit-scrollbar-thumb {
-moz-border-radius: 0;
border-radius: 0;
background-color: rgba(102, 102, 102, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666,endColorstr=#4d666666);
}
div::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
background-color: rgba(102, 102, 102, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666,endColorstr=#b3666666);
}
.bi-theme-dark div::-webkit-scrollbar,
.bi-theme-dark textarea::-webkit-scrollbar {
-webkit-appearance: none;
background-color: rgba(204, 204, 204, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc,endColorstr=#0dcccccc);
width: 6px;
height: 6px;
}
@ -88,4 +86,10 @@ textarea::-webkit-scrollbar-thumb {
-moz-border-radius: 0;
border-radius: 0;
background-color: rgba(204, 204, 204, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc,endColorstr=#4dcccccc);
}
.bi-theme-dark div::-webkit-scrollbar-thumb:hover,
.bi-theme-dark textarea::-webkit-scrollbar-thumb:hover {
background-color: rgba(204, 204, 204, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc,endColorstr=#b3cccccc);
}

6
src/css/resource/background.css

@ -13,7 +13,7 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/tree-vertical-line-2.png');
_background: none;
}
.bi-theme-dark .base-line-conn-background {
.bi-theme-dark .first-line-conn-background {
background: url('icon/dark/tree-vertical-line-2.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/dark/tree-vertical-line-2.png');
_background: none;
@ -23,7 +23,7 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/tree-vertical-line-3.png');
_background: none;
}
.bi-theme-dark .base-line-conn-background {
.bi-theme-dark .mid-line-conn-background {
background: url('icon/dark/tree-vertical-line-3.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/dark/tree-vertical-line-3.png');
_background: none;
@ -33,7 +33,7 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/tree-vertical-line-4.png');
_background: none;
}
.bi-theme-dark .base-line-conn-background {
.bi-theme-dark .last-line-conn-background {
background: url('icon/dark/tree-vertical-line-4.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='icon/dark/tree-vertical-line-4.png');
_background: none;

7
src/css/widget/image/button/href/image.button.href.css

@ -1,7 +0,0 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-image-button-href .image-button-href-icon-button {
z-index: 1;
font-size: 16px;
}

6
src/css/widget/image/button/size/image.button.size.css

@ -1,6 +0,0 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-image-button-size .image-button-size-button-group {
font-size: 12px;
}

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

Loading…
Cancel
Save