You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.1 KiB
90 lines
2.1 KiB
/**
|
|
* 图表展示窗口
|
|
*/
|
|
define(function (require, exports, module) {
|
|
var Window = require('../window/window');
|
|
var tpl = require('./chartwindow.tpl');
|
|
var echarts = require('vendor/echarts/echarts.min');
|
|
var self = null;
|
|
require('./chartwindow.css');
|
|
|
|
function ChartWindow(args) {
|
|
self = this;
|
|
this.options = {
|
|
title: '参照窗体',
|
|
content: tpl,
|
|
width: 800,
|
|
height: 600,
|
|
top: 100,
|
|
modal: true,
|
|
closed: true,
|
|
closable: true,
|
|
minimizable: false,
|
|
maximizable: false,
|
|
collapsible: false,
|
|
resizable: false,
|
|
draggable: true,
|
|
data: null,
|
|
onBeforeClose: function() {
|
|
if (!self.selectItem && self.args.callback) {
|
|
}
|
|
}
|
|
}
|
|
|
|
this.args = args;
|
|
|
|
Window.call(this, this.options);
|
|
}
|
|
|
|
inherits(ChartWindow, Window);
|
|
|
|
ChartWindow.prototype.init = function() {
|
|
|
|
};
|
|
|
|
/**
|
|
* 添加图表
|
|
* @param {object} chart 图表对象包含图表类型与对应的option
|
|
*/
|
|
ChartWindow.prototype.addChart = function(chart) {
|
|
var guid = createGuid(),
|
|
container = self.getElement('.fdpr-rpt-chart-show-container'),
|
|
className = null,
|
|
chartObj = null;
|
|
|
|
switch (chart.type) {
|
|
case 'barchart':
|
|
className = 'bar-chart' + guid;
|
|
break;
|
|
case 'linechart':
|
|
className = 'line-chart' + guid;
|
|
break;
|
|
case 'areachart':
|
|
className = 'area-chart' + guid;
|
|
break;
|
|
case 'piechart':
|
|
className = 'pie-chart' + guid;
|
|
break;
|
|
case 'barlinechart':
|
|
className = 'bar-line-chart' + guid;
|
|
break;
|
|
}
|
|
|
|
container.append('<div class="'+ className +'" style="width: 100%;height: 600px;"></div>');
|
|
chartObj = echarts.init(self.getElement('.' + className)[0]);
|
|
chartObj.setOption(chart.option);
|
|
};
|
|
|
|
ChartWindow.prototype.open = function() {
|
|
Window.prototype.open.call(self);
|
|
};
|
|
|
|
ChartWindow.prototype.customerize = function() {
|
|
for (var i = 0; i < self.args.length; i++) {
|
|
self.addChart(self.args[i]);
|
|
}
|
|
};
|
|
|
|
return ChartWindow;
|
|
|
|
}) |