div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #eff1f4;
diff --git a/docs/widget.js b/docs/widget.js
index 00e7312a4..bb810d8d1 100644
--- a/docs/widget.js
+++ b/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();
diff --git a/src/addons/chart/chart.combine.js b/src/addons/chart/chart.combine.js
new file mode 100644
index 000000000..59177b48b
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart.js b/src/addons/chart/chart.js
new file mode 100644
index 000000000..7cb475339
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.abstract.js b/src/addons/chart/chart/chart.abstract.js
new file mode 100644
index 000000000..0607217e9
--- /dev/null
+++ b/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";
diff --git a/src/addons/chart/chart/chart.accumulatearea.js b/src/addons/chart/chart/chart.accumulatearea.js
new file mode 100644
index 000000000..8ccd9a81c
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.accumulateaxis.js b/src/addons/chart/chart/chart.accumulateaxis.js
new file mode 100644
index 000000000..7f3de4cf4
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.accumulatebar.js b/src/addons/chart/chart/chart.accumulatebar.js
new file mode 100644
index 000000000..fc614be8e
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.accumulateradar.js b/src/addons/chart/chart/chart.accumulateradar.js
new file mode 100644
index 000000000..86bb2c3ef
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.area.js b/src/addons/chart/chart/chart.area.js
new file mode 100644
index 000000000..4119527cb
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.axis.js b/src/addons/chart/chart/chart.axis.js
new file mode 100644
index 000000000..86330c600
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.bar.js b/src/addons/chart/chart/chart.bar.js
new file mode 100644
index 000000000..36f5e38e7
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.bubble.js b/src/addons/chart/chart/chart.bubble.js
new file mode 100644
index 000000000..d45e6efc3
--- /dev/null
+++ b/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 + '(X)' + self.config.tooltip[0] + ':' + x + '
(Y)' + self.config.tooltip[1]
+ + ':' + y + '
(' + BI.i18nText("BI-Size") + ')' + self.config.tooltip[2] + ':' + this.size + '
'}
+ };
+ }
+
+ //为了给数据标签加个%,还要遍历所有的系列,唉
+ 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);
diff --git a/src/addons/chart/chart/chart.comparearea.js b/src/addons/chart/chart/chart.comparearea.js
new file mode 100644
index 000000000..f8d39e5c5
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.compareaxis.js b/src/addons/chart/chart/chart.compareaxis.js
new file mode 100644
index 000000000..4162da484
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.comparebar.js b/src/addons/chart/chart/chart.comparebar.js
new file mode 100644
index 000000000..50698004a
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.dashboard.js b/src/addons/chart/chart/chart.dashboard.js
new file mode 100644
index 000000000..299413288
--- /dev/null
+++ b/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 = '' + this.seriesName + '
' + '' + value +
+ getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + '
';
+
+ if (isDashboard && items[0].data.length > 1) {
+ if (isMultiPointers) {
+ return '' + this.seriesName + ':' + value +
+ getXYAxisUnit(self.config.dashboardNumberLevel, self.constants.DASHBOARD_AXIS) + '
';
+ }
+ return label
+ } else if (isDashboard && BI.isNull(items[0].data[0].z)) {
+ return label
+ }
+
+ return '' + this.category + '
' + 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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.donut.js b/src/addons/chart/chart/chart.donut.js
new file mode 100644
index 000000000..0034d3177
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.fallaxis.js b/src/addons/chart/chart/chart.fallaxis.js
new file mode 100644
index 000000000..9ced4197a
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.forcebubble.js b/src/addons/chart/chart/chart.forcebubble.js
new file mode 100644
index 000000000..e659dd033
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.gismap.js b/src/addons/chart/chart/chart.gismap.js
new file mode 100644
index 000000000..e26ebfa53
--- /dev/null
+++ b/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 = '' + name + '
';
+ 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 += ('' + point.seriesName + ':' + BI.contentFormat((point.size || point.y), '#.##;-#.##') + '
');
+ });
+ 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": "© 2016 AutoNavi"
+ };
+ 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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.line.js b/src/addons/chart/chart/chart.line.js
new file mode 100644
index 000000000..69cb34598
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.map.js b/src/addons/chart/chart/chart.map.js
new file mode 100644
index 000000000..40b59bca1
--- /dev/null
+++ b/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 += ('' + point.seriesName + ':' + BI.contentFormat(point.size || point.y, formatterArray[index]) + '
');
+ 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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.multiaxis.js b/src/addons/chart/chart/chart.multiaxis.js
new file mode 100644
index 000000000..9b627f587
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.multiaxiscombine.js b/src/addons/chart/chart/chart.multiaxiscombine.js
new file mode 100644
index 000000000..1a2b9da7e
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.percentaccumulatearea.js b/src/addons/chart/chart/chart.percentaccumulatearea.js
new file mode 100644
index 000000000..fb59cc175
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.percentaccumulateaxis.js b/src/addons/chart/chart/chart.percentaccumulateaxis.js
new file mode 100644
index 000000000..b3a6a2e35
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.pie.js b/src/addons/chart/chart/chart.pie.js
new file mode 100644
index 000000000..a8a0029ef
--- /dev/null
+++ b/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);
+
diff --git a/src/addons/chart/chart/chart.radar.js b/src/addons/chart/chart/chart.radar.js
new file mode 100644
index 000000000..74d997afd
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.rangearea.js b/src/addons/chart/chart/chart.rangearea.js
new file mode 100644
index 000000000..695359f57
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/addons/chart/chart/chart.scatter.js b/src/addons/chart/chart/chart.scatter.js
new file mode 100644
index 000000000..42b5945da
--- /dev/null
+++ b/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 + '(X)' + self.config.tooltip[0]
+ + ':' + x + '
(Y)' + self.config.tooltip[1] + ':' + y + '
'
+ };
+ }
+
+ 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);
\ No newline at end of file
diff --git a/src/addons/chart/factory.charts.js b/src/addons/chart/factory.charts.js
new file mode 100644
index 000000000..405943a22
--- /dev/null
+++ b/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], '#.##%;-#.##%')
+ }
+};
\ No newline at end of file
diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js
index 105339c08..fae9df972 100644
--- a/src/base/combination/combo.js
+++ b/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":
diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js
index d303feeeb..2da4ee7fd 100644
--- a/src/base/combination/group.button.js
+++ b/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);
},
diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js
index 30526e973..19aa8075d 100644
--- a/src/base/single/button/button.basic.js
+++ b/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, //使能选中
diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js
index 9d84d1c81..51854f5c2 100644
--- a/src/base/single/button/buttons/button.js
+++ b/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 () {
diff --git a/src/base/single/tip/tip.tooltip.js b/src/base/single/tip/tip.tooltip.js
index 8d947f6c2..64dd0c594 100644
--- a/src/base/single/tip/tip.tooltip.js
+++ b/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,
diff --git a/src/base/table/native.scrollbar.js b/src/base/table/native.scrollbar.js
new file mode 100644
index 000000000..b584d2b3c
--- /dev/null
+++ b/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);
\ No newline at end of file
diff --git a/src/base/table/table.grid.scrollbar.js b/src/base/table/table.grid.scrollbar.js
index 6faf27cc0..7f1bcb384 100644
--- a/src/base/table/table.grid.scrollbar.js
+++ b/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) {
diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js
index 5b257f17c..7da74e5ca 100644
--- a/src/case/combo/bubblecombo/combo.bubble.js
+++ b/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());
}
});
diff --git a/src/case/combo/bubblecombo/popup.bubble.js b/src/case/combo/bubblecombo/popup.bubble.js
index 499db968e..5ab6352ba 100644
--- a/src/case/combo/bubblecombo/popup.bubble.js
+++ b/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({
diff --git a/src/case/editor/editor.adapt.js b/src/case/editor/editor.adapt.js
deleted file mode 100644
index 5a358d261..000000000
--- a/src/case/editor/editor.adapt.js
+++ /dev/null
@@ -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);
\ No newline at end of file
diff --git a/src/case/editor/editor.search.js b/src/case/editor/editor.search.js
index d952ece8b..f4f5218eb 100644
--- a/src/case/editor/editor.search.js
+++ b/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";
diff --git a/src/case/editor/editor.shelter.js b/src/case/editor/editor.shelter.js
index 6e79a6198..2990219a0 100644
--- a/src/case/editor/editor.shelter.js
+++ b/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();
diff --git a/src/case/editor/editor.sign.initial.js b/src/case/editor/editor.sign.initial.js
index 9729e217f..fd73ca179 100644
--- a/src/case/editor/editor.sign.initial.js
+++ b/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, {
diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js
index cad205dce..13e39bc73 100644
--- a/src/case/editor/editor.sign.js
+++ b/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);
},
diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js
index 0f2581fad..129bd274b 100644
--- a/src/case/editor/editor.state.js
+++ b/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)) {
diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js
index 522f1c740..f343a8cda 100644
--- a/src/case/editor/editor.state.simple.js
+++ b/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, {
diff --git a/src/case/editor/editor.text.js b/src/case/editor/editor.text.js
index 4d8abd7d3..ad8cc8789 100644
--- a/src/case/editor/editor.text.js
+++ b/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);
diff --git a/src/case/layer/pane.list.js b/src/case/layer/pane.list.js
index b7faf2758..fcedfc8b3 100644
--- a/src/case/layer/pane.list.js
+++ b/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方法
diff --git a/src/case/loader/sort.list.js b/src/case/loader/sort.list.js
index 333d54691..776434140 100644
--- a/src/case/loader/sort.list.js
+++ b/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({
diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js
index 6f4c2f90b..5f66a31ab 100644
--- a/src/case/trigger/trigger.text.select.js
+++ b/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);
}
},
diff --git a/src/case/zclip/zclip.js b/src/case/zclip/zclip.js
index 64fc32f56..7a7d99132 100644
--- a/src/case/zclip/zclip.js
+++ b/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",
diff --git a/src/config.js b/src/config.js
index fa06102d0..31b55260e 100644
--- a/src/config.js
+++ b/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) {
diff --git a/src/core/base.js b/src/core/base.js
index 44711e0ad..d291ca5c7 100644
--- a/src/core/base.js
+++ b/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());
},
diff --git a/src/core/controller/controller.tooltips.js b/src/core/controller/controller.tooltips.js
index 4f0c21dc4..c470722b5 100644
--- a/src/core/controller/controller.tooltips.js
+++ b/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
});
},
diff --git a/src/core/controller/router.floatbox.js b/src/core/controller/router.floatbox.js
index 7880caa3e..1076b0424 100644
--- a/src/core/controller/router.floatbox.js
+++ b/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;
diff --git a/src/core/func/dom.js b/src/core/func/dom.js
index 95213e37c..b8c9d6505 100644
--- a/src/core/func/dom.js
+++ b/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;
}
});
\ No newline at end of file
diff --git a/src/core/func/function.js b/src/core/func/function.js
index 7d8421890..d212ba5f4 100644
--- a/src/core/func/function.js
+++ b/src/core/func/function.js
@@ -137,6 +137,9 @@ $(function () {
//获取对比颜色
getContrastColor: function (color) {
+ if (!color) {
+ return "";
+ }
if (this.isDarkColor(color)) {
return "#ffffff";
}
diff --git a/src/core/proto/date.js b/src/core/proto/date.js
index 1ae8b5959..b25c92d15 100644
--- a/src/core/proto/date.js
+++ b/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);
diff --git a/src/core/widget.js b/src/core/widget.js
index 2cd8c3b52..af3aed4ca 100644
--- a/src/core/widget.js
+++ b/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);
},
diff --git a/src/core/wrapper/layout/adapt/inline.center.js b/src/core/wrapper/layout/adapt/inline.center.js
deleted file mode 100644
index 4f3548016..000000000
--- a/src/core/wrapper/layout/adapt/inline.center.js
+++ /dev/null
@@ -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);
\ No newline at end of file
diff --git a/src/core/wrapper/layout/adapt/inline.vertical.js b/src/core/wrapper/layout/adapt/inline.vertical.js
deleted file mode 100644
index bf7eb5262..000000000
--- a/src/core/wrapper/layout/adapt/inline.vertical.js
+++ /dev/null
@@ -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);
\ No newline at end of file
diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js
deleted file mode 100644
index c95be1c2a..000000000
--- a/src/core/wrapper/layout/layout.inline.js
+++ /dev/null
@@ -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);
\ No newline at end of file
diff --git a/src/css/base/combo/popup.bubble.css b/src/css/base/combo/popup.bubble.css
index b3791009d..c1a8d419c 100644
--- a/src/css/base/combo/popup.bubble.css
+++ b/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;
-}
diff --git a/src/css/base/single/button/button.css b/src/css/base/single/button/button.css
index fbf356999..b638bcd52 100644
--- a/src/css/base/single/button/button.css
+++ b/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 {
diff --git a/src/css/base/single/editor/editor.textarea.css b/src/css/base/single/editor/editor.textarea.css
index 13e82616c..95537977a 100644
--- a/src/css/base/single/editor/editor.textarea.css
+++ b/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;
+}
diff --git a/src/css/base/table/table.grid.scrollbar.css b/src/css/base/table/table.grid.scrollbar.css
index 2fc4a1a44..9bef8681d 100644
--- a/src/css/base/table/table.grid.scrollbar.css
+++ b/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);
}
diff --git a/src/css/core/utils/common.css b/src/css/core/utils/common.css
index e370a07fb..fb4f4a575 100644
--- a/src/css/core/utils/common.css
+++ b/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;
diff --git a/src/css/resource/app.css b/src/css/resource/app.css
index a4f143180..76b863206 100644
--- a/src/css/resource/app.css
+++ b/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);
}
diff --git a/src/css/resource/background.css b/src/css/resource/background.css
index 01c016b5e..bfd6d7b48 100644
--- a/src/css/resource/background.css
+++ b/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;
diff --git a/src/css/widget/image/button/href/image.button.href.css b/src/css/widget/image/button/href/image.button.href.css
deleted file mode 100644
index cb133baf9..000000000
--- a/src/css/widget/image/button/href/image.button.href.css
+++ /dev/null
@@ -1,7 +0,0 @@
-/****添加计算宽度的--运算符直接需要space****/
-/****** common color(常用颜色,可用于普遍场景) *****/
-/**** custom color(自定义颜色,用于特定场景) ****/
-.bi-image-button-href .image-button-href-icon-button {
- z-index: 1;
- font-size: 16px;
-}
diff --git a/src/css/widget/image/button/size/image.button.size.css b/src/css/widget/image/button/size/image.button.size.css
deleted file mode 100644
index 316d4f333..000000000
--- a/src/css/widget/image/button/size/image.button.size.css
+++ /dev/null
@@ -1,6 +0,0 @@
-/****添加计算宽度的--运算符直接需要space****/
-/****** common color(常用颜色,可用于普遍场景) *****/
-/**** custom color(自定义颜色,用于特定场景) ****/
-.bi-image-button-size .image-button-size-button-group {
- font-size: 12px;
-}
diff --git a/src/css/widget/image/uploadimage.css b/src/css/widget/image/uploadimage.css
deleted file mode 100644
index a2e1933cd..000000000
--- a/src/css/widget/image/uploadimage.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/****添加计算宽度的--运算符直接需要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;
-}
diff --git a/src/css/widget/previewtable/previewtable.css b/src/css/widget/previewtable/previewtable.css
index 3a12fc376..676a963ad 100644
--- a/src/css/widget/previewtable/previewtable.css
+++ b/src/css/widget/previewtable/previewtable.css
@@ -1,6 +1,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;
diff --git a/src/less/base/combo/popup.bubble.less b/src/less/base/combo/popup.bubble.less
index 6c5ec1313..4a6a7c469 100644
--- a/src/less/base/combo/popup.bubble.less
+++ b/src/less/base/combo/popup.bubble.less
@@ -1,8 +1,5 @@
@import "../../bibase";
.bi-bubble-popup-view {
- & .bubble-popup-line {
- background-color: @color-bi-background-highlight;
- }
.box-shadow(0 0 10px, rgba(0, 0, 0, 0.2));
}
\ No newline at end of file
diff --git a/src/less/base/single/button/button.less b/src/less/base/single/button/button.less
index 8602d52a7..91008e30e 100644
--- a/src/less/base/single/button/button.less
+++ b/src/less/base/single/button/button.less
@@ -8,62 +8,104 @@
vertical-align: middle;
cursor: pointer;
font-size: 14px;
+ &.block {
+ font-size: inherit;
+ border-width: 0;
+ .border-radius(0px);
+ }
+ &.clear {
+ font-size: inherit;
+ border-width: 0;
+ background-color: transparent;
+ &:hover, &:active {
+ .opacity(0.75);
+ }
+ }
&.button-common {
- &, & .b-font {
+ &, & .b-font:before {
color: @color-bi-text;
}
- & .b-font:before {
- color: @color-bi-text;
+ &.clear, &.clear .b-font:before {
+ color: @color-bi-text-highlight;
}
}
&.button-ignore {
- &, & .b-font {
- color: @color-bi-text-black;
+ & {
+ &, & .b-font:before {
+ color: @color-bi-text-black;
+ }
+ background-color: @color-bi-background-default;
+ border-color: @color-bi-border-line;
+ }
+ &.clear {
+ background-color: transparent;
+ border-width: 0;
}
- background-color: @color-bi-background-default;
- border-color: @color-bi-split-dark;
}
&.button-success {
- &, & .b-font {
- color: @color-bi-text;
+ & {
+ &, & .b-font:before {
+ color: @color-bi-text;
+ }
+ background-color: @color-bi-background-success;
+ border-color: @color-bi-border-success;
}
- background-color: @color-bi-background-success;
- border-color: @color-bi-border-success;
- & .b-font:before {
- color: @color-bi-text;
+ &.clear {
+ &, & .b-font:before {
+ color: @color-bi-text-success;
+ }
+ background-color: transparent;
+ border-width: 0;
}
}
&.button-warning {
- &, & .b-font {
- color: @color-bi-text;
+ & {
+ &, & .b-font:before {
+ color: @color-bi-text;
+ }
+ background-color: @color-bi-background-delete;
+ border-color: @color-bi-border-delete;
}
- background-color: @color-bi-background-delete;
- border-color: @color-bi-border-delete;
- & .b-font:before {
- color: @color-bi-text;
+ &.clear {
+ &, & .b-font:before {
+ color: @color-bi-text-warning;
+ }
+ background-color: transparent;
+ border-width: 0;
}
}
&.button-common.disabled,
&.button-success.disabled,
&.button-warning.disabled {
- &, & .b-font {
- color: @color-bi-text !important;
- }
- & .b-font:before {
- color: @color-bi-text !important;
+ &, &.base-disabled {
+ &, & .b-font:before {
+ color: @color-bi-text !important;
+ }
+ background: @color-bi-background-disabled !important;
+ border-color: @color-bi-border-disabled !important;
}
- background: @color-bi-background-disabled !important;
- border-color: @color-bi-split-disabled !important;
}
&.button-ignore.disabled {
- &, & .b-font {
- color: @color-bi-text-disabled !important;
- }
- & .b-font:before {
+ &, & .b-font:before {
color: @color-bi-text-disabled !important;
}
background: @color-bi-background-default !important;
- border-color: @color-bi-split-dark !important;
+ border-color: @color-bi-border-line !important;
+ }
+ &.button-common.disabled,
+ &.button-success.disabled,
+ &.button-warning.disabled,
+ &.button-ignore.disabled {
+ &.clear {
+ &, & .b-font:before {
+ color: @color-bi-text-disabled !important;
+ }
+ background: transparent !important;
+ border-width: 0 !important;
+ &:hover, &:active {
+ .opacity(1);
+ }
+ }
}
}
diff --git a/src/less/base/single/editor/editor.textarea.less b/src/less/base/single/editor/editor.textarea.less
index ce6b01357..452595970 100644
--- a/src/less/base/single/editor/editor.textarea.less
+++ b/src/less/base/single/editor/editor.textarea.less
@@ -7,5 +7,18 @@
& {
border: none;
}
+ &.textarea-editor-focus{
+ border: 1px solid @color-bi-border-line;
+ }
+ }
+}
+
+.bi-theme-dark{
+ .bi-textarea-editor {
+ & .textarea-editor-content {
+ &.textarea-editor-focus{
+ border: 1px solid @color-bi-border-line-theme-dark;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/less/base/table/table.grid.scrollbar.less b/src/less/base/table/table.grid.scrollbar.less
index 950bf8b2f..ae6ba22f8 100644
--- a/src/less/base/table/table.grid.scrollbar.less
+++ b/src/less/base/table/table.grid.scrollbar.less
@@ -126,14 +126,14 @@
.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(@scroll-color, 70%);
}
.bi-theme-dark {
.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(@scroll-color-theme-dark, 70%);
}
}
diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less
index e02726723..221796870 100644
--- a/src/less/core/utils/common.less
+++ b/src/less/core/utils/common.less
@@ -132,6 +132,10 @@
color: @color-bi-text;
}
+.bi-high-light-border {
+ border-color: @color-bi-border-highlight;
+}
+
//水印
.bi-water-mark {
color: @water-mark-color;
@@ -157,9 +161,21 @@
}
}
+.bi-mask {
+ color: @color-bi-background-default;
+ .background-color(@color-bi-background-black, 20%);
+}
+
+.bi-theme-dark {
+ .bi-mask {
+ color: @color-bi-background-default-theme-dark;
+ .background-color(@color-bi-background-default, 20%);
+ }
+}
+
.bi-z-index-mask {
color: @color-bi-background-default;
- .background-color(@color-bi-background-black, 50%);
+ .background-color(@color-bi-background-black, 30%);
}
//只有背景变化
@@ -197,6 +213,12 @@
}
}
+.bi-list-item-border {
+ &:active, &.active {
+ border: 1px solid @color-bi-border-highlight;
+ }
+}
+
//极简
.bi-list-item-simple {
color: @color-bi-text-tips;
@@ -294,6 +316,49 @@
}
}
+//文字和背景hover和active时变化
+.bi-list-item-active2 {
+ &:hover, &.hover {
+ color: @color-bi-text-black;
+ background-color: @color-bi-background-default;
+ }
+ &.active, &:active {
+ color: @color-bi-text-highlight;
+ background-color: @color-bi-background-default;
+ }
+ &.disabled {
+ &, &:hover, &:active {
+ background-color: transparent !important;
+ color: @color-bi-text-disabled !important;
+ & .bi-high-light {
+ color: @color-bi-text-disabled !important;
+ }
+ }
+ }
+}
+
+.bi-theme-dark {
+ .bi-list-item-active2 {
+ &:hover, &.hover {
+ color: @color-bi-text;
+ background-color: @color-bi-background-default-theme-dark;
+ }
+ &.active, &:active {
+ color: @color-bi-text-highlight;
+ background-color: @color-bi-background-default-theme-dark;
+ }
+ &.disabled {
+ &, &:hover, &:active {
+ background-color: transparent !important;
+ color: @color-bi-text-disabled-theme-dark !important;
+ & .bi-high-light {
+ color: @color-bi-text-disabled-theme-dark !important;
+ }
+ }
+ }
+ }
+}
+
//有选中效果
.bi-list-item-select {
&:hover, &.hover {
diff --git a/src/less/lib/colors.less b/src/less/lib/colors.less
index bc7c6b0cb..f69816112 100644
--- a/src/less/lib/colors.less
+++ b/src/less/lib/colors.less
@@ -60,13 +60,6 @@
@color-bi-background-virtual-blue: @background-color-virtual-blue;
-//深灰色分割线
-@color-bi-split-dark: @split-color-dark;
-//浅灰色分割线
-@color-bi-split-light: @split-color-light;
-//灰化分割线
-@color-bi-split-disabled: @split-color-disabled;
-
//黑色边框色
@color-bi-border-black: @border-color-black;
//默认边框色
@@ -77,6 +70,8 @@
@color-bi-border-line: @border-color-line;
//深色系边框线色
@color-bi-border-line-theme-dark: @border-color-line-theme-dark;
+//灰化分割线
+@color-bi-border-disabled: @border-color-disabled;
//成功边框色
@color-bi-border-success: @border-color-success;
//失败边框色
@@ -107,56 +102,5 @@
//失败边框
@color-bi-tooltip-warning-border: @border-color-error;
-//dimension
-@color-dimension-background: @background-color-light-blue;
-@color-target-background: @background-color-light-green;
-@color-dimension-region-border: @border-color-light-blue;
-@color-target-region-border: @border-color-light-green;
-@color-dimension-background-theme-dark: @background-color-light-blue-theme-dark;
-@color-target-background-theme-dark: @background-color-light-green-theme-dark;
-@color-dimension-region-border-theme-dark: @border-color-light-blue-theme-dark;
-@color-target-region-border-theme-dark: @border-color-light-green-theme-dark;
-
-//etl operator
-@color-etl-operator: @background-color-light-blue;
-
-//data source table, etl table, excel table, sql table
-@color-table-active-background: @background-color-light-blue;
-
-//join union 表格的间隔色
-@color-table-result-background: @table-color-blue;
-@color-table-background1: @table-color-yellow;
-@color-table-background2: @table-color-green;
-@color-table-background3: @table-color-light-blue;
-@color-table-background4: @table-color-purple;
-@color-table-background5: @table-color-pink;
-
-//我创建的
-@color-create-file-text: @font-color-orange;
-
-@color-target-style-condition-background: @background-color-light-blue;
-@color-target-style-condition-border: @border-color-light-blue;
-
-@color-target-style-less: @background-color-negative;
-@color-target-style-equal: @background-color-yellow;
-@color-target-style-more: @background-color-dark-success;
-
-@color-login-info-fields-group-background: @background-color-light-blue;
//mask颜色
@color-bi-button-mask: @color-bi-background-black;
-
-// 数据连接底色 10种 --start--
-@color-bi-data-link-button-color1: @data-link-color1;
-@color-bi-data-link-button-color2: @data-link-color2;
-@color-bi-data-link-button-color3: @data-link-color3;
-@color-bi-data-link-button-color4: @data-link-color4;
-@color-bi-data-link-button-color5: @data-link-color5;
-@color-bi-data-link-button-color6: @data-link-color6;
-@color-bi-data-link-button-color7: @data-link-color7;
-@color-bi-data-link-button-color8: @data-link-color8;
-@color-bi-data-link-button-color9: @data-link-color9;
-@color-bi-data-link-button-color10: @data-link-color10;
-// 数据连接底色 10种 --end--
-
-@color-bi-progress-text-bar-background: @border-color-light-green;
-@color-bi-progress-text-bar-processor: @border-color-success;
diff --git a/src/less/lib/constant.less b/src/less/lib/constant.less
index 71f7758a5..81c5fa713 100644
--- a/src/less/lib/constant.less
+++ b/src/less/lib/constant.less
@@ -41,11 +41,6 @@
@background-color-dark: #d4dadd;
@background-color-disabled: #cccccc;
-@background-color-light-blue: #d8f2fd;//
-@background-color-light-green: #e1f4e7;//
-@background-color-light-blue-theme-dark: #008ae9;//
-@background-color-light-green-theme-dark: #04b1c2;//
-
@background-color-orange: #fef6de;
@background-color-green: #eefbff;
@background-color-yellow: #f9a744;
@@ -73,12 +68,8 @@
@border-color-error: #f4cbcb;
@border-color-normal-success: #eddea2;
-@border-color-light-blue: #d8f2fd;//
-@border-color-light-green: #e1f4e7;//
-@border-color-light-blue-theme-dark: #008ae9;//
-@border-color-light-green-theme-dark: #04b1c2;//
-
-@border-color-dark: #c4c6c6;
+//split color
+@border-color-disabled: #cccccc;
//scroll color
@scroll-color: #666666;
@@ -87,29 +78,6 @@
@water-mark-color: #cccccc;
@water-mark-color-theme-dark: #666666;
-//split color
-@split-color-light: #eaeaea;
-@split-color-dark: #d4dadd;
-@split-color-disabled: #c4c6c6;
//shadow color
@shadow-color-black: #000000;
-
-//表格的间隔色
-@table-color-blue: #d9f2fc;
-@table-color-yellow: #fef6df;
-@table-color-green: #daf3dc;
-@table-color-light-blue: #d6f7f0;
-@table-color-purple: #e8e6fe;
-@table-color-pink: #fee9e9;
-
-@data-link-color1: #009de3;
-@data-link-color2: #4fc1e9;
-@data-link-color3: #48cfad;
-@data-link-color4: #57cb7c;
-@data-link-color5: #a0d468;
-@data-link-color6: #fbaf4f;
-@data-link-color7: #fc6e51;
-@data-link-color8: #ed5565;
-@data-link-color9: #ac92ec;
-@data-link-color10: #5d9cec;
\ No newline at end of file
diff --git a/src/less/resource/app.less b/src/less/resource/app.less
index ab03dc43b..2d73ca063 100644
--- a/src/less/resource/app.less
+++ b/src/less/resource/app.less
@@ -2,7 +2,7 @@
@font-face {
font-family: 'bi';
- src: url('@{webUrl}font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
+ src: url('@{webUrl}font/iconfont.eot'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
}
.b-font {
@@ -47,27 +47,19 @@ body {
outline: 0 none;
}
-#wrapper {
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- overflow: hidden;
- overflow-x: hidden;
- overflow-y: hidden;
-}
-
div, textarea {
&::-webkit-scrollbar {
-webkit-appearance: none;
- background-color: @scroll-color;
+ .background-color(@scroll-color, 5%);
width: 6px;
height: 6px;
}
&::-webkit-scrollbar-thumb {
.border-radius(0);
- background-color: @scroll-thumb-color;
+ .background-color(@scroll-color, 30%);
+ &:hover {
+ .background-color(@scroll-color, 70%);
+ }
}
}
@@ -75,13 +67,16 @@ div, textarea {
div, textarea {
&::-webkit-scrollbar {
-webkit-appearance: none;
- background-color: @scroll-color-theme-dark;
+ .background-color(@scroll-color-theme-dark, 5%);
width: 6px;
height: 6px;
}
&::-webkit-scrollbar-thumb {
.border-radius(0);
- background-color: @scroll-thumb-color-theme-dark;
+ .background-color(@scroll-color-theme-dark, 30%);
+ &:hover {
+ .background-color(@scroll-color-theme-dark, 70%);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/less/resource/background.less b/src/less/resource/background.less
index 76565b817..eb14dc752 100644
--- a/src/less/resource/background.less
+++ b/src/less/resource/background.less
@@ -17,7 +17,7 @@
}
.bi-theme-dark{
- .base-line-conn-background {
+ .first-line-conn-background {
.imagePath(@icon-tree-vertical-line-2-theme-dark);
}
}
@@ -27,7 +27,7 @@
}
.bi-theme-dark{
- .base-line-conn-background {
+ .mid-line-conn-background {
.imagePath(@icon-tree-vertical-line-3-theme-dark);
}
}
@@ -37,7 +37,7 @@
}
.bi-theme-dark{
- .base-line-conn-background {
+ .last-line-conn-background {
.imagePath(@icon-tree-vertical-line-4-theme-dark);
}
}
diff --git a/src/less/widget/previewtable/previewtable.less b/src/less/widget/previewtable/previewtable.less
index a79308804..b5a5fdee5 100644
--- a/src/less/widget/previewtable/previewtable.less
+++ b/src/less/widget/previewtable/previewtable.less
@@ -1,6 +1,7 @@
@import "../../bibase";
.bi-preview-table {
+ .user-select(initial);
& > div > table, & > div > div > div > table {
& > thead > tr.odd {
background-color: @color-bi-background-normal;
diff --git a/src/widget/arrangement/arrangement.block.js b/src/widget/arrangement/arrangement.block.js
index f2e983370..fc6a43d82 100644
--- a/src/widget/arrangement/arrangement.block.js
+++ b/src/widget/arrangement/arrangement.block.js
@@ -9,7 +9,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"
});
},
diff --git a/src/widget/date/trigger.date.js b/src/widget/date/trigger.date.js
index 3a1aeb687..8d746bbd1 100644
--- a/src/widget/date/trigger.date.js
+++ b/src/widget/date/trigger.date.js
@@ -60,7 +60,7 @@ BI.DateTrigger = BI.inherit(BI.Trigger, {
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);
}
diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js
index b687714b5..f369f42a3 100644
--- a/src/widget/multiselect/multiselect.combo.js
+++ b/src/widget/multiselect/multiselect.combo.js
@@ -328,7 +328,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 () {
diff --git a/src/widget/numericalinterval/numericalinterval.js b/src/widget/numericalinterval/numericalinterval.js
index 4b523db48..e02ed03b5 100644
--- a/src/widget/numericalinterval/numericalinterval.js
+++ b/src/widget/numericalinterval/numericalinterval.js
@@ -31,7 +31,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,
@@ -68,7 +68,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,
@@ -295,7 +295,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:
@@ -321,7 +321,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);
@@ -343,7 +343,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"
@@ -355,7 +355,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, {
@@ -378,7 +378,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, {
diff --git a/src/widget/pagetable/pagetable.js b/src/widget/pagetable/pagetable.js
index 87ea99a45..a609728f5 100644
--- a/src/widget/pagetable/pagetable.js
+++ b/src/widget/pagetable/pagetable.js
@@ -243,6 +243,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();
},
diff --git a/src/widget/sequencetable/listnumber.sequencetable.js b/src/widget/sequencetable/listnumber.sequencetable.js
index a411127fe..bab51144a 100644
--- a/src/widget/sequencetable/listnumber.sequencetable.js
+++ b/src/widget/sequencetable/listnumber.sequencetable.js
@@ -61,6 +61,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
}]
@@ -70,17 +73,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 () {
@@ -189,7 +198,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) {
+
+ }
}
},
diff --git a/src/widget/sequencetable/sequencetable.js b/src/widget/sequencetable/sequencetable.js
index bfb4bc463..52adfdd93 100644
--- a/src/widget/sequencetable/sequencetable.js
+++ b/src/widget/sequencetable/sequencetable.js
@@ -195,6 +195,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);
diff --git a/src/widget/sequencetable/treenumber.sequencetable.js b/src/widget/sequencetable/treenumber.sequencetable.js
index 8c26902e6..d1ae137dc 100644
--- a/src/widget/sequencetable/treenumber.sequencetable.js
+++ b/src/widget/sequencetable/treenumber.sequencetable.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) {
+
+ }
}
},
diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js
index e7ab93c22..38cd15fa6 100644
--- a/src/widget/year/trigger.year.js
+++ b/src/widget/year/trigger.year.js
@@ -53,7 +53,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();