|
|
@ -0,0 +1,312 @@
|
|||
/**
|
||||
* [Chart.PieceLabel.js]{@link https://github.com/emn178/Chart.PieceLabel.js}
|
||||
*
|
||||
* @version 0.9.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2017
|
||||
* @license MIT
|
||||
*/
|
||||
(function () {
|
||||
if (typeof Chart === 'undefined') {
|
||||
console.warn('Can not find Chart object.');
|
||||
return;
|
||||
}
|
||||
|
||||
function PieceLabel() {
|
||||
this.drawDataset = this.drawDataset.bind(this);
|
||||
}
|
||||
|
||||
PieceLabel.prototype.beforeDatasetsUpdate = function (chartInstance) {
|
||||
if (this.parseOptions(chartInstance) && this.position === 'outside') {
|
||||
var padding = this.fontSize * 1.5 + 2;
|
||||
chartInstance.chartArea.top += padding;
|
||||
chartInstance.chartArea.bottom -= padding;
|
||||
}
|
||||
};
|
||||
|
||||
PieceLabel.prototype.afterDatasetsDraw = function (chartInstance) {
|
||||
if (!this.parseOptions(chartInstance)) {
|
||||
return;
|
||||
}
|
||||
this.labelBounds = [];
|
||||
chartInstance.config.data.datasets.forEach(this.drawDataset);
|
||||
};
|
||||
|
||||
PieceLabel.prototype.drawDataset = function (dataset) {
|
||||
var ctx = this.ctx;
|
||||
var chartInstance = this.chartInstance;
|
||||
var meta = dataset._meta[Object.keys(dataset._meta)[0]];
|
||||
var totalPercentage = 0;
|
||||
for (var i = 0; i < meta.data.length; i++) {
|
||||
var element = meta.data[i],
|
||||
view = element._view, text;
|
||||
|
||||
//Skips label creation if value is zero and showZero is set
|
||||
if (view.circumference === 0 && !this.showZero) {
|
||||
continue;
|
||||
}
|
||||
switch (this.render) {
|
||||
case 'value':
|
||||
var value = dataset.data[i];
|
||||
if (this.format) {
|
||||
value = this.format(value);
|
||||
}
|
||||
text = value.toString();
|
||||
break;
|
||||
case 'label':
|
||||
text = chartInstance.config.data.labels[i];
|
||||
break;
|
||||
case 'image':
|
||||
text = this.images[i] ? this.loadImage(this.images[i]) : '';
|
||||
break;
|
||||
case 'percentage':
|
||||
default:
|
||||
var percentage = view.circumference / this.options.circumference * 100;
|
||||
percentage = parseFloat(percentage.toFixed(this.precision));
|
||||
if (!this.showActualPercentages) {
|
||||
totalPercentage += percentage;
|
||||
if (totalPercentage > 100) {
|
||||
percentage -= totalPercentage - 100;
|
||||
// After adjusting the percentage, need to trim the numbers after decimal points again, otherwise it may not show
|
||||
// on chart due to very long number after decimal point.
|
||||
percentage = parseFloat(percentage.toFixed(this.precision));
|
||||
}
|
||||
}
|
||||
text = percentage + '%';
|
||||
break;
|
||||
}
|
||||
if (typeof this.render === 'function') {
|
||||
text = this.render({
|
||||
label: chartInstance.config.data.labels[i],
|
||||
value: dataset.data[i],
|
||||
percentage: percentage,
|
||||
dataset: dataset,
|
||||
index: i
|
||||
});
|
||||
|
||||
if (typeof text === 'object') {
|
||||
text = this.loadImage(text);
|
||||
}
|
||||
}
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.font = Chart.helpers.fontString(this.fontSize, this.fontStyle, this.fontFamily);
|
||||
var position, innerRadius, arcOffset;
|
||||
if (this.position === 'outside' ||
|
||||
this.position === 'border' && chartInstance.config.type === 'pie') {
|
||||
innerRadius = view.outerRadius / 2;
|
||||
var rangeFromCentre, offset = this.fontSize + 2,
|
||||
centreAngle = view.startAngle + ((view.endAngle - view.startAngle) / 2);
|
||||
if (this.position === 'border') {
|
||||
rangeFromCentre = (view.outerRadius - innerRadius) / 2 + innerRadius;
|
||||
} else if (this.position === 'outside') {
|
||||
rangeFromCentre = (view.outerRadius - innerRadius) + innerRadius + offset;
|
||||
}
|
||||
position = {
|
||||
x: view.x + (Math.cos(centreAngle) * rangeFromCentre),
|
||||
y: view.y + (Math.sin(centreAngle) * rangeFromCentre)
|
||||
};
|
||||
if (this.position === 'outside') {
|
||||
if (position.x < view.x) {
|
||||
position.x -= offset;
|
||||
} else {
|
||||
position.x += offset;
|
||||
}
|
||||
arcOffset = view.outerRadius + offset;
|
||||
}
|
||||
} else {
|
||||
innerRadius = view.innerRadius;
|
||||
position = element.tooltipPosition();
|
||||
}
|
||||
|
||||
var fontColor = this.fontColor;
|
||||
if (typeof fontColor === 'function') {
|
||||
fontColor = fontColor({
|
||||
label: chartInstance.config.data.labels[i],
|
||||
value: dataset.data[i],
|
||||
percentage: percentage,
|
||||
text: text,
|
||||
backgroundColor: dataset.backgroundColor[i],
|
||||
dataset: dataset,
|
||||
index: i
|
||||
});
|
||||
} else if (typeof fontColor !== 'string') {
|
||||
fontColor = fontColor[i] || this.options.defaultFontColor;
|
||||
}
|
||||
if (this.arc) {
|
||||
if (!arcOffset) {
|
||||
arcOffset = (innerRadius + view.outerRadius) / 2;
|
||||
}
|
||||
ctx.fillStyle = fontColor;
|
||||
ctx.textBaseline = 'middle';
|
||||
this.drawArcText(text, arcOffset, view, this.overlap);
|
||||
} else {
|
||||
var drawable, mertrics = this.measureText(text),
|
||||
left = position.x - mertrics.width / 2,
|
||||
right = position.x + mertrics.width / 2,
|
||||
top = position.y - this.fontSize / 2,
|
||||
bottom = position.y + this.fontSize / 2;
|
||||
if (this.overlap) {
|
||||
drawable = true;
|
||||
} else if (this.position === 'outside') {
|
||||
drawable = this.checkTextBound(left, right, top, bottom);
|
||||
} else {
|
||||
drawable = element.inRange(left, top) && element.inRange(left, bottom) &&
|
||||
element.inRange(right, top) && element.inRange(right, bottom);
|
||||
}
|
||||
if (drawable) {
|
||||
this.fillText(text, position, fontColor);
|
||||
}
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
};
|
||||
|
||||
PieceLabel.prototype.parseOptions = function (chartInstance) {
|
||||
var pieceLabel = chartInstance.options.pieceLabel;
|
||||
if (pieceLabel) {
|
||||
this.chartInstance = chartInstance;
|
||||
this.ctx = chartInstance.chart.ctx;
|
||||
this.options = chartInstance.config.options;
|
||||
this.render = pieceLabel.render || pieceLabel.mode;
|
||||
this.position = pieceLabel.position || 'default';
|
||||
this.arc = pieceLabel.arc;
|
||||
this.format = pieceLabel.format;
|
||||
this.precision = pieceLabel.precision || 0;
|
||||
this.fontSize = pieceLabel.fontSize || this.options.defaultFontSize;
|
||||
this.fontColor = pieceLabel.fontColor || this.options.defaultFontColor;
|
||||
this.fontStyle = pieceLabel.fontStyle || this.options.defaultFontStyle;
|
||||
this.fontFamily = pieceLabel.fontFamily || this.options.defaultFontFamily;
|
||||
this.hasTooltip = chartInstance.tooltip._active && chartInstance.tooltip._active.length;
|
||||
this.showZero = pieceLabel.showZero;
|
||||
this.overlap = pieceLabel.overlap;
|
||||
this.images = pieceLabel.images || [];
|
||||
this.showActualPercentages = pieceLabel.showActualPercentages || false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
PieceLabel.prototype.checkTextBound = function (left, right, top, bottom) {
|
||||
var labelBounds = this.labelBounds;
|
||||
for (var i = 0;i < labelBounds.length;++i) {
|
||||
var bound = labelBounds[i];
|
||||
var potins = [
|
||||
[left, top],
|
||||
[left, bottom],
|
||||
[right, top],
|
||||
[right, bottom]
|
||||
];
|
||||
for (var j = 0;j < potins.length;++j) {
|
||||
var x = potins[j][0];
|
||||
var y = potins[j][1];
|
||||
if (x >= bound.left && x <= bound.right && y >= bound.top && y <= bound.bottom) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
potins = [
|
||||
[bound.left, bound.top],
|
||||
[bound.left, bound.bottom],
|
||||
[bound.right, bound.top],
|
||||
[bound.right, bound.bottom]
|
||||
];
|
||||
for (var j = 0;j < potins.length;++j) {
|
||||
var x = potins[j][0];
|
||||
var y = potins[j][1];
|
||||
if (x >= left && x <= right && y >= top && y <= bottom) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
labelBounds.push({
|
||||
left: left,
|
||||
right: right,
|
||||
top: top,
|
||||
bottom: bottom
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
PieceLabel.prototype.measureText = function (text) {
|
||||
if (typeof text === 'object') {
|
||||
return { width: text.width, height: text.height };
|
||||
} else {
|
||||
return this.ctx.measureText(text);
|
||||
}
|
||||
};
|
||||
|
||||
PieceLabel.prototype.fillText = function (text, position, fontColor) {
|
||||
var ctx = this.ctx;
|
||||
if (typeof text === 'object') {
|
||||
ctx.drawImage(text, position.x - text.width / 2, position.y - text.height / 2, text.width, text.height);
|
||||
} else {
|
||||
ctx.fillStyle = fontColor;
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(text, position.x, position.y - this.fontSize / 2);
|
||||
}
|
||||
};
|
||||
|
||||
PieceLabel.prototype.loadImage = function (obj) {
|
||||
var image = new Image();
|
||||
image.src = obj.src;
|
||||
image.width = obj.width;
|
||||
image.height = obj.height;
|
||||
return image;
|
||||
};
|
||||
|
||||
PieceLabel.prototype.drawArcText = function (str, radius, view, overlap) {
|
||||
var ctx = this.ctx,
|
||||
centerX = view.x,
|
||||
centerY = view.y,
|
||||
startAngle = view.startAngle,
|
||||
endAngle = view.endAngle;
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(centerX, centerY);
|
||||
var angleSize = endAngle - startAngle;
|
||||
startAngle += Math.PI / 2;
|
||||
endAngle += Math.PI / 2;
|
||||
var origStartAngle = startAngle;
|
||||
var mertrics = this.measureText(str);
|
||||
startAngle += (endAngle - (mertrics.width / radius + startAngle)) / 2;
|
||||
if (!overlap && endAngle - startAngle > angleSize) {
|
||||
ctx.restore();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof str === 'string') {
|
||||
ctx.rotate(startAngle);
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var char = str.charAt(i);
|
||||
mertrics = ctx.measureText(char);
|
||||
ctx.save();
|
||||
ctx.translate(0, -1 * radius);
|
||||
ctx.fillText(char, 0, 0);
|
||||
ctx.restore();
|
||||
ctx.rotate(mertrics.width / radius);
|
||||
}
|
||||
} else {
|
||||
ctx.rotate((origStartAngle + endAngle) / 2);
|
||||
ctx.translate(0, -1 * radius);
|
||||
this.fillText(str, { x: 0, y: 0 });
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
Chart.pluginService.register({
|
||||
beforeInit: function(chartInstance) {
|
||||
chartInstance.pieceLabel = new PieceLabel();
|
||||
},
|
||||
beforeDatasetsUpdate: function (chartInstance) {
|
||||
chartInstance.pieceLabel.beforeDatasetsUpdate(chartInstance);
|
||||
},
|
||||
afterDatasetsDraw: function (chartInstance) {
|
||||
chartInstance.pieceLabel.afterDatasetsDraw(chartInstance);
|
||||
}
|
||||
});
|
||||
})();
|
||||
1
infosouth-admin/src/main/resources/static/oneself/chartjs/Chart.roundedBarCharts.min.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Chart.elements.Rectangle.prototype.draw=function(){function t(t){return s[(f+t)%4]}var r,e,i,o,_,h,l,a,b=this._chart.ctx,d=this._view,n=d.borderWidth,u=this._chart.config.options.cornerRadius;if(u<0&&(u=0),void 0===u&&(u=0),d.horizontal?(r=d.base,e=d.x,i=d.y-d.height/2,o=d.y+d.height/2,_=e>r?1:-1,h=1,l=d.borderSkipped||"left"):(r=d.x-d.width/2,e=d.x+d.width/2,i=d.y,_=1,h=(o=d.base)>i?1:-1,l=d.borderSkipped||"bottom"),n){var T=Math.min(Math.abs(r-e),Math.abs(i-o)),v=(n=n>T?T:n)/2,g=r+("left"!==l?v*_:0),c=e+("right"!==l?-v*_:0),C=i+("top"!==l?v*h:0),w=o+("bottom"!==l?-v*h:0);g!==c&&(i=C,o=w),C!==w&&(r=g,e=c)}b.beginPath(),b.fillStyle=d.backgroundColor,b.strokeStyle=d.borderColor,b.lineWidth=n;var s=[[r,o],[r,i],[e,i],[e,o]],f=["bottom","left","top","right"].indexOf(l,0);-1===f&&(f=0);var q=t(0);b.moveTo(q[0],q[1]);for(var m=1;m<4;m++)q=t(m),nextCornerId=m+1,4==nextCornerId&&(nextCornerId=0),nextCorner=t(nextCornerId),width=s[2][0]-s[1][0],height=s[0][1]-s[1][1],x=s[1][0],y=s[1][1],(a=u)>Math.abs(height)/2&&(a=Math.floor(Math.abs(height)/2)),a>Math.abs(width)/2&&(a=Math.floor(Math.abs(width)/2)),height<0?(x_tl=x,x_tr=x+width,y_tl=y+height,y_tr=y+height,x_bl=x,x_br=x+width,y_bl=y,y_br=y,b.moveTo(x_bl+a,y_bl),b.lineTo(x_br-a,y_br),b.quadraticCurveTo(x_br,y_br,x_br,y_br-a),b.lineTo(x_tr,y_tr+a),b.quadraticCurveTo(x_tr,y_tr,x_tr-a,y_tr),b.lineTo(x_tl+a,y_tl),b.quadraticCurveTo(x_tl,y_tl,x_tl,y_tl+a),b.lineTo(x_bl,y_bl-a),b.quadraticCurveTo(x_bl,y_bl,x_bl+a,y_bl)):width<0?(x_tl=x+width,x_tr=x,y_tl=y,y_tr=y,x_bl=x+width,x_br=x,y_bl=y+height,y_br=y+height,b.moveTo(x_bl+a,y_bl),b.lineTo(x_br-a,y_br),b.quadraticCurveTo(x_br,y_br,x_br,y_br-a),b.lineTo(x_tr,y_tr+a),b.quadraticCurveTo(x_tr,y_tr,x_tr-a,y_tr),b.lineTo(x_tl+a,y_tl),b.quadraticCurveTo(x_tl,y_tl,x_tl,y_tl+a),b.lineTo(x_bl,y_bl-a),b.quadraticCurveTo(x_bl,y_bl,x_bl+a,y_bl)):(b.moveTo(x+a,y),b.lineTo(x+width-a,y),b.quadraticCurveTo(x+width,y,x+width,y+a),b.lineTo(x+width,y+height-a),b.quadraticCurveTo(x+width,y+height,x+width-a,y+height),b.lineTo(x+a,y+height),b.quadraticCurveTo(x,y+height,x,y+height-a),b.lineTo(x,y+a),b.quadraticCurveTo(x,y,x+a,y));b.fill(),n&&b.stroke()};
|
||||
|
|
@ -0,0 +1,583 @@
|
|||
/*!
|
||||
* chartjs-plugin-zoom
|
||||
* http://chartjs.org/
|
||||
* Version: 0.6.3
|
||||
*
|
||||
* Copyright 2016 Evert Timberg
|
||||
* Released under the MIT license
|
||||
* https://github.com/chartjs/chartjs-plugin-zoom/blob/master/LICENSE.md
|
||||
*/
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
/*jslint browser:true, devel:true, white:true, vars:true */
|
||||
/*global require*/
|
||||
|
||||
// hammer JS for touch support
|
||||
var Hammer = require('hammerjs');
|
||||
Hammer = typeof(Hammer) === 'function' ? Hammer : window.Hammer;
|
||||
|
||||
// Get the chart variable
|
||||
var Chart = require('chart.js');
|
||||
Chart = typeof(Chart) === 'function' ? Chart : window.Chart;
|
||||
var helpers = Chart.helpers;
|
||||
|
||||
// Take the zoom namespace of Chart
|
||||
var zoomNS = Chart.Zoom = Chart.Zoom || {};
|
||||
|
||||
// Where we store functions to handle different scale types
|
||||
var zoomFunctions = zoomNS.zoomFunctions = zoomNS.zoomFunctions || {};
|
||||
var panFunctions = zoomNS.panFunctions = zoomNS.panFunctions || {};
|
||||
|
||||
// Default options if none are provided
|
||||
var defaultOptions = zoomNS.defaults = {
|
||||
pan: {
|
||||
enabled: true,
|
||||
mode: 'xy',
|
||||
speed: 20,
|
||||
threshold: 10
|
||||
},
|
||||
zoom: {
|
||||
enabled: true,
|
||||
mode: 'xy',
|
||||
sensitivity: 3
|
||||
}
|
||||
};
|
||||
|
||||
function directionEnabled(mode, dir) {
|
||||
if (mode === undefined) {
|
||||
return true;
|
||||
} else if (typeof mode === 'string') {
|
||||
return mode.indexOf(dir) !== -1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function rangeMaxLimiter(zoomPanOptions, newMax) {
|
||||
if (zoomPanOptions.scaleAxes && zoomPanOptions.rangeMax &&
|
||||
!helpers.isNullOrUndef(zoomPanOptions.rangeMax[zoomPanOptions.scaleAxes])) {
|
||||
var rangeMax = zoomPanOptions.rangeMax[zoomPanOptions.scaleAxes];
|
||||
if (newMax > rangeMax) {
|
||||
newMax = rangeMax;
|
||||
}
|
||||
}
|
||||
return newMax;
|
||||
}
|
||||
|
||||
function rangeMinLimiter(zoomPanOptions, newMin) {
|
||||
if (zoomPanOptions.scaleAxes && zoomPanOptions.rangeMin &&
|
||||
!helpers.isNullOrUndef(zoomPanOptions.rangeMin[zoomPanOptions.scaleAxes])) {
|
||||
var rangeMin = zoomPanOptions.rangeMin[zoomPanOptions.scaleAxes];
|
||||
if (newMin < rangeMin) {
|
||||
newMin = rangeMin;
|
||||
}
|
||||
}
|
||||
return newMin;
|
||||
}
|
||||
|
||||
function zoomIndexScale(scale, zoom, center, zoomOptions) {
|
||||
var labels = scale.chart.data.labels;
|
||||
var minIndex = scale.minIndex;
|
||||
var lastLabelIndex = labels.length - 1;
|
||||
var maxIndex = scale.maxIndex;
|
||||
var sensitivity = zoomOptions.sensitivity;
|
||||
var chartCenter = scale.isHorizontal() ? scale.left + (scale.width/2) : scale.top + (scale.height/2);
|
||||
var centerPointer = scale.isHorizontal() ? center.x : center.y;
|
||||
|
||||
zoomNS.zoomCumulativeDelta = zoom > 1 ? zoomNS.zoomCumulativeDelta + 1 : zoomNS.zoomCumulativeDelta - 1;
|
||||
|
||||
if (Math.abs(zoomNS.zoomCumulativeDelta) > sensitivity){
|
||||
if(zoomNS.zoomCumulativeDelta < 0){
|
||||
if(centerPointer >= chartCenter){
|
||||
if (minIndex <= 0){
|
||||
maxIndex = Math.min(lastLabelIndex, maxIndex + 1);
|
||||
} else{
|
||||
minIndex = Math.max(0, minIndex - 1);
|
||||
}
|
||||
} else if(centerPointer < chartCenter){
|
||||
if (maxIndex >= lastLabelIndex){
|
||||
minIndex = Math.max(0, minIndex - 1);
|
||||
} else{
|
||||
maxIndex = Math.min(lastLabelIndex, maxIndex + 1);
|
||||
}
|
||||
}
|
||||
zoomNS.zoomCumulativeDelta = 0;
|
||||
}
|
||||
else if(zoomNS.zoomCumulativeDelta > 0){
|
||||
if(centerPointer >= chartCenter){
|
||||
minIndex = minIndex < maxIndex ? minIndex = Math.min(maxIndex, minIndex + 1) : minIndex;
|
||||
} else if(centerPointer < chartCenter){
|
||||
maxIndex = maxIndex > minIndex ? maxIndex = Math.max(minIndex, maxIndex - 1) : maxIndex;
|
||||
}
|
||||
zoomNS.zoomCumulativeDelta = 0;
|
||||
}
|
||||
scale.options.ticks.min = rangeMinLimiter(zoomOptions, labels[minIndex]);
|
||||
scale.options.ticks.max = rangeMaxLimiter(zoomOptions, labels[maxIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
function zoomTimeScale(scale, zoom, center, zoomOptions) {
|
||||
var options = scale.options;
|
||||
|
||||
var range;
|
||||
var min_percent;
|
||||
if (scale.isHorizontal()) {
|
||||
range = scale.right - scale.left;
|
||||
min_percent = (center.x - scale.left) / range;
|
||||
} else {
|
||||
range = scale.bottom - scale.top;
|
||||
min_percent = (center.y - scale.top) / range;
|
||||
}
|
||||
|
||||
var max_percent = 1 - min_percent;
|
||||
var newDiff = range * (zoom - 1);
|
||||
|
||||
var minDelta = newDiff * min_percent;
|
||||
var maxDelta = newDiff * max_percent;
|
||||
|
||||
var newMin = scale.getValueForPixel(scale.getPixelForValue(scale.min) + minDelta);
|
||||
var newMax = scale.getValueForPixel(scale.getPixelForValue(scale.max) - maxDelta);
|
||||
|
||||
var diffMinMax = newMax.diff(newMin);
|
||||
var minLimitExceeded = rangeMinLimiter(zoomOptions, diffMinMax) != diffMinMax;
|
||||
var maxLimitExceeded = rangeMaxLimiter(zoomOptions, diffMinMax) != diffMinMax;
|
||||
|
||||
if (!minLimitExceeded && !maxLimitExceeded) {
|
||||
options.time.min = newMin;
|
||||
options.time.max = newMax;
|
||||
}
|
||||
}
|
||||
|
||||
function zoomNumericalScale(scale, zoom, center, zoomOptions) {
|
||||
var range = scale.max - scale.min;
|
||||
var newDiff = range * (zoom - 1);
|
||||
|
||||
var cursorPixel = scale.isHorizontal() ? center.x : center.y;
|
||||
var min_percent = (scale.getValueForPixel(cursorPixel) - scale.min) / range;
|
||||
var max_percent = 1 - min_percent;
|
||||
|
||||
var minDelta = newDiff * min_percent;
|
||||
var maxDelta = newDiff * max_percent;
|
||||
|
||||
scale.options.ticks.min = rangeMinLimiter(zoomOptions, scale.min + minDelta);
|
||||
scale.options.ticks.max = rangeMaxLimiter(zoomOptions, scale.max - maxDelta);
|
||||
}
|
||||
|
||||
function zoomScale(scale, zoom, center, zoomOptions) {
|
||||
var fn = zoomFunctions[scale.options.type];
|
||||
if (fn) {
|
||||
fn(scale, zoom, center, zoomOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function doZoom(chartInstance, zoom, center, whichAxes) {
|
||||
var ca = chartInstance.chartArea;
|
||||
if (!center) {
|
||||
center = {
|
||||
x: (ca.left + ca.right) / 2,
|
||||
y: (ca.top + ca.bottom) / 2,
|
||||
};
|
||||
}
|
||||
|
||||
var zoomOptions = chartInstance.options.zoom;
|
||||
|
||||
if (zoomOptions && helpers.getValueOrDefault(zoomOptions.enabled, defaultOptions.zoom.enabled)) {
|
||||
// Do the zoom here
|
||||
var zoomMode = helpers.getValueOrDefault(chartInstance.options.zoom.mode, defaultOptions.zoom.mode);
|
||||
zoomOptions.sensitivity = helpers.getValueOrDefault(chartInstance.options.zoom.sensitivity, defaultOptions.zoom.sensitivity);
|
||||
|
||||
// Which axe should be modified when figers were used.
|
||||
var _whichAxes;
|
||||
if (zoomMode == 'xy' && whichAxes !== undefined) {
|
||||
// based on fingers positions
|
||||
_whichAxes = whichAxes;
|
||||
} else {
|
||||
// no effect
|
||||
_whichAxes = 'xy';
|
||||
}
|
||||
|
||||
helpers.each(chartInstance.scales, function(scale, id) {
|
||||
if (scale.isHorizontal() && directionEnabled(zoomMode, 'x') && directionEnabled(_whichAxes, 'x')) {
|
||||
zoomOptions.scaleAxes = "x";
|
||||
zoomScale(scale, zoom, center, zoomOptions);
|
||||
} else if (!scale.isHorizontal() && directionEnabled(zoomMode, 'y') && directionEnabled(_whichAxes, 'y')) {
|
||||
// Do Y zoom
|
||||
zoomOptions.scaleAxes = "y";
|
||||
zoomScale(scale, zoom, center, zoomOptions);
|
||||
}
|
||||
});
|
||||
|
||||
chartInstance.update(0);
|
||||
}
|
||||
}
|
||||
|
||||
function panIndexScale(scale, delta, panOptions) {
|
||||
var labels = scale.chart.data.labels;
|
||||
var lastLabelIndex = labels.length - 1;
|
||||
var offsetAmt = Math.max((scale.ticks.length - ((scale.options.gridLines.offsetGridLines) ? 0 : 1)), 1);
|
||||
var panSpeed = panOptions.speed;
|
||||
var minIndex = scale.minIndex;
|
||||
var step = Math.round(scale.width / (offsetAmt * panSpeed));
|
||||
var maxIndex;
|
||||
|
||||
zoomNS.panCumulativeDelta += delta;
|
||||
|
||||
minIndex = zoomNS.panCumulativeDelta > step ? Math.max(0, minIndex -1) : zoomNS.panCumulativeDelta < -step ? Math.min(lastLabelIndex - offsetAmt + 1, minIndex + 1) : minIndex;
|
||||
zoomNS.panCumulativeDelta = minIndex !== scale.minIndex ? 0 : zoomNS.panCumulativeDelta;
|
||||
|
||||
maxIndex = Math.min(lastLabelIndex, minIndex + offsetAmt - 1);
|
||||
|
||||
scale.options.ticks.min = rangeMinLimiter(panOptions, labels[minIndex]);
|
||||
scale.options.ticks.max = rangeMaxLimiter(panOptions, labels[maxIndex]);
|
||||
}
|
||||
|
||||
function panTimeScale(scale, delta, panOptions) {
|
||||
var options = scale.options;
|
||||
var limitedMax = rangeMaxLimiter(panOptions, scale.getValueForPixel(scale.getPixelForValue(scale.max) - delta));
|
||||
var limitedMin = rangeMinLimiter(panOptions, scale.getValueForPixel(scale.getPixelForValue(scale.min) - delta));
|
||||
|
||||
var limitedTimeDelta = delta < 0 ? limitedMax - scale.max : limitedMin - scale.min;
|
||||
|
||||
options.time.max = scale.max + limitedTimeDelta;
|
||||
options.time.min = scale.min + limitedTimeDelta;
|
||||
}
|
||||
|
||||
function panNumericalScale(scale, delta, panOptions) {
|
||||
var tickOpts = scale.options.ticks;
|
||||
var start = scale.start,
|
||||
end = scale.end;
|
||||
|
||||
if (tickOpts.reverse) {
|
||||
tickOpts.max = scale.getValueForPixel(scale.getPixelForValue(start) - delta);
|
||||
tickOpts.min = scale.getValueForPixel(scale.getPixelForValue(end) - delta);
|
||||
} else {
|
||||
tickOpts.min = scale.getValueForPixel(scale.getPixelForValue(start) - delta);
|
||||
tickOpts.max = scale.getValueForPixel(scale.getPixelForValue(end) - delta);
|
||||
}
|
||||
tickOpts.min = rangeMinLimiter(panOptions, tickOpts.min);
|
||||
tickOpts.max = rangeMaxLimiter(panOptions, tickOpts.max);
|
||||
}
|
||||
|
||||
function panScale(scale, delta, panOptions) {
|
||||
var fn = panFunctions[scale.options.type];
|
||||
if (fn) {
|
||||
fn(scale, delta, panOptions);
|
||||
}
|
||||
}
|
||||
|
||||
function doPan(chartInstance, deltaX, deltaY) {
|
||||
var panOptions = chartInstance.options.pan;
|
||||
if (panOptions && helpers.getValueOrDefault(panOptions.enabled, defaultOptions.pan.enabled)) {
|
||||
var panMode = helpers.getValueOrDefault(chartInstance.options.pan.mode, defaultOptions.pan.mode);
|
||||
panOptions.speed = helpers.getValueOrDefault(chartInstance.options.pan.speed, defaultOptions.pan.speed);
|
||||
|
||||
helpers.each(chartInstance.scales, function(scale, id) {
|
||||
if (scale.isHorizontal() && directionEnabled(panMode, 'x') && deltaX !== 0) {
|
||||
panOptions.scaleAxes = "x";
|
||||
panScale(scale, deltaX, panOptions);
|
||||
} else if (!scale.isHorizontal() && directionEnabled(panMode, 'y') && deltaY !== 0) {
|
||||
panOptions.scaleAxes = "y";
|
||||
panScale(scale, deltaY, panOptions);
|
||||
}
|
||||
});
|
||||
|
||||
chartInstance.update(0);
|
||||
}
|
||||
}
|
||||
|
||||
function positionInChartArea(chartInstance, position) {
|
||||
return (position.x >= chartInstance.chartArea.left && position.x <= chartInstance.chartArea.right) &&
|
||||
(position.y >= chartInstance.chartArea.top && position.y <= chartInstance.chartArea.bottom);
|
||||
}
|
||||
|
||||
function getYAxis(chartInstance) {
|
||||
var scales = chartInstance.scales;
|
||||
|
||||
for (var scaleId in scales) {
|
||||
var scale = scales[scaleId];
|
||||
|
||||
if (!scale.isHorizontal()) {
|
||||
return scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store these for later
|
||||
zoomNS.zoomFunctions.category = zoomIndexScale;
|
||||
zoomNS.zoomFunctions.time = zoomTimeScale;
|
||||
zoomNS.zoomFunctions.linear = zoomNumericalScale;
|
||||
zoomNS.zoomFunctions.logarithmic = zoomNumericalScale;
|
||||
zoomNS.panFunctions.category = panIndexScale;
|
||||
zoomNS.panFunctions.time = panTimeScale;
|
||||
zoomNS.panFunctions.linear = panNumericalScale;
|
||||
zoomNS.panFunctions.logarithmic = panNumericalScale;
|
||||
// Globals for catergory pan and zoom
|
||||
zoomNS.panCumulativeDelta = 0;
|
||||
zoomNS.zoomCumulativeDelta = 0;
|
||||
|
||||
// Chartjs Zoom Plugin
|
||||
var zoomPlugin = {
|
||||
afterInit: function(chartInstance) {
|
||||
helpers.each(chartInstance.scales, function(scale) {
|
||||
scale.originalOptions = JSON.parse(JSON.stringify(scale.options));
|
||||
});
|
||||
|
||||
chartInstance.resetZoom = function() {
|
||||
helpers.each(chartInstance.scales, function(scale, id) {
|
||||
var timeOptions = scale.options.time;
|
||||
var tickOptions = scale.options.ticks;
|
||||
|
||||
if (timeOptions) {
|
||||
delete timeOptions.min;
|
||||
delete timeOptions.max;
|
||||
}
|
||||
|
||||
if (tickOptions) {
|
||||
delete tickOptions.min;
|
||||
delete tickOptions.max;
|
||||
}
|
||||
|
||||
scale.options = helpers.configMerge(scale.options, scale.originalOptions);
|
||||
});
|
||||
|
||||
helpers.each(chartInstance.data.datasets, function(dataset, id) {
|
||||
dataset._meta = null;
|
||||
});
|
||||
|
||||
chartInstance.update();
|
||||
};
|
||||
|
||||
},
|
||||
beforeInit: function(chartInstance) {
|
||||
chartInstance.zoom = {};
|
||||
|
||||
var node = chartInstance.zoom.node = chartInstance.chart.ctx.canvas;
|
||||
|
||||
var options = chartInstance.options;
|
||||
var panThreshold = helpers.getValueOrDefault(options.pan ? options.pan.threshold : undefined, zoomNS.defaults.pan.threshold);
|
||||
if (!options.zoom || !options.zoom.enabled) {
|
||||
return;
|
||||
}
|
||||
if (options.zoom.drag) {
|
||||
// Only want to zoom horizontal axis
|
||||
options.zoom.mode = 'x';
|
||||
|
||||
chartInstance.zoom._mouseDownHandler = function(event) {
|
||||
chartInstance.zoom._dragZoomStart = event;
|
||||
};
|
||||
node.addEventListener('mousedown', chartInstance.zoom._mouseDownHandler);
|
||||
|
||||
chartInstance.zoom._mouseMoveHandler = function(event){
|
||||
if (chartInstance.zoom._dragZoomStart) {
|
||||
chartInstance.zoom._dragZoomEnd = event;
|
||||
chartInstance.update(0);
|
||||
}
|
||||
|
||||
chartInstance.update(0);
|
||||
};
|
||||
node.addEventListener('mousemove', chartInstance.zoom._mouseMoveHandler);
|
||||
|
||||
chartInstance.zoom._mouseUpHandler = function(event){
|
||||
if (chartInstance.zoom._dragZoomStart) {
|
||||
var chartArea = chartInstance.chartArea;
|
||||
var yAxis = getYAxis(chartInstance);
|
||||
var beginPoint = chartInstance.zoom._dragZoomStart;
|
||||
var offsetX = beginPoint.target.getBoundingClientRect().left;
|
||||
var startX = Math.min(beginPoint.clientX, event.clientX) - offsetX;
|
||||
var endX = Math.max(beginPoint.clientX, event.clientX) - offsetX;
|
||||
var dragDistance = endX - startX;
|
||||
var chartDistance = chartArea.right - chartArea.left;
|
||||
var zoom = 1 + ((chartDistance - dragDistance) / chartDistance );
|
||||
|
||||
if (dragDistance > 0) {
|
||||
doZoom(chartInstance, zoom, {
|
||||
x: (dragDistance / 2) + startX,
|
||||
y: (yAxis.bottom - yAxis.top) / 2,
|
||||
});
|
||||
}
|
||||
|
||||
chartInstance.zoom._dragZoomStart = null;
|
||||
chartInstance.zoom._dragZoomEnd = null;
|
||||
}
|
||||
};
|
||||
node.addEventListener('mouseup', chartInstance.zoom._mouseUpHandler);
|
||||
} else {
|
||||
chartInstance.zoom._wheelHandler = function(event) {
|
||||
var rect = event.target.getBoundingClientRect();
|
||||
var offsetX = event.clientX - rect.left;
|
||||
var offsetY = event.clientY - rect.top;
|
||||
|
||||
var center = {
|
||||
x : offsetX,
|
||||
y : offsetY
|
||||
};
|
||||
|
||||
if (event.deltaY < 0) {
|
||||
doZoom(chartInstance, 1.1, center);
|
||||
} else {
|
||||
doZoom(chartInstance, 0.909, center);
|
||||
}
|
||||
// Prevent the event from triggering the default behavior (eg. Content scrolling).
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
node.addEventListener('wheel', chartInstance.zoom._wheelHandler);
|
||||
}
|
||||
|
||||
if (Hammer) {
|
||||
var mc = new Hammer.Manager(node);
|
||||
mc.add(new Hammer.Pinch());
|
||||
mc.add(new Hammer.Pan({
|
||||
threshold: panThreshold
|
||||
}));
|
||||
|
||||
// Hammer reports the total scaling. We need the incremental amount
|
||||
var currentPinchScaling;
|
||||
var handlePinch = function handlePinch(e) {
|
||||
var diff = 1 / (currentPinchScaling) * e.scale;
|
||||
var rect = e.target.getBoundingClientRect();
|
||||
var offsetX = e.center.x - rect.left;
|
||||
var offsetY = e.center.y - rect.top;
|
||||
var center = {
|
||||
x : offsetX,
|
||||
y : offsetY
|
||||
};
|
||||
|
||||
// fingers position difference
|
||||
var x = Math.abs(e.pointers[0].clientX - e.pointers[1].clientX);
|
||||
var y = Math.abs(e.pointers[0].clientY - e.pointers[1].clientY);
|
||||
|
||||
// diagonal fingers will change both (xy) axes
|
||||
var p = x / y;
|
||||
var xy;
|
||||
if (p > 0.3 && p < 1.7) {
|
||||
xy = 'xy';
|
||||
}
|
||||
// x axis
|
||||
else if (x > y) {
|
||||
xy = 'x';
|
||||
}
|
||||
// y axis
|
||||
else {
|
||||
xy = 'y';
|
||||
}
|
||||
|
||||
doZoom(chartInstance, diff, center, xy);
|
||||
|
||||
// Keep track of overall scale
|
||||
currentPinchScaling = e.scale;
|
||||
};
|
||||
|
||||
mc.on('pinchstart', function(e) {
|
||||
currentPinchScaling = 1; // reset tracker
|
||||
});
|
||||
mc.on('pinch', handlePinch);
|
||||
mc.on('pinchend', function(e) {
|
||||
handlePinch(e);
|
||||
currentPinchScaling = null; // reset
|
||||
zoomNS.zoomCumulativeDelta = 0;
|
||||
});
|
||||
|
||||
var currentDeltaX = null, currentDeltaY = null, panning = false;
|
||||
var handlePan = function handlePan(e) {
|
||||
if (currentDeltaX !== null && currentDeltaY !== null) {
|
||||
panning = true;
|
||||
var deltaX = e.deltaX - currentDeltaX;
|
||||
var deltaY = e.deltaY - currentDeltaY;
|
||||
currentDeltaX = e.deltaX;
|
||||
currentDeltaY = e.deltaY;
|
||||
doPan(chartInstance, deltaX, deltaY);
|
||||
}
|
||||
};
|
||||
|
||||
mc.on('panstart', function(e) {
|
||||
currentDeltaX = 0;
|
||||
currentDeltaY = 0;
|
||||
handlePan(e);
|
||||
});
|
||||
mc.on('panmove', handlePan);
|
||||
mc.on('panend', function(e) {
|
||||
currentDeltaX = null;
|
||||
currentDeltaY = null;
|
||||
zoomNS.panCumulativeDelta = 0;
|
||||
setTimeout(function() { panning = false; }, 500);
|
||||
});
|
||||
|
||||
chartInstance.zoom._ghostClickHandler = function(e) {
|
||||
if (panning) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
node.addEventListener('click', chartInstance.zoom._ghostClickHandler);
|
||||
|
||||
chartInstance._mc = mc;
|
||||
}
|
||||
},
|
||||
|
||||
beforeDatasetsDraw: function(chartInstance) {
|
||||
var ctx = chartInstance.chart.ctx;
|
||||
var chartArea = chartInstance.chartArea;
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
|
||||
if (chartInstance.zoom._dragZoomEnd) {
|
||||
var yAxis = getYAxis(chartInstance);
|
||||
var beginPoint = chartInstance.zoom._dragZoomStart;
|
||||
var endPoint = chartInstance.zoom._dragZoomEnd;
|
||||
var offsetX = beginPoint.target.getBoundingClientRect().left;
|
||||
var startX = Math.min(beginPoint.clientX, endPoint.clientX) - offsetX;
|
||||
var endX = Math.max(beginPoint.clientX, endPoint.clientX) - offsetX;
|
||||
var rectWidth = endX - startX;
|
||||
|
||||
|
||||
ctx.fillStyle = 'rgba(225,225,225,0.3)';
|
||||
ctx.lineWidth = 5;
|
||||
ctx.fillRect(startX, yAxis.top, rectWidth, yAxis.bottom - yAxis.top);
|
||||
}
|
||||
|
||||
ctx.rect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
|
||||
ctx.clip();
|
||||
},
|
||||
|
||||
afterDatasetsDraw: function(chartInstance) {
|
||||
chartInstance.chart.ctx.restore();
|
||||
},
|
||||
|
||||
destroy: function(chartInstance) {
|
||||
if (chartInstance.zoom) {
|
||||
var options = chartInstance.options;
|
||||
var node = chartInstance.zoom.node;
|
||||
|
||||
if (options.zoom && options.zoom.drag) {
|
||||
node.removeEventListener('mousedown', chartInstance.zoom._mouseDownHandler);
|
||||
node.removeEventListener('mousemove', chartInstance.zoom._mouseMoveHandler);
|
||||
node.removeEventListener('mouseup', chartInstance.zoom._mouseUpHandler);
|
||||
} else {
|
||||
node.removeEventListener('wheel', chartInstance.zoom._wheelHandler);
|
||||
}
|
||||
|
||||
if (Hammer) {
|
||||
node.removeEventListener('click', chartInstance.zoom._ghostClickHandler);
|
||||
}
|
||||
|
||||
delete chartInstance.zoom;
|
||||
|
||||
var mc = chartInstance._mc;
|
||||
if (mc) {
|
||||
mc.remove('pinchstart');
|
||||
mc.remove('pinch');
|
||||
mc.remove('pinchend');
|
||||
mc.remove('panstart');
|
||||
mc.remove('pan');
|
||||
mc.remove('panend');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = zoomPlugin;
|
||||
Chart.pluginService.register(zoomPlugin);
|
||||
|
||||
},{"chart.js":1,"hammerjs":1}]},{},[2]);
|
||||
|
|
@ -0,0 +1,349 @@
|
|||
function drawCharts(result_paramsArr_data,filesNameStr){
|
||||
var paramAllData = [];
|
||||
if(filesNameStr!='allFiles'){//如果不是选择的所有文件
|
||||
//解析filesNameArr,获取新的result_paramsArr_data---------------------
|
||||
result_paramsArr_data = getNewresult_paramsArr_data(result_paramsArr_data,filesNameStr);
|
||||
//解析filesNameArr,获取新的result_paramsArr_data---------------------
|
||||
}
|
||||
|
||||
var result_paramsArr_dataLen = result_paramsArr_data.length;
|
||||
//每个图表容器的高度
|
||||
chart_containerHeight = parseInt(page_total_height/result_paramsArr_dataLen);
|
||||
//注销之前的图形缓存,图表1,初始图表
|
||||
myLineChart.destroy();
|
||||
//注销之前的图形缓存,2个以上的图表
|
||||
for(var charti=0;charti<myLineChartArr.length;charti++){
|
||||
myLineChartArr[charti].destroy();
|
||||
}
|
||||
//清空
|
||||
myLineChartArr = [];
|
||||
console.log('注销之前的图形缓存成功');
|
||||
for(var k=0;k<result_paramsArr_data.length;k++){ //所有选中的参数
|
||||
//某个参数包含的数据
|
||||
var chartDataSets = [];
|
||||
var result_params_data = result_paramsArr_data[k];
|
||||
var req_param_data = result_params_data.req_param_data;
|
||||
//参数名
|
||||
var paramName_k = req_param_data.paramName;
|
||||
|
||||
//参数包含的数据
|
||||
paramAllData = req_param_data.paramAllData;
|
||||
//自定义x轴范围---------------------------------------
|
||||
var paramName_k_x_min=0;
|
||||
var paramName_k_x_max=0;
|
||||
var hasCustomerXField = false;
|
||||
var paramValue_jArr_X_k_cus = [];
|
||||
for(var kk=0;kk<customer_x_field.length;kk++){
|
||||
customer_x_field_values = customer_x_field[kk];
|
||||
if(paramName_k==customer_x_field_values.set_paramName){
|
||||
if(customer_x_field_values.x_minValue!=''&&customer_x_field_values.x_minValue!="")
|
||||
paramName_k_x_min = customer_x_field_values.x_minValue
|
||||
if(customer_x_field_values.x_maxValue!=''&&customer_x_field_values.x_maxValue!="")
|
||||
paramName_k_x_max = customer_x_field_values.x_maxValue;
|
||||
paramValue_jArr_X_k_cus = customer_x_field_values.paramValue_jArr_X_k_cus;
|
||||
hasCustomerXField = true;
|
||||
}
|
||||
}
|
||||
//自定义x轴范围---------------------------------------
|
||||
//如果设置过x轴范围,则重新生成数据
|
||||
if(hasCustomerXField&&(paramName_k_x_min<paramName_k_x_max))
|
||||
paramAllData = get_Y_data_k_By_customer_X_Field(paramName_k_x_min,paramName_k_x_max,paramAllData);
|
||||
|
||||
//自定义y轴范围数据------------------------------------
|
||||
var paramName_k_y_min = 0;
|
||||
var paramName_k_y_max = 0;
|
||||
var hasCustomerYField = false;
|
||||
//遍历自定义y轴范围数据
|
||||
for(var i=0;i<customer_y_field.length;i++){
|
||||
var customer_y_fieldObj = customer_y_field[i];
|
||||
if(paramName_k==customer_y_fieldObj.set_paramName){
|
||||
if(customer_y_fieldObj.y_minValue!=''&&customer_y_fieldObj.y_minValue!="")
|
||||
paramName_k_y_min = customer_y_fieldObj.y_minValue;
|
||||
if(customer_y_fieldObj.y_maxValue!=''&&customer_y_fieldObj.y_maxValue!="")
|
||||
paramName_k_y_max = customer_y_fieldObj.y_maxValue;
|
||||
|
||||
hasCustomerYField = true;
|
||||
}
|
||||
}
|
||||
//自定义y轴范围数据------------------------------------
|
||||
//获取图表的颜色
|
||||
//获取图表的颜色,models_keypoint_params_colorArr 存放参数的颜色序号 数组
|
||||
for(var i=0;i<models_keypoint_params_colorArr.length;i++){
|
||||
models_keypoint_params_colorObj = models_keypoint_params_colorArr[i];
|
||||
if(paramName_k==models_keypoint_params_colorObj.paramName_k)
|
||||
getColorNum(models_keypoint_params_colorObj.color_index);
|
||||
}
|
||||
//选择的的参数的字体颜色
|
||||
var param_fontColor = "rgba("+redcolor+","+greencolor+","+bluecolor+",1)";
|
||||
$("."+req_param_data.paramName+"_class").css({"color":param_fontColor});
|
||||
//初始化图表------------------
|
||||
var ctxk;
|
||||
if(result_paramsArr_dataLen==1) //只有一个参数
|
||||
ctxk = addOneChart(0,'onlyone',chart_containerHeight,paramName_k,param_fontColor);
|
||||
else //多个参数
|
||||
ctxk = addOneChart(k,'',chart_containerHeight,paramName_k,param_fontColor);
|
||||
var myLineChartk;
|
||||
//初始化图表------------------
|
||||
//每一个csv中计算出来的x轴数据
|
||||
var paramValue_jArr_X = [];
|
||||
//获取x轴数据时需要判断该值
|
||||
loop_paramAllData_temp_i = -1;
|
||||
|
||||
for(var i=0;i<paramAllData.length;i++){
|
||||
var paramObj = paramAllData[i];
|
||||
var paramName = paramObj.paramName;
|
||||
//一个csv的计算后的数据
|
||||
var paramValue = paramObj.paramValue;
|
||||
//文件名序号
|
||||
fileIndex = paramObj.fileIndex;
|
||||
|
||||
//每一个csv中计算出来的y轴数据
|
||||
var paramValue_jArr_Y = [];
|
||||
var paramValueArr = paramValue.split(';');
|
||||
|
||||
//获取每个参数x轴数据------------------------------------------
|
||||
if(paramValue==''||paramValue==""||paramValue==null){
|
||||
continue;
|
||||
}else{
|
||||
if(loop_paramAllData_temp_i==-1){
|
||||
loop_paramAllData_temp_i = i;
|
||||
if(loop_paramAllData_temp_i>-1){
|
||||
for(var ii=0;ii<paramValueArr.length;ii++){
|
||||
//只计算一个csv的x轴数据
|
||||
paramValue_jArr_X.push(ii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取每个参数x轴数据------------------------------------------
|
||||
|
||||
paramValue_jArr_Y = paramValueArr;
|
||||
|
||||
//填充颜色
|
||||
var backgroundColor = "rgba("+redcolor+","+greencolor+","+bluecolor+",0.4)";
|
||||
var borderColor = "rgba("+redcolor+","+greencolor+","+bluecolor+",1)";
|
||||
var pointBorderColor = "rgba("+redcolor+","+greencolor+","+bluecolor+",1)";
|
||||
//图表数据对象
|
||||
var chartDataObj;
|
||||
if(hasCustomerYField&&(paramName_k_y_min<paramName_k_y_max)){
|
||||
//用户自定义y轴范围
|
||||
chartDataObj = {
|
||||
label : 'csv'+parseInt(fileIndex),
|
||||
//backgroundColor: backgroundColor,
|
||||
backgroundColor : 'rgba(0,0,0,0.0)',
|
||||
borderColor: borderColor,
|
||||
pointBorderColor: pointBorderColor,
|
||||
pointHoverBackgroundColor: pointBorderColor,
|
||||
pointHoverBorderColor: pointBorderColor,
|
||||
pointHoverBackgroundColor: pointBorderColor,
|
||||
pointBorderWidth:1,
|
||||
yAxisID: 'customer_y_ID'+k,
|
||||
data : paramValue_jArr_Y
|
||||
};
|
||||
}else{
|
||||
chartDataObj = {
|
||||
label : 'csv'+parseInt(fileIndex),
|
||||
//backgroundColor: backgroundColor,
|
||||
backgroundColor : 'rgba(0,0,0,0.0)',
|
||||
borderColor: borderColor,
|
||||
pointBorderColor: pointBorderColor,
|
||||
pointHoverBackgroundColor: pointBorderColor,
|
||||
pointHoverBorderColor: pointBorderColor,
|
||||
pointHoverBackgroundColor: pointBorderColor,
|
||||
pointBorderWidth:1,
|
||||
data : paramValue_jArr_Y
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
//图表数据集
|
||||
chartDataSets.push(chartDataObj);
|
||||
console.log('获取某个图表数据集成功');
|
||||
}
|
||||
if(hasCustomerXField&&(paramName_k_x_min<paramName_k_x_max)){
|
||||
paramValue_jArr_X = paramValue_jArr_X_k_cus;
|
||||
}
|
||||
//图表数据
|
||||
var showchartdata = {
|
||||
labels : paramValue_jArr_X,
|
||||
datasets : chartDataSets
|
||||
}
|
||||
|
||||
|
||||
//只勾选一个参数,只有一个图表
|
||||
if(k==0){
|
||||
|
||||
//画图表-生成图标图形------------------------------
|
||||
if(hasCustomerYField&&(paramName_k_y_min<paramName_k_y_max)){//该参数x轴范围已经被自定义过
|
||||
myLineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: showchartdata,
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
id: 'customer_y_ID'+k,
|
||||
type: 'linear',
|
||||
position: 'left',
|
||||
ticks: {
|
||||
max: parseInt(paramName_k_y_max),
|
||||
min: parseInt(paramName_k_y_min)
|
||||
}
|
||||
}]
|
||||
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}else{
|
||||
myLineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: showchartdata,
|
||||
options : {
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
}//'top',
|
||||
|
||||
});
|
||||
}
|
||||
console.log('绘制第一个图表成功');
|
||||
//画图表-结束------------------------------
|
||||
}else{
|
||||
//画图表-生成图标图形------------------------------
|
||||
if(hasCustomerYField&&(paramName_k_y_min<paramName_k_y_max)){//该参数x轴范围已经被自定义过
|
||||
myLineChartk = new Chart(ctxk, {
|
||||
type: 'line',
|
||||
data: showchartdata,
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
id: 'customer_y_ID'+k,
|
||||
type: 'linear',
|
||||
position: 'left',
|
||||
ticks: {
|
||||
max: parseInt(paramName_k_y_max),
|
||||
min: parseInt(paramName_k_y_min)
|
||||
}
|
||||
}]
|
||||
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
console.log('绘制自定义x轴范围,某个图表成功');
|
||||
}else{
|
||||
myLineChartk = new Chart(ctxk, {
|
||||
type: 'line',
|
||||
data: showchartdata,
|
||||
options : {
|
||||
legend: {
|
||||
display: false
|
||||
}
|
||||
}//'top',
|
||||
|
||||
});
|
||||
|
||||
console.log('绘制某个图表成功');
|
||||
}
|
||||
myLineChartArr.push(myLineChartk);
|
||||
//画图表-结束------------------------------
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
function getNewresult_paramsArr_data(result_paramsArr_data,filesNameStr,allClickFlag){
|
||||
var result_paramsArr_dataNew = [];
|
||||
var filesNameArr = filesNameStr.split(",");
|
||||
var result_paramsArr_dataLen = result_paramsArr_data.length;
|
||||
for(var k=0;k<result_paramsArr_dataLen;k++){
|
||||
var result_params_data = result_paramsArr_data[k];
|
||||
var req_param_data = result_params_data.req_param_data;
|
||||
var paramAllData = req_param_data.paramAllData;
|
||||
var result_params_dataNew;
|
||||
var req_param_dataNew;
|
||||
var paramAllDataNew=[];
|
||||
for(var i=0;i<filesNameArr.length;i++){
|
||||
for(var j=0;j<paramAllData.length;j++){
|
||||
var paramObj = paramAllData[j];
|
||||
var paramName = paramObj.paramName;
|
||||
//一个csv的计算后的数据
|
||||
var fileName = paramObj.fileName;
|
||||
if(filesNameArr[i]==fileName){
|
||||
paramAllDataNew.push(paramObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
req_param_dataNew = {"paramAllData":paramAllDataNew,"keyPointName":req_param_data.keyPointName,"paramName":req_param_data.paramName,"param_X_Length":req_param_data.param_X_Length,"param_from":req_param_data.param_from,"param_to":req_param_data.param_to};
|
||||
result_params_dataNew = {"req_param_data":req_param_dataNew}
|
||||
result_paramsArr_dataNew.push(result_params_dataNew);
|
||||
}
|
||||
|
||||
return result_paramsArr_dataNew;
|
||||
|
||||
}
|
||||
|
||||
//根据自定义x轴的范围获取指定数量的y轴数据
|
||||
function get_Y_data_k_By_customer_X_Field(paramName_k_x_min,paramName_k_x_max,paramAllData){
|
||||
var paramAllDataNew=[];
|
||||
for(var j=0;j<paramAllData.length;j++){
|
||||
var paramObj = paramAllData[j];
|
||||
var paramName = paramObj.paramName;
|
||||
var paramValue = paramObj.paramValue;
|
||||
paramValueArr = paramValue.split(";");
|
||||
var paramValueNew = '';
|
||||
for(var m=paramName_k_x_min;m<paramName_k_x_max;m++){
|
||||
paramValueNew=paramValueNew+paramValueArr[m]+";";
|
||||
}
|
||||
paramValueNew = paramValueNew.substring(0, paramValueNew.length-1);
|
||||
paramObjNew = {"keyPointName":paramObj.keyPointName,"fileName":paramObj.fileName,"paramName":paramObj.paramName,"paramValue":paramValueNew};
|
||||
paramAllDataNew.push(paramObjNew);
|
||||
}
|
||||
return paramAllDataNew;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//暂时不使用该函数--------------
|
||||
//生成自定义的x轴数据,选择过的参数
|
||||
var customer_x_field_valuesArr = [];
|
||||
//是否有参数被自定义过x轴范围,只要有一个,就为true
|
||||
var isContainCusXFieldsTag = false;
|
||||
//获取每个参数的自定义x轴范围和显示的y轴数据
|
||||
function get_customer_x_field_k_values(paramName_k){
|
||||
var paramName_k_x_min=0;
|
||||
var paramName_k_x_max=0;
|
||||
var hasCustomerXField = false;
|
||||
for(var i=0;i<customer_x_field.length;i++){
|
||||
var customer_x_fieldObj = customer_x_field[i];
|
||||
if(paramName_k==customer_x_fieldObj.set_paramName){
|
||||
paramName_k_x_min = customer_x_fieldObj.x_minValue;
|
||||
paramName_k_x_max = customer_x_fieldObj.x_maxValue;
|
||||
hasCustomerXField=true;
|
||||
}
|
||||
}
|
||||
|
||||
//如果该参数没有被自定义过x轴范围,则不改变什么,如果有,则同时改变y轴要显示的数据,并重新绘图
|
||||
//只要有一个参数被自定义过x轴范围,就要重新绘图,所以,只要有一个参数被自定义过,返回false,则continue,执行下一个参数,继续判断下一个参数是否也被自定义过x轴范围,获取该x轴范围
|
||||
if(hasCustomerXField){
|
||||
//生成自定义的x轴数据
|
||||
paramValue_jArr_X_k_cus = [];
|
||||
for(var i=paramName_k_x_min;i<paramName_k_x_max;i++){
|
||||
paramValue_jArr_X_k_cus.push(i);
|
||||
}
|
||||
customer_x_field_k_values = {"paramName_k":paramName_k,"paramValue_jArr_X_k_cus":paramValue_jArr_X_k_cus,"paramName_k_x_min":paramName_k_x_min,"paramName_k_x_max":paramName_k_x_max};
|
||||
customer_x_field_valuesArr.push(customer_x_field_k_values);
|
||||
isContainCusXFieldsTag = true;
|
||||
//如果返回isContainCusXFieldsTag = true,则continue,执行下一个参数,继续判断下一个参数是否也被自定义过x轴范围
|
||||
}
|
||||
//如果返回isContainCusXFieldsTag = false,则不改变什么
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 70 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 794 B |
|
After Width: | Height: | Size: 405 B |
|
After Width: | Height: | Size: 903 B |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 291 B |
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 346 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 725 B |
|
After Width: | Height: | Size: 333 B |
|
After Width: | Height: | Size: 432 B |
|
After Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 407 B |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 647 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 152 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 47 B |
|
|
@ -344,7 +344,7 @@
|
|||
</td>
|
||||
<td valign="top" style="background-color: #FFFFFF;" rowspan="3">
|
||||
<div class="biaog03_img main_cell_right">
|
||||
<iframe name="infoDutyScheduleList" class="main_cell_right" id="infoDutyScheduleList" src="${ctx}/defaultIndex/defaultIndex/infoDutyScheduleList" scrolling="no" width="100%" frameborder="0"></iframe>
|
||||
<iframe name="infoDutyScheduleList" class="main_cell_right" id="infoDutyScheduleList" th:src="@{/defaultIndex/defaultIndex/infoDutyScheduleList}" scrolling="no" width="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
<div class="biaog03_div">查看更多</div>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
package cn.com.infosouth.arj21.controller.defaultIndex;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.com.infosouth.common.core.controller.BaseController;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import cn.com.amas.job.HttpReqUriUtils;
|
||||
import cn.com.infosouth.amas.modules.analysis.entity.InfoDutySchedule;
|
||||
import cn.com.infosouth.amas.modules.analysis.service.InfoDutyScheduleService;
|
||||
import cn.com.infosouth.amas.modules.csvmanager.service.InfoFlightService;
|
||||
import cn.com.infosouth.amas.modules.parameter.service.computed.InfoParameterComputedService;
|
||||
import cn.com.infosouth.amas.modules.virtual.entity.InfoVersion;
|
||||
import cn.com.infosouth.amas.modules.virtual.service.InfoAcTypeService;
|
||||
import cn.com.infosouth.amas.modules.virtual.service.InfoVersionService;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
* @ClassName: DefaultIndexController
|
||||
* @Description:TODO(默认首页)
|
||||
* @author: zy
|
||||
* @date: 2018年3月14日 下午6:24:24
|
||||
*
|
||||
* @Copyright: 2018 Inc. All rights reserved.
|
||||
* 注意:本内容仅限深圳科信南方技术有限公司内部传阅,禁止外泄以及用于其他的商业目的
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/defaultIndex/defaultIndex")
|
||||
public class DefaultIndexController extends BaseController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private InfoDutyScheduleService infoDutyScheduleService;
|
||||
@Autowired
|
||||
private InfoVersionService infoVersionService;
|
||||
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
|
||||
@Autowired
|
||||
private InfoFlightService infoFlightService;
|
||||
|
||||
@Autowired
|
||||
private InfoAcTypeService infoAcTypeService;
|
||||
|
||||
@Autowired
|
||||
private InfoParameterComputedService infoParameterComputedService;
|
||||
|
||||
private static String static_acType_C900 = "AC700";
|
||||
private static String static_acType_B737 = "AC737";
|
||||
private static String static_acType_A320 = "AC320";
|
||||
private static String static_acType_B777 = "AC777";
|
||||
private static String static_acType_A330 = "AC330";
|
||||
|
||||
|
||||
/**
|
||||
* @Title: initAcType
|
||||
* @Description: TODO(初始化机型)
|
||||
* @param: @param acTypeListByAcTypeNo
|
||||
* @return: void
|
||||
* @throws
|
||||
*/
|
||||
public void initAcType(List<Map<String,String>> acTypeListByAcTypeNo){
|
||||
for (int i = 0; i < acTypeListByAcTypeNo.size(); i++) {
|
||||
Map<String, String> map = acTypeListByAcTypeNo.get(i);
|
||||
if("1".equals(map.get("ac_type_no"))){
|
||||
static_acType_C900 = map.get("ac_tpye");
|
||||
}
|
||||
if("2".equals(map.get("ac_type_no"))){
|
||||
static_acType_B737 = map.get("ac_tpye");
|
||||
}
|
||||
if("3".equals(map.get("ac_type_no"))){
|
||||
static_acType_A320 = map.get("ac_tpye");
|
||||
}
|
||||
if("4".equals(map.get("ac_type_no"))){
|
||||
static_acType_B777 = map.get("ac_tpye");
|
||||
}
|
||||
if("5".equals(map.get("ac_type_no"))){
|
||||
static_acType_A330 = map.get("ac_tpye");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresPermissions("defaultIndex:defaultIndex:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
//机型列表
|
||||
List<Map<String,String>> acTypeListByAcTypeNo = infoAcTypeService.findacTpyeMapList();
|
||||
//初始化机型
|
||||
initAcType(acTypeListByAcTypeNo);
|
||||
|
||||
List<Map<String, String>> infoDutyScheduleList_CRJ900 = infoDutyScheduleService.findInfoDutyScheduleMapList(static_acType_C900);
|
||||
List<Map<String, String>> infoDutyScheduleList_B737 = infoDutyScheduleService.findInfoDutyScheduleMapList(static_acType_B737);
|
||||
List<Map<String, String>> infoDutyScheduleList_A320 = infoDutyScheduleService.findInfoDutyScheduleMapList(static_acType_A320);
|
||||
List<Map<String, String>> infoDutyScheduleList_B777 = infoDutyScheduleService.findInfoDutyScheduleMapList(static_acType_B777);
|
||||
List<Map<String, String>> infoDutyScheduleList_A330 = infoDutyScheduleService.findInfoDutyScheduleMapList(static_acType_A330);
|
||||
|
||||
|
||||
|
||||
InfoVersion infoVersion = new InfoVersion();
|
||||
List<InfoVersion> versionList = infoVersionService.findList(infoVersion);
|
||||
|
||||
model.addAttribute("infoDutyScheduleList_CRJ900", infoDutyScheduleList_CRJ900);
|
||||
model.addAttribute("infoDutyScheduleList_B737", infoDutyScheduleList_B737);
|
||||
model.addAttribute("infoDutyScheduleList_A320", infoDutyScheduleList_A320);
|
||||
model.addAttribute("infoDutyScheduleList_B777", infoDutyScheduleList_B777);
|
||||
model.addAttribute("infoDutyScheduleList_A330", infoDutyScheduleList_A330);
|
||||
|
||||
|
||||
//qar数量
|
||||
String qarCount = infoFlightService.findFlightCount();
|
||||
model.addAttribute("qarCount", qarCount);
|
||||
|
||||
//qar数量
|
||||
String modelCount = infoParameterComputedService.findModelCount();
|
||||
model.addAttribute("modelCount", modelCount);
|
||||
|
||||
//任务数量
|
||||
String jobCount = infoDutyScheduleService.findJobCount();
|
||||
model.addAttribute("jobCount", jobCount);
|
||||
|
||||
model.addAttribute("versionList", versionList);
|
||||
|
||||
//登录管理员名
|
||||
String login_admin = UserUtils.getUser().getLoginName();
|
||||
User currLoginUser = systemService.getUserByLoginName(login_admin);
|
||||
//是否显示首页图表“设置”选项权限
|
||||
String isShowAdminSettingFlag = "0";
|
||||
if("1".equals(currLoginUser.getUserType())){
|
||||
isShowAdminSettingFlag = "1";
|
||||
}
|
||||
model.addAttribute("isShowAdminSettingFlag", isShowAdminSettingFlag);
|
||||
|
||||
//查询第一页的任务,top10
|
||||
List<Map<String, String>> infoDutyScheduleMapListTop10 = infoDutyScheduleService.findInfoDutyScheduleMapListTop10();
|
||||
JSONArray infoDutyScheduleMapListTop10JsonArr = JSONArray.parseArray(JSONObject.toJSONString(infoDutyScheduleMapListTop10));
|
||||
model.addAttribute("jobsTop10JsonArr", infoDutyScheduleMapListTop10JsonArr);
|
||||
|
||||
//任务列表url
|
||||
PropertiesLoader propertiesLoader = new PropertiesLoader("/defaultIndexConfig.properties");
|
||||
String marquee_scroll_text_url = propertiesLoader.getProperty("marquee_scroll_text_url");
|
||||
model.addAttribute("marquee_scroll_text_url", marquee_scroll_text_url);
|
||||
|
||||
PropertiesLoader config = new PropertiesLoader("numberone.properties");
|
||||
String config_debug = config.getProperty("local.debug");
|
||||
if(config_debug.trim().equals("1"))
|
||||
{
|
||||
model.addAttribute("local_debug", "1");
|
||||
}
|
||||
else {
|
||||
model.addAttribute("local_debug", "0");
|
||||
}
|
||||
|
||||
//model.addAttribute("acTypeListByAcTypeNo", acTypeListByAcTypeNo);
|
||||
String acTypeListByAcTypeNoStr = "";
|
||||
acTypeListByAcTypeNoStr = static_acType_C900+","+static_acType_B737+","+static_acType_A320+","+static_acType_B777+","+static_acType_A330;
|
||||
|
||||
model.addAttribute("acType_row1", static_acType_C900);
|
||||
model.addAttribute("acType_row2", static_acType_B737);
|
||||
model.addAttribute("acType_row3", static_acType_A320);
|
||||
model.addAttribute("acType_row4", static_acType_B777);
|
||||
model.addAttribute("acType_row5", static_acType_A330);
|
||||
|
||||
model.addAttribute("acTypeListByAcTypeNoStr", acTypeListByAcTypeNoStr);
|
||||
return "modules/defaultIndex/defaultIndexList";
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissions("defaultIndex:defaultIndex:view")
|
||||
@RequestMapping(value = {"infoDutyScheduleList", ""})
|
||||
public String infoDutyScheduleList(InfoDutySchedule infoDutySchedule, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
String userName = UserUtils.getUser().getLoginName();
|
||||
//按创建人排序,当前用户优先
|
||||
String orderBy = "(case when a.create_by='" + userName + "' then 1 ELSE IFNULL(a.create_by,2) END),a.update_date DESC";
|
||||
Page<InfoDutySchedule> page = new Page<InfoDutySchedule>(request, response);
|
||||
page.setOrderBy(orderBy);
|
||||
page = infoDutyScheduleService.findPage(page, infoDutySchedule);
|
||||
InfoVersion infoVersion = new InfoVersion();
|
||||
List<InfoVersion> versionList = infoVersionService.findList(infoVersion);
|
||||
model.addAttribute("versionList", versionList);
|
||||
model.addAttribute("page", page);
|
||||
HttpReqUriUtils httpReqUriUtils = new HttpReqUriUtils();
|
||||
httpReqUriUtils.setGetJobs_Status_Uri();
|
||||
model.addAttribute("getJobs_Status_Uri", httpReqUriUtils.getGetJobs_Status_Uri());
|
||||
return "modules/defaultIndex/defaultIndex_infoDutyScheduleList";
|
||||
}
|
||||
|
||||
/*public List<InfoAcType> getAcTypeByAcTypeNo(){
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||