From f6abc8c724eed706487b7616bc6c816e5db5c939 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期二, 09 十二月 2025 20:13:48 +0800
Subject: [PATCH] 数量检测页面提交
---
fzzy-igdss-web/src/main/resources/static/grain/grainPoint1.js | 1348 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,348 insertions(+), 0 deletions(-)
diff --git a/fzzy-igdss-web/src/main/resources/static/grain/grainPoint1.js b/fzzy-igdss-web/src/main/resources/static/grain/grainPoint1.js
new file mode 100644
index 0000000..2ec2d25
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/grain/grainPoint1.js
@@ -0,0 +1,1348 @@
+/**瀹氫箟鍙橀噺**/
+var listPoints = [];
+var listLays = [];
+var listRows = [];
+/**鍒�**/
+var cols = 9;
+/**灞�**/
+var lays = 4;
+/**琛�**/
+var rows = 5;
+
+var oneWidth;
+var oneHeight;
+//鐭╁舰楂�
+var back_height;
+//鐭╁舰闀�
+var back_width;
+//鏈�澶у
+var rect_max_width;
+var width;
+var height;
+var x;
+var y;
+var display_mode = "all";
+
+var edge_distance = 0;//璁剧疆杈硅窛
+
+var blockWidth = 30;//鑹插潡瀹藉害
+var blockHeight = 15;//鑹插潡楂樺害
+var curType = "z";//鏄剧ず绫诲瀷
+var curVal = 1; //鏄剧ず绫诲瀷鐨勫垪灞傝
+var shift;
+var out_window_top;
+var out_window_left;
+var out_window_width;
+
+//鍒濆鍖栧弬鏁帮紝濡傛灉琛屾暟澶т簬12鍒楋紝闅愯棌宸︿晶鍗$墖淇℃伅锛岃皟鏁村尯鍩熷搴�
+function initCanvasParam() {
+ if (cols > 12) {
+ $("#lq-left2").css("display", "none");
+ $("#lq-center").css("width", "100%");
+ $("#lq-center").css("overflow-x", "auto");
+ var wWidth = window.innerWidth;
+ var wHeight = window.innerHeight;
+ $("#lq-center").css("height", wHeight - 180);
+ if (wWidth < 1600) {
+ $("#canvas").attr("width", 1600);
+ } else {
+ $("#canvas").attr("width", wWidth - 100);
+ }
+ } else {
+ $("#lq-left2").css("display", "block");
+ $("#lq-center").css("width", "80%");
+ $("#canvas").attr("width", "1200");
+ }
+
+ oneWidth = 9 * blockWidth * getRatio();//涓�涓垎鍓插揩鐨勫搴�
+ oneHeight = 6 * blockHeight * getRatio();//涓�涓垎鍓插揩鐨勯珮搴�
+
+ back_height = oneHeight * 2.1 * (2 - rows / 30);
+ back_width = 3 * blockWidth * cols * (2 - cols / 30) / 2;
+ rect_max_width = back_width + 0.5 * oneWidth;
+ width = oneWidth * 4;
+ height = oneHeight * 5;
+ x = back_width / 2 - rect_max_width / 2;
+ y = back_width / 2 - oneHeight * 2.8;
+
+ var canvasParent = $("#canvas_parent");
+ out_window_top = canvasParent.offset().top;
+ out_window_left = canvasParent.offset().left;
+ out_window_width = canvasParent.width();
+};
+
+initCanvasParam();
+
+//鑹插潡棰滆壊甯搁噺
+var color = null;
+var R = 0;
+var G = 0;
+var B = 0;
+
+//琛屻�佸垪銆佸眰瑕佹樉绀虹偣鐨勯泦鍚�
+var x_points = [];
+var y_points = [];
+var z_points = [];
+
+//浜嬩欢(鏄剧ず鏂瑰紡鍒囨崲銆佸脊鍑虹偣鐨勪俊鎭�)鍒ゅ畾鍖哄煙瀵硅薄鐨勯泦鍚�
+var arr = [];
+
+//璁剧疆瀹氭椂鍣�
+var timer;
+var t = -2;
+
+function sleep() {
+ if (timer) {
+ clearInterval(timer);
+ }
+ t++;
+ if (t >= 0) {
+ flash();
+ }
+ timer = setTimeout("sleep()", 400);
+}
+
+//瀹氭椂瑙﹀彂鍑芥暟--鍒囨崲鏋佸�肩偣棰滆壊
+function flash() {
+ var canvas = document.getElementById('canvas');
+ var ctx = canvas.getContext('2d');
+ canvas.height = canvas.height;
+ ctx.strokeStyle = "black";
+ ctx.lineWidth = 1;
+ arr = [];
+ x_points = [];
+ y_points = [];
+ z_points = [];
+
+ //娓呯┖鍥惧舰鐢诲竷
+ canvas.height = canvas.height;
+ //閲嶆柊缁樺埗鍥惧舰鐢诲竷
+
+ createBack(ctx);
+ createLeft(ctx);
+ createBottom(ctx, back_height);
+
+ gainData(listPoints, curType, curVal);
+
+ split(ctx);
+
+ entityBlock(ctx, curType, curVal);
+
+ title(ctx);
+ border(ctx)
+}
+
+//缁樺埗涓荤▼搴�
+function draw() {
+ var canvas = document.getElementById('canvas');
+ var ctx = canvas.getContext('2d');
+
+ shift = out_window_left;
+ if ((out_window_width - canvas.width) > 0) {
+ shift = out_window_left + (out_window_width - canvas.width) / 2;
+ }
+ edge_distance = (canvas.width - (oneWidth / 2 + back_width + 78)) / 2 + 35;//璁剧疆杈硅窛
+
+ ctx.strokeStyle = "black";
+ ctx.lineWidth = 1;
+
+ createBack(ctx);
+ createLeft(ctx);
+ createBottom(ctx, back_height);
+ gainData(listPoints, curType, curVal);
+ split(ctx);
+ entityBlock(ctx, curType, curVal);
+
+ title(ctx);
+ showIndex(canvas, ctx);
+ border(ctx);
+
+};
+
+//缁樺埗鐭╁舰澶栬竟妗�
+function border(ctx) {
+ ctx.beginPath();
+ ctx.lineWidth = 0.5;
+ ctx.strokeStyle = 'black';
+ ctx.moveTo(oneWidth / 2 + back_width + edge_distance, 0 * oneHeight);
+ ctx.lineTo(back_width + edge_distance, 2 * oneHeight);
+ ctx.lineTo(edge_distance, 2 * oneHeight);
+ ctx.moveTo(back_width + edge_distance, 2 * oneHeight + 0.5 * back_height);
+ ctx.lineTo(back_width + edge_distance, 2 * oneHeight);
+ ctx.stroke();
+ ctx.closePath();
+}
+
+//鍒堕�犺櫄褰�
+function split(context) {
+ //璁剧疆鍒楀垏鍒嗚櫄褰�
+ for (i = 0; i <= cols; i++) {
+ var start_x = back_width / cols * i + edge_distance;
+ var start_y = 2 * oneHeight;
+ //璁剧疆閫忔槑搴�
+ context.fillStyle = "rgba(255,255,255,0.1)";
+ context.beginPath();
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x, start_y + 0.5 * back_height);
+ context.lineTo(start_x + oneWidth / 2, 0.5 * back_height);
+ context.lineTo(start_x + oneWidth / 2, 0);
+ context.lineTo(start_x, start_y);
+ context.fill();
+ context.closePath();
+ }
+
+ //璁剧疆琛屽垏鍒嗚櫄褰�
+ for (i = 0; i <= rows; i++) {
+
+ var start_x = oneWidth / 2 / rows * i + edge_distance;
+ var start_y = (2 * oneHeight) / rows * (rows - i);
+ //璁剧疆閫忔槑搴�
+ context.fillStyle = "rgba(255,255,255,0.1)";
+ // context.fillStyle = "rgba(150,150,150,1)";
+ context.beginPath();
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x + back_width, start_y);
+ context.lineTo(start_x + back_width, start_y + 0.5 * back_height);
+ context.lineTo(start_x, start_y + 0.5 * back_height);
+ context.lineTo(start_x, start_y);
+ context.fill();
+ context.closePath();
+ }
+
+ //璁剧疆灞傚垏鍒嗚櫄褰�
+ for (i = 0; i <= lays; i++) {
+ var start_x = oneWidth / 2 + edge_distance;
+ var y = (lays - i) * 0.5 * back_height / lays;
+ //璁剧疆閫忔槑搴�
+ context.fillStyle = "rgba(255,255,255,0.2)";
+ context.beginPath();
+ context.moveTo(start_x, y);
+ context.lineTo(start_x + back_width, y);
+ context.lineTo(back_width + edge_distance, 2 * oneHeight + y);
+ context.lineTo(edge_distance, 2 * oneHeight + y);
+ context.lineTo(start_x, y);
+ context.fill();
+ context.closePath();
+ }
+
+}
+
+function textbox(context, x, y, val, obj) {
+ if (val === null || val == -100 || val == -101) {
+ //璁剧疆绌哄�兼椂濉厖棰滆壊
+ context.fillStyle = "rgba(125,146,159,1)";
+ } else {
+ //璁剧疆鏈夊�兼椂濉厖棰滆壊
+ context.fillStyle = "rgba(50,66,81,1)";
+ //灏嗙偣鍑讳簨浠惰Е鍙戝尯鍩熷璞″啓鍏rr闆嗗悎
+ // alert(pointX)
+ arr.push({
+ 'x': x + shift - 10,
+ 'y': y + out_window_top - 10,
+ 'width': 40,
+ 'height': 25,
+ 'type': 'val',
+ 'pointX': obj['x'] + 1,
+ 'pointY': obj['y'] + 1,
+ 'pointZ': obj['z'] + 1,
+ 'val': val,
+ })
+ }
+ context.beginPath();
+ context.lineWidth = 1;
+ context.moveTo(x, y + 12);
+ context.lineTo(x + 5, y + 7);
+ context.arcTo(x + 15, y + 7, x + 15, y + 2, 5);
+ context.lineTo(x + 15, y - 3);
+ context.arcTo(x + 15, y - 8, x + 5, y - 8, 5);
+ context.lineTo(x - 10, y - 8);
+ context.arcTo(x - 15, y - 8, x - 15, y - 3, 5);
+ context.lineTo(x - 15, y + 2);
+ context.arcTo(x - 15, y + 7, x - 10, y + 7, 5);
+ context.lineTo(x - 5, y + 7)
+ context.lineTo(x, y + 12)
+ context.stroke();
+ context.fill();
+ context.textAlign = 'center';
+ context.fillStyle = "rgba(226,228,229,1)";
+
+ if (val === null || val <= -100) {
+ context.fillText("澶囩敤", x, y + 2);
+ } else if (val == -101) {
+ context.fillText("鏁呴殰", x, y + 2);
+ } else {
+ context.fillText(val, x, y + 2);
+ }
+ context.textAlign = 'left';
+ context.closePath();
+}
+
+//鏁版嵁绛涢��
+function gainData(listPoints, curType, curVal) {
+ z_peak = [0, lays - 1];
+ x_peak = [0, cols - 1];
+ y_peak = [0, rows - 1];
+
+ //褰撳眰鏄剧ず鏃讹紝鎶婅鏄剧ず鐨勭偣娣诲姞鍒皕_points
+ if (curType === 'z') {
+ for (var i = 0; i < listPoints.length; i++) {
+ //璁剧疆鍏ㄦ樉绀�
+ if (display_mode === "all") {
+ if (listPoints[i]['z'] + 1 === curVal) {
+ z_points.push(listPoints[i])
+ }
+ // 璁剧疆澶栭儴鏄剧ず
+ } else if (display_mode === "outside") {
+ if ((listPoints[i]['z'] + 1 === curVal)
+ && ((x_peak.includes(listPoints[i]['x'])) || (y_peak
+ .includes(listPoints[i]['y'])))) {
+ z_points.push(listPoints[i]);
+ }
+ //璁剧疆鍐呴儴鏄剧ず
+ } else {
+ if ((listPoints[i]['z'] + 1 === curVal)
+ && (!(x_peak.includes(listPoints[i]['x'])) && !(y_peak
+ .includes(listPoints[i]['y'])))) {
+ z_points.push(listPoints[i]);
+ }
+ }
+ }
+ }
+
+ //褰撳垪鏄剧ず鏃讹紝鎶婅鏄剧ず鐨勭偣娣诲姞鍒皒_points aaaa
+ if (curType === 'x') {
+ for (i = 0; i < listPoints.length; i++) {
+ //璁剧疆鍏ㄦ樉绀�
+ if (display_mode === "all") {
+ if (listPoints[i]['x'] === (cols - curVal)) {
+ x_points.push(listPoints[i])
+ }
+ } else if (display_mode === "outside") {// 璁剧疆澶栭儴鏄剧ず
+ if ((listPoints[i]['x'] === (cols - curVal))
+ && ((z_peak.includes(listPoints[i]['z'])) || (y_peak
+ .includes(listPoints[i]['y'])))) {
+ x_points.push(listPoints[i]);
+ }
+
+ } else {//璁剧疆鍐呴儴鏄剧ず
+ if ((listPoints[i]['x'] === (cols - curVal))
+ && (!(z_peak.includes(listPoints[i]['z'])) && !(y_peak
+ .includes(listPoints[i]['y'])))) {
+ x_points.push(listPoints[i]);
+ }
+ }
+ }
+ }
+
+ //褰撹鏄剧ず鏃讹紝鎶婅鏄剧ず鐨勭偣娣诲姞鍒皔_points
+ if (curType === 'y') {
+ for (i = 0; i < listPoints.length; i++) {
+
+ //璁剧疆鍏ㄦ樉绀�
+ if (display_mode === "all") {
+ if (listPoints[i]['y'] + 1 === curVal) {
+ y_points.push(listPoints[i])
+ }
+ // 璁剧疆澶栭儴鏄剧ず
+ } else if (display_mode === "outside") {
+ if ((listPoints[i]['y'] + 1 === curVal)
+ && ((z_peak.includes(listPoints[i]['z'])) || (x_peak
+ .includes(listPoints[i]['x'])))) {
+ y_points.push(listPoints[i]);
+ }
+ //璁剧疆鍐呴儴鏄剧ず
+ } else {
+ if ((listPoints[i]['y'] + 1 === curVal)
+ && (!(z_peak.includes(listPoints[i]['z'])) && !(x_peak
+ .includes(listPoints[i]['x'])))) {
+ y_points.push(listPoints[i]);
+ }
+ }
+ }
+ }
+}
+
+//鐢熸垚鑹插潡
+function entityBlock(context, curType, curVal) {
+
+ //瀹氫箟琛屽眰鍒楅棿闅�
+ var y_interval = 2 * oneHeight / rows;
+ var x_interval = back_width / cols;
+ var z_interval = 0.5 * back_height / lays;
+
+ //鏄剧ず鏂瑰紡涓哄眰
+ if (curType === 'z') {
+ //鐢熸垚琛�
+ for (i = 1; i <= rows; i++) {
+ var start_x = (oneWidth / 2 / rows) * (i - 1) + edge_distance;
+ var start_y = (2 * oneHeight / rows) * (rows - i + 1) + curVal
+ * z_interval;
+
+ //鐢熸垚鍒�
+ for (j = 1; j <= cols; j++) {
+
+ //澶栭儴鏄剧ず
+ if ((display_mode === "outside") && !y_peak.includes(i - 1)
+ && !x_peak.includes(j - 1)) {
+ start_x += x_interval;
+ continue;
+ //鍐呴儴鏄剧ず
+ } else if ((display_mode === "inner")
+ && (y_peak.includes(i - 1) || x_peak.includes(j - 1))) {
+ start_x += x_interval;
+ continue;
+ }
+
+ //澹版槑鑹插潡鏁板��
+ var val = null;
+ //澹版槑鐐圭殑搴忓垪鍊�
+ var index = null;
+
+ //寰幆閬嶅巻鎵惧埌瀵瑰簲鑹插潡
+ for (k = 0; k < z_points.length; k++) {
+ if ((z_points[k]['y'] + 1 === i)
+ && (z_points[k]['x'] + 1 === j)) {
+ val = z_points[k]['temp']
+ index = k;
+ break;
+ }
+ }
+
+ //缁樺埗鑹插潡
+ context.beginPath();
+ context.lineWidth = 1;
+ context.strokeStyle = 'rgba(224,235,242,1)'
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x + x_interval, start_y);
+ context.lineTo(start_x + x_interval + (oneWidth / 2 / rows),
+ start_y - y_interval);
+ context.lineTo(start_x + (oneWidth / 2 / rows), start_y
+ - y_interval);
+ context.lineTo(start_x, start_y);
+
+ //璁剧疆瀵瑰簲棰滆壊
+ if (val === null || val == -100 || val == -101) {
+ context.fillStyle = "rgba(155,171,182,1)";
+ // val = "澶囩敤";
+ } else {
+ if (t % 2 === 1) {
+ if (listLays[curVal - 1]['tempMax'] && val == listLays[curVal - 1]['tempMax']) { //姝ょ偣涓烘渶楂樻俯
+ context.fillStyle = "rgba(229,29,29,1)";
+ } else if (listLays[curVal - 1]['tempMin'] && val == listLays[curVal - 1]['tempMin']) { //姝ょ偣涓烘渶浣庢俯
+ context.fillStyle = "rgba(0,255,28,1)";
+ } else {
+ context.fillStyle = getColor(val);
+ }
+ } else {
+ context.fillStyle = getColor(val);
+ }
+ }
+ context.fill();
+ context.stroke();
+ context.closePath();
+
+ //缁樺埗鐐规枃鏈
+ textbox(context, start_x + 0.5 * x_interval + 0.5
+ * (oneWidth / 2 / rows), start_y - 0.5 * y_interval,
+ val, z_points[index]);
+ //淇敼鑹插潡璧峰鍊�
+ start_x += x_interval;
+ }
+ }
+ //鏄剧ず鏂瑰紡涓鸿
+ } else if (curType === 'y') {
+ //鐢熸垚灞�
+ for (var i = 1; i <= lays; i++) {
+ var start_x = (oneWidth / 2 / rows) * (curVal - 1) + edge_distance;
+ var start_y = (2 * oneHeight / rows) * (rows - curVal + 1) + i
+ * z_interval;
+
+ //鐢熸垚鍒�
+ for (var j = 1; j <= cols; j++) {
+
+ //澶栭儴鏄剧ず
+ if ((display_mode === "outside") && !z_peak.includes(i - 1)
+ && !x_peak.includes(j - 1)) {
+ start_x += x_interval;
+ continue;
+ //鍐呴儴鏄剧ず
+ } else if ((display_mode === "inner")
+ && (z_peak.includes(i - 1) || x_peak.includes(j - 1))) {
+ start_x += x_interval;
+ continue;
+ }
+
+ //澹版槑鑹插潡鏁板��
+ var val = null;
+ //澹版槑鐐圭殑搴忓垪鍊�
+ var index = null;
+
+ //寰幆閬嶅巻鎵惧埌瀵瑰簲鑹插潡
+ for (k = 0; k < y_points.length; k++) {
+ if ((y_points[k]['z'] + 1 === i)
+ && (y_points[k]['x'] + 1 === j)) {
+ val = y_points[k]['temp']
+ index = k;
+ break;
+ }
+ }
+
+ ////缁樺埗涓�涓壊鍧�,鏄剧ず鏂瑰紡涓烘瑙嗗浘
+ context.fillStyle = "rgba(155,171,182,1)";
+ context.beginPath();
+ context.lineWidth = 1.5;
+ context.strokeStyle = 'rgba(224,235,242,1)'
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x + x_interval, start_y);
+ context.lineTo(start_x + x_interval, start_y - z_interval);
+ context.lineTo(start_x, start_y - z_interval);
+ context.lineTo(start_x, start_y);
+
+ //璁剧疆瀵瑰簲棰滆壊
+ if (val === null || val == -100) {
+ context.fillStyle = "rgba(155,171,182,1)";
+ } else {
+ if (t % 2 === 1) {
+ if (val == listRows[curVal - 1]['tempMax']) { //姝ょ偣涓烘渶楂樻俯
+ context.fillStyle = "rgba(229,29,29,1)";
+ } else if (val == listRows[curVal - 1]['tempMin']) { //姝ょ偣涓烘渶浣庢俯
+ context.fillStyle = "rgba(0,255,28,1)";
+ } else {
+ context.fillStyle = getColor(val);
+ }
+ } else {
+ context.fillStyle = getColor(val);
+
+ }
+ }
+
+ context.fill();
+ context.stroke();
+ context.closePath();
+
+ //缁樺埗鐐规枃鏈
+ textbox(context, start_x + 0.4 * x_interval, start_y - 0.5
+ * z_interval, val, y_points[index]);
+
+ //淇敼鑹插潡璧峰鍊�
+ start_x += x_interval;
+ }
+ }
+
+ //鏄剧ず鏂瑰紡涓哄垪
+ } else if (curType === 'x') {
+
+ //鐢熸垚涓�灞�
+ for (var i = lays; i > 0; i--) {
+ var start_x = (cols - curVal) * x_interval + edge_distance;
+ var start_y = (2 * oneHeight / rows) * (rows) + i * z_interval;
+
+ //鐢熸垚涓�琛�
+ for (var j = 1; j <= rows; j++) {
+
+ //澶栭儴鏄剧ず
+ if ((display_mode === "outside") && !z_peak.includes(i - 1)
+ && !y_peak.includes(j - 1)) {
+ start_x += (oneWidth / 2 / rows);
+ start_y -= (2 * oneHeight / rows);
+ continue;
+ //鍐呴儴鏄剧ず
+ } else if ((display_mode === "inner")
+ && (z_peak.includes(i - 1) || y_peak.includes(j - 1))) {
+ start_x += (oneWidth / 2 / rows);
+ start_y -= (2 * oneHeight / rows);
+ continue;
+ }
+
+ //澹版槑鑹插潡鏁板��
+ var val = null;
+ //澹版槑鐐圭殑搴忓垪鍊�
+ var index = null;
+
+ //寰幆閬嶅巻鎵惧埌瀵瑰簲鑹插潡
+ for (var k = 0; k < x_points.length; k++) {
+ if ((x_points[k]['y'] + 1 === j)
+ && (x_points[k]['z'] === (i - 1))) {
+ val = x_points[k]['temp'];
+ index = k;
+ break;
+ }
+ }
+ ;
+
+ //缁樺埗涓�涓壊鍧�,鏄剧ず鏂瑰紡涓轰晶瑙嗗浘
+ context.fillStyle = "rgba(155,171,182,1)";
+ context.beginPath();
+ context.lineWidth = 1.5;
+ context.strokeStyle = 'rgba(224,235,242,1)'
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x + (oneWidth / 2 / rows), start_y
+ - y_interval);
+ context.lineTo(start_x + (oneWidth / 2 / rows), start_y
+ - y_interval - z_interval);
+ context.lineTo(start_x, start_y - z_interval);
+ context.lineTo(start_x, start_y);
+
+ //璁剧疆瀵瑰簲棰滆壊
+ if (val === null || val == -100) {
+ context.fillStyle = "rgba(155,171,182,1)";
+ } else {
+ context.fillStyle = getColor(val);
+ }
+
+ context.fill();
+ context.stroke();
+ context.closePath();
+
+ //缁樺埗鐐规枃鏈
+ textbox(context, start_x + 0.5 * (oneWidth / 2 / rows), start_y
+ - 0.5 * y_interval - 0.5 * z_interval, val,
+ x_points[index]);
+
+ //淇敼鑹插潡璧峰鍊�
+ start_x += (oneWidth / 2 / rows);
+ start_y -= (2 * oneHeight / rows);
+ }
+ }
+ }
+}
+
+//缁戝畾瑙﹀彂鐨勪簨浠�
+function draws(x, y, canvas, ctx) {
+ //鍒涘缓鐐瑰嚮浜嬩欢鐨勭敾甯冿紙鐢诲竷2锛夐渶瑕佽�冭檻鐖舵鐨勪綅缃�
+ ctx.rect(0, 0, canvas.width, canvas.height);
+ //缁檃rr闆嗗悎涓殑姣忎竴涓璞℃坊鍔犵偣鍑讳簨浠�
+ arr.forEach(function (v, i) {
+ ctx.beginPath();
+ //缁樺埗姣忎竴涓璞$殑鍖哄煙
+ ctx.rect(v.x, v.y, v.width, v.height);
+ ctx.closePath();
+
+ //鍒ゆ柇鐐瑰嚮鐐规槸鍚﹀湪鍖哄煙涓�
+ if (ctx.isPointInPath(x, y)) {
+ //鍒ゆ柇鐐瑰嚮鍖哄煙绫诲瀷
+ if (v.type === 'val') {
+ //绫诲瀷涓簐al锛屽垯寮瑰嚭鐐逛俊鎭�
+ // showData = "x=" + v.pointX + "\ny=" + v.pointY + "\nz=" + v.pointZ;
+ // alert(showData)
+ layer.msg("灞�=" + (v.pointZ) + "\n琛�=" + (v.pointY) + "\n鍒�=" + (cols - v.pointX + 1) + "\n娓╁害="
+ + v.val);
+ } else { //鍏朵粬绫诲瀷鍒欏垏鎹㈡樉绀鸿壊鍧�
+ //娓呯┖鏁版嵁
+ curType = v['type'];
+ curVal = v['num'];
+ if (curType === 'x') {
+ curVal = cols - v['num'] + 1;
+ }
+ arr = [];
+ x_points = [];
+ y_points = [];
+ z_points = [];
+
+ //娓呯┖鍥惧舰鐢诲竷
+ canvas.height = canvas.height;
+ //閲嶆柊缁樺埗
+ createBack(ctx);
+ createLeft(ctx);
+ createBottom(ctx, back_height);
+ gainData(listPoints, curType, curVal);
+ split(ctx);
+ entityBlock(ctx, curType, curVal);
+ title(ctx);
+ border(ctx);
+
+ //鏇存敼Btn鍚嶇О锛屽悓鏃舵洿鏂板眰琛屽垪鐨勯�夋嫨
+ updateGrainBtn(true);
+
+ //鍒囨崲涓哄眰鏄剧ず
+ if (v['type'] === 'z') {
+ //璧峰鐐�
+ start_x = v['start_x'];
+ start_y = v['start_y'];
+
+ //璁捐鐐瑰嚮鏃剁殑娓愬彉
+ var grad = ctx.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#2f2fff");
+ grad.addColorStop(0.3, "#5858ff");
+ grad.addColorStop(0.7, "#b3b3ff");
+ grad.addColorStop(1, "#ffffff");
+ ctx.fillStyle = grad;
+
+ //寮�濮嬬粯鍒�
+ ctx.beginPath();
+ ctx.lineWidth = 5;
+ ctx.strokeStyle = 'rgba(214,223,232,1)';
+ ctx.moveTo(start_x, start_y);
+ ctx.lineTo(start_x + 75, start_y);
+ ctx.lineTo(start_x + 75, start_y - 0.5
+ * (back_height / lays));
+ ctx.lineTo(start_x, start_y - 0.5 * (back_height / lays));
+
+ ctx.lineTo(start_x, start_y);
+ ctx.stroke();
+ ctx.fill();
+
+ //鏍囬鏍忔枃鏈�
+ ctx.fillStyle = 'rgba(255,14,0,1)';
+ val = "绗�" + v['num'] + "灞�";
+ ctx.font = "15px Arial";
+ ctx.fillText(val, start_x + 10, start_y + 5 - 0.5
+ * (back_height / lays) / 2);
+
+ //鍒囨崲涓鸿鏄剧ず
+ } else if (v['type'] === 'y') {
+ //璧峰鐐�
+ start_x = v['start_x'];
+ start_y = v['start_y'];
+
+ //璁捐鐐瑰嚮鏃剁殑娓愬彉
+ var grad = ctx.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#2f2fff");
+ grad.addColorStop(0.3, "#5858ff");
+ grad.addColorStop(0.7, "#b3b3ff");
+ grad.addColorStop(1, "#ffffff");
+ ctx.fillStyle = grad;
+
+ //寮�濮嬬粯鍒�
+ ctx.beginPath();
+ ctx.lineWidth = 5;
+ ctx.strokeStyle = 'rgba(214,223,232,1)';
+ ctx.moveTo(start_x, start_y);
+ ctx.lineTo(start_x + 75, start_y);
+ ctx.lineTo(start_x + 75 + (oneWidth / 2 / rows), start_y
+ - (2 * oneHeight / rows));
+ ctx.lineTo(start_x + (oneWidth / 2 / rows), start_y
+ - (2 * oneHeight / rows));
+ ctx.lineTo(start_x, start_y);
+ ctx.stroke();
+ ctx.fill();
+
+ //鏍囬鏍忔枃鏈�
+ ctx.fillStyle = 'rgba(255,14,0,1)';
+ val = "绗�" + v['num'] + "琛�";
+
+ if (rows > 10) {
+ ctx.font = "12px Arial";
+ ctx.fillText(val, start_x + 25, start_y - 5);
+ } else {
+ ctx.font = "15px Arial";
+ ctx.fillText(val, start_x + 25, start_y - 9);
+ }
+
+ //鍒囨崲涓哄垪鏄剧ず
+ } else if (v['type'] === 'x') {
+ //璧峰鐐�
+ start_x = v['start_x'];
+ start_y = v['start_y'];
+
+ //璁捐鐐瑰嚮鏃剁殑娓愬彉
+ var grad = ctx.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#2f2fff");
+ grad.addColorStop(0.3, "#5858ff");
+ grad.addColorStop(0.7, "#b3b3ff");
+ grad.addColorStop(1, "#ffffff");
+ ctx.fillStyle = grad;
+
+ //寮�濮嬬粯鍒�
+ ctx.beginPath();
+ ctx.lineWidth = 5;
+ ctx.strokeStyle = 'rgba(214,223,232,1)';
+ ctx.moveTo(start_x, start_y);
+ ctx.lineTo(start_x - (oneWidth / 2 / rows), start_y
+ + (2 * oneHeight / rows));
+ ctx.lineTo(start_x + (back_width / cols)
+ - (oneWidth / 2 / rows), start_y
+ + (2 * oneHeight / rows));
+ ctx.lineTo(start_x + (back_width / cols), start_y);
+ ctx.lineTo(start_x, start_y);
+ ctx.stroke();
+ ctx.fill();
+
+ //鏍囬鏍忔枃鏈�
+ ctx.fillStyle = 'rgba(255,14,0,1)';
+ val = "绗�" + (cols - v['num'] + 1) + "鍒�";
+ ctx.font = "15px Arial";
+ ctx.fillText(val, start_x - 0.5 * (oneWidth / 2 / rows),
+ start_y + 0.7 * (2 * oneHeight / rows));
+ }
+ }
+ }
+ });
+}
+
+//缁戝畾浜嬩欢
+function showIndex(canvas, ctx) {
+
+ //鏁翠釜鐢诲竷瀵硅薄娣诲姞鐐瑰嚮浜嬩欢
+ canvas.addEventListener('click', function location(e) {
+ x = e.clientX;
+ y = e.clientY;
+ draws(x, y, canvas, ctx);
+ }, false);
+}
+
+//琛屻�佸垪銆佸眰鏍囬鏍�
+function title(context) {
+
+ //灞傛爣棰樻爮
+ for (i = 1; i <= lays; i++) {
+ //璁剧疆璧峰鐐�
+ start_x = (oneWidth / 2) + back_width + edge_distance + 3;
+ start_y = 0.5 * (back_height / lays) * i;
+
+ //璁剧疆涓洪�夋嫨鏃剁殑娓愬彉濉厖
+ if ((curType === "z") && (curVal === i)) {
+ var grad = context.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#2f2fff");
+ grad.addColorStop(0.3, "#5858ff");
+ grad.addColorStop(0.7, "#b3b3ff");
+ grad.addColorStop(1, "#ffffff");
+ //璁剧疆涓烘湭閫夋嫨鏃剁殑娓愬彉濉厖
+ } else {
+ var grad = context.createLinearGradient(start_x, start_y,
+ start_x + 200, start_y);
+ grad.addColorStop(0, "#ffffff");
+ grad.addColorStop(0.8, "#a2baef");
+ }
+ context.fillStyle = grad;
+
+ //缁樺埗
+ context.beginPath();
+ context.lineWidth = 5;
+ context.strokeStyle = 'rgba(214,223,232,1)';
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x + 75, start_y);
+ context.lineTo(start_x + 75, start_y - 0.5 * (back_height / lays));
+ context.lineTo(start_x, start_y - 0.5 * (back_height / lays));
+ context.lineTo(start_x, start_y);
+ context.stroke();
+ context.fill();
+
+ //璁剧疆涓洪�夋嫨鏃剁殑瀛椾綋濉厖
+ if ((curType === "z") && (curVal === i)) {
+ context.fillStyle = 'rgba(255,14,0,1)';
+ //璁剧疆涓烘湭閫夋嫨鏃剁殑瀛椾綋濉厖
+ } else {
+ context.fillStyle = 'rgba(30,30,30,1)';
+ }
+
+ //璁剧疆鏍囬鏂囨湰
+ val = "绗�" + i + "灞�";
+ context.font = "15px Arial";
+ context.fillText(val, start_x + 10, start_y + 5 - 0.5
+ * (back_height / lays) / 2);
+
+ //灏嗘樉绀烘柟寮忓垏鎹簨浠跺姞鍏rr鏁扮粍
+ arr.push({
+ 'x': start_x + 10 + shift,
+ 'y': start_y - 0.5 * (back_height / lays) / 2 - 22
+ + out_window_top,
+ 'width': 60,
+ 'height': 40,
+ 'type': 'z',
+ 'num': i,
+ 'start_x': start_x,
+ 'start_y': start_y
+ })
+ context.closePath();
+ }
+
+ //琛屾爣棰樻爮
+ for (i = 1; i <= rows; i++) {
+ //璁剧疆璧峰鐐�
+ start_x = back_width + (oneWidth / 2 / rows) * (i - 1) + edge_distance;
+ start_y = (2 * oneHeight + 0.5 * back_height) - (2 * oneHeight / rows)
+ * (i - 1) + 5;
+
+ //璁剧疆涓洪�夋嫨鏃剁殑娓愬彉濉厖
+ if ((curType === "y") && (curVal === i)) {
+ var grad = context.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#2f2fff");
+ grad.addColorStop(0.3, "#5858ff");
+ grad.addColorStop(0.7, "#b3b3ff");
+ grad.addColorStop(1, "#ffffff");
+ //璁剧疆涓烘湭閫夋嫨鏃剁殑娓愬彉濉厖
+ } else {
+ var grad = context.createLinearGradient(start_x, start_y,
+ start_x + 200, start_y);
+ grad.addColorStop(0, "#ffffff");
+ grad.addColorStop(0.8, "#a2baef");
+ }
+ context.fillStyle = grad;
+
+ //缁樺埗
+ context.beginPath();
+ context.lineWidth = 5;
+ context.strokeStyle = 'rgba(215,224,230,1)';
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x + 75, start_y);
+ context.lineTo(start_x + 75 + (oneWidth / 2 / rows), start_y
+ - (2 * oneHeight / rows));
+ context.lineTo(start_x + (oneWidth / 2 / rows), start_y
+ - (2 * oneHeight / rows));
+ context.lineTo(start_x, start_y);
+ context.stroke();
+ context.fill();
+
+ //璁剧疆涓洪�夋嫨鏃剁殑瀛椾綋濉厖
+ if ((curType === "y") && (curVal === i)) {
+ context.fillStyle = 'rgba(255,14,0,1)';
+ //璁剧疆涓烘湭閫夋嫨鏃剁殑瀛椾綋濉厖
+ } else {
+ context.fillStyle = 'rgba(30,30,30,1)';
+ }
+
+ //璁剧疆鏍囬鏂囨湰
+ val = "绗�" + i + "琛�";
+ if (rows > 10) {
+ context.font = "12px Arial";
+ context.fillText(val, start_x + 25, start_y - 5);
+ } else {
+ context.font = "15px Arial";
+ context.fillText(val, start_x + 25, start_y - 9);
+ }
+
+ //灏嗘樉绀烘柟寮忓垏鎹簨浠跺姞鍏rr鏁扮粍
+ arr.push({
+ 'x': start_x + blockWidth + shift,
+ 'y': start_y - blockHeight + out_window_top,
+ 'width': 50,
+ 'height': 20,
+ 'type': 'y',
+ 'num': i,
+ 'start_x': start_x,
+ 'start_y': start_y
+ })
+ context.closePath();
+ }
+
+ //鍒楁爣棰樻爮
+ for (i = 1; i <= cols; i++) {
+ //璁剧疆璧峰鐐�
+ start_x = (back_width / cols) * (i - 1) + edge_distance;
+ start_y = (2 * oneHeight + 0.5 * back_height) + 5;
+
+ //璁剧疆涓洪�夋嫨鏃剁殑娓愬彉濉厖
+ if ((curType === "x") && (curVal === (cols - i + 1))) {
+ var grad = context.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#2f2fff");
+ grad.addColorStop(0.3, "#5858ff");
+ grad.addColorStop(0.7, "#b3b3ff");
+ grad.addColorStop(1, "#ffffff");
+ context.strokeStyle = 'rgba(100,100,255,1)';
+ //璁剧疆涓烘湭閫夋嫨鏃剁殑娓愬彉濉厖
+ } else {
+ context.strokeStyle = 'rgba(215,224,230,1)';
+ var grad = context.createLinearGradient(start_x, start_y,
+ start_x + 120, start_y);
+ grad.addColorStop(0, "#ffffff");
+ grad.addColorStop(0.8, "#a2baef");
+ }
+ context.fillStyle = grad;
+
+ //缁樺埗
+ context.beginPath();
+ context.lineWidth = 5;
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x - (oneWidth / 2 / rows), start_y
+ + (2 * oneHeight / rows));
+ context.lineTo(start_x + (back_width / cols) - (oneWidth / 2 / rows),
+ start_y + (2 * oneHeight / rows));
+ context.lineTo(start_x + (back_width / cols), start_y);
+ context.lineTo(start_x, start_y);
+ context.stroke();
+ context.fill();
+
+ //璁剧疆涓洪�夋嫨鏃剁殑瀛椾綋濉厖
+ if ((curType === "x") && (curVal === (cols - i + 1))) {
+ context.fillStyle = 'rgba(255,14,0,1)';
+ //璁剧疆涓烘湭閫夋嫨鏃剁殑瀛椾綋濉厖
+ } else {
+ context.fillStyle = 'rgba(30,30,30,1)';
+ }
+ val = "绗�" + (cols - i + 1) + "鍒�";
+ context.font = "15px Arial";
+ context.fillText(val, start_x - 0.5 * (oneWidth / 2 / rows), start_y
+ + 0.7 * (2 * oneHeight / rows));
+ //灏嗘樉绀烘柟寮忓垏鎹簨浠跺姞鍏rr鏁扮粍
+ arr.push({
+ 'x': start_x - 0.3 * (oneWidth / 2 / rows) + shift,
+ 'y': start_y + 0.5 * (2 * oneHeight / rows) + out_window_top,
+ 'width': 55,
+ 'height': 25,
+ 'type': 'x',
+ 'num': i,
+ 'start_x': start_x,
+ 'start_y': start_y
+ })
+ context.closePath();
+ }
+
+}
+
+//鍒堕�犲簳鐭╁舰
+function createBottom(context, y) {
+ //璁剧疆濉厖鏍峰紡
+ var gra = context.createRadialGradient(oneWidth, oneHeight, 0,
+ oneWidth / 2, oneHeight / 2, width * 100);
+ gra.addColorStop(0, "#c9dde8");
+ // gra.addColorStop(0.8, "white");
+ gra.addColorStop(1, "#c0deea");
+ var start_x = oneWidth / 2 + edge_distance;
+
+ //缁樺埗鐭╁舰
+ context.fillStyle = "rgba(168,208,225,1)";
+ context.fillStyle = gra;
+ context.beginPath();
+ context.moveTo(start_x, 0.5 * back_height);
+ context.lineTo(edge_distance, 2 * oneHeight + 0.5 * back_height);
+ context.lineTo(edge_distance + back_width, 2 * oneHeight + 0.5
+ * back_height);
+ context.lineTo(start_x + back_width, 0.5 * back_height);
+ context.lineWidth = 1.5;
+ context.fill();
+ context.stroke();
+ context.closePath();
+}
+
+//鍒堕�犺儗鐭╁舰
+function createBack(context) {
+
+ //璁剧疆濉厖鏍峰紡
+ var gra = context.createRadialGradient(oneWidth, oneHeight, 0,
+ oneWidth / 2, oneHeight / 2, width * 100);
+ gra.addColorStop(0, "#a8d0e1");
+ gra.addColorStop(1, "white");
+
+ //缁樺埗
+ var start_x = oneWidth / 2 + edge_distance
+ var start_y = 0
+ context.fillStyle = "rgba(168,208,225,1)";
+ context.fillStyle = gra;
+ context.beginPath();
+ context.moveTo(start_x, start_y);
+
+ context.lineTo(start_x + back_width, start_y);
+ context.lineTo(start_x + back_width, 0.5 * back_height);
+
+ context.lineTo(start_x, 0.5 * back_height);
+ context.lineTo(start_x, start_y);
+ context.lineWidth = 1.5;
+ context.fill();
+ context.stroke();
+ context.closePath();
+}
+
+//鍒堕�犲乏鐭╁舰
+function createLeft(context) {
+ //缁樺埗
+ var start_x = edge_distance;
+ var start_y = 2 * oneHeight;
+ context.fillStyle = "rgba(168,208,225,1)";
+ context.beginPath();
+ context.moveTo(start_x, start_y);
+ context.lineTo(start_x, start_y + 0.5 * back_height);
+ context.lineTo(oneWidth / 2 + start_x, 0.5 * back_height);
+ context.lineTo(oneWidth / 2 + start_x, 0);
+ context.lineTo(start_x, start_y);
+ context.lineWidth = 1.5;
+ context.stroke();
+ context.fill();
+ context.closePath();
+}
+
+//鑾峰彇绾垫í姣�
+function getRatio() {
+ var tmp = 1.3;
+ if (Screen.height > 1050) {
+ tmp = 1.05
+ if (rows <= 5)
+ tmp = 1.3
+ else if ((rows >= 6) && (rows <= 7))
+ tmp = 1.2
+ else if ((rows >= 8) && (rows <= 9))
+ tmp = 1.1
+ } else if ((Screen.height <= 1050) && (Screen.height > 960)) {
+ tmp = 1;
+ if (rows <= 5)
+ tmp = 1.3
+ else if ((rows >= 6) && (rows <= 7))
+ tmp = 1.2
+ else if ((rows >= 8) && (rows <= 9))
+ tmp = 1.1
+ } else if ((Screen.height <= 960) && (Screen.height > 900)) {
+ tmp = 0.9;
+ if (rows <= 7)
+ tmp = 1.2
+ else if (rows === 8)
+ tmp = 1.1
+ else if (rows === 9)
+ tmp = 1
+ } else if ((Screen.height <= 900) && (Screen.height > 800)) {
+ tmp = 0.8;
+ if (rows <= 6)
+ tmp = 1.2
+ else if (rows === 7)
+ tmp = 1.1
+ else if (rows === 8)
+ tmp = 1
+ else if (rows === 9)
+ tmp = 0.9
+ } else if ((Screen.height <= 800) && (Screen.height > 768)) {
+ tmp = 0.75;
+ if (rows <= 6)
+ tmp = 1.2
+ else if (rows === 7)
+ tmp = 1
+ else if (rows === 8)
+ tmp = 0.9
+ else if (rows === 9)
+ tmp = 0.8
+ } else if ((Screen.height <= 768) && (Screen.height > 720)) {
+ tmp = 0.75;
+ if (rows <= 6)
+ tmp = 1.1
+ else if (rows === 7)
+ tmp = 1
+ else if (rows === 8)
+ tmp = 0.9
+ else if (rows === 9)
+ tmp = 0.8
+ back_height = oneHeight * 2.1 * (2 - rows / 10) * 0.7
+ } else if (Screen.height <= 720) {
+ tmp = 0.66;
+ if (rows <= 6)
+ tmp = 1
+ else if (rows === 7)
+ tmp = 0.9
+ else if (rows === 8)
+ tmp = 0.8
+ else if (rows === 9)
+ tmp = 0.7
+ }
+
+ return tmp;
+}
+
+//鏍规嵁娓╁害鑾峰彇RGB
+function getColor(val) {
+ if (val >= 50) {
+ color = "rgba(255,0,0,1)";
+ return color;
+ } else if (val >= 20) {
+ G = Math.round(255 - 255 * ((val - 20) / 30));
+ color = "rgba(255," + G + ",0,1)";
+ return color;
+ } else if (val >= 0) {
+ R = Math.round(100 + (155 / 20) * val);
+ B = Math.round(30 - 1.5 * val);
+ color = "rgba(" + R + ",255," + B + ",1)";
+ return color;
+ } else if (val >= -10) {
+ R = Math.round(100 - 6.6 * (val * (-1)));
+ G = Math.round(255 - 2.2 * (val * (-1)));
+ B = Math.round(30 + 1.2 * (val * (-1)));
+ color = "rgba(" + R + "," + G + "," + B + ",1)";
+ return color;
+ } else {
+ color = "rgba(34,233,42,1)";
+ return color;
+ }
+}
+
+//涓嬩竴涓偣鍑讳簨浠�
+function next() {
+ if (curType === "x") {
+ if (curVal === Number(cols)) {
+ curVal = 1;
+ } else {
+ curVal += 1;
+ }
+ } else if (curType === "y") {
+ if (curVal === Number(rows)) {
+ curVal = 1;
+ } else {
+ curVal += 1;
+ }
+ } else {
+ if (curVal === Number(lays)) {
+ curVal = 1;
+ } else {
+ curVal += 1;
+ }
+ }
+ flash();
+ updateTemp();
+}
+
+//涓婁竴涓偣鍑讳簨浠�
+function last() {
+ if (curType === "x") {
+ if (curVal === 1) {
+ curVal = Number(cols);
+ } else {
+ curVal -= 1;
+ }
+ } else if (curType === "y") {
+ if (curVal === 1) {
+ curVal = Number(rows);
+ } else {
+ curVal -= 1;
+ }
+ } else {
+ if (curVal === 1) {
+ curVal = Number(lays);
+ } else {
+ curVal -= 1;
+ }
+ }
+ flash();
+ updateTemp();
+}
+
+//灞傛樉绀虹偣鍑讳簨浠�
+function lay() {
+ curType = "z";//鏄剧ず绫诲瀷
+ curVal = 1;
+ flash();
+ updateGrainBtn(false);
+
+};
+
+//鍒楁樉绀虹偣鍑讳簨浠�
+function col() {
+ curType = "x";//鏄剧ず绫诲瀷
+ curVal = 1;
+ flash();
+ updateGrainBtn(false);
+};
+
+//琛屾樉绀虹偣鍑讳簨浠�
+function row() {
+ curType = "y";//鏄剧ず绫诲瀷
+ curVal = 1;
+ flash();
+ updateGrainBtn(false);
+};
+
+//鍏ㄩ儴鏄剧ず鐐瑰嚮浜嬩欢
+function display_all() {
+ display_mode = "all";
+ flash();
+}
+
+//澶栭儴鏄剧ず鐐瑰嚮浜嬩欢
+function display_outside() {
+ display_mode = "outside";
+ flash();
+}
+
+//鍐呴儴鏄剧ず鐐瑰嚮浜嬩欢
+function display_inside() {
+ display_mode = "inner";
+ flash();
+}
+
+// 鍒濆鍖栦笁缁寸伯鎯�
+function initGrainChar3d() {
+ draw();
+};
+
+function clearGrainChart3d() {
+ listPoints = [];
+ listLays = [];
+ listRows = [];
+ lays = 4;
+ rows = 5;
+ cols = 8;
+ curType = "z";
+ curVal = 1;
+ initCanvasParam();
+ draw();
+};
+
+//閲嶆柊娓叉煋
+function resetGrainChart3d() {
+ listPoints = grainData.listPoints;
+ listLays = grainData.listLays;
+ listRows = grainData.listRows;
+ var attr = grainData.cable.split("-");
+ lays = attr[0];
+ rows = attr[1];
+ cols = attr[2];
+
+ initCanvasParam();
+
+ draw();
+ sleep();//寮�濮嬮棯鐑�
+ curType = "z";
+ curVal = 1;
+
+ updateTemp();
+}
+
+//鏇存柊Btn鍚嶇О
+function updateGrainBtn(isUpdateSelect) {
+ var btnNext = $("#btn_next");
+ var btnPre = $("#btn_pre");
+ if ("z" === curType) {
+ btnNext.text("涓嬩竴灞�");
+ btnPre.text("涓婁竴灞�");
+ }
+ if ("y" === curType) {// 琛屾煡鐪�
+ btnNext.text("涓嬩竴琛�");
+ btnPre.text("涓婁竴琛�");
+ }
+ if ("x" === curType) {// 鍒楁煡鐪�
+ btnNext.text("涓嬩竴鍒�");
+ btnPre.text("涓婁竴鍒�");
+ }
+
+ //闇�鏀规俯搴�
+ updateTemp();
+
+};
+
+function updateTemp() {
+ //鏇存柊灞傛俯锛岃娓╁害淇℃伅
+ if ("z" === curType) {
+ $.each(listLays, function (index, item) {
+ if (item.z === (curVal - 1)) {
+ // 鏇存柊灞備俊鎭�
+ $("#dynamicAve").text(item.tempAve);
+ $("#dynamicMax").text(item.tempMax);
+ $("#dynamicMin").text(item.tempMin);
+ $("#dynamicAveName").text("灞傚潎娓�");
+ $("#dynamicMaxName").text("灞傞珮娓�");
+ $("#dynamicMinName").text("灞備綆娓�");
+ return;
+ }
+ });
+ }
+ if ("y" === curType) {
+ $.each(listRows, function (index, item) {
+ if (item.y === (curVal - 1)) {
+ $("#dynamicAve").text(item.tempAve);
+ $("#dynamicMax").text(item.tempMax);
+ $("#dynamicMin").text(item.tempMin);
+ $("#dynamicAveName").text("琛屽潎娓�");
+ $("#dynamicMaxName").text("琛岄珮娓�");
+ $("#dynamicMinName").text("琛屼綆娓�");
+ }
+ });
+ }
+ if ("x" === curType) {
+ $("#dynamicAve").text("--");
+ $("#dynamicMax").text("--");
+ $("#dynamicMin").text("--");
+ $("#dynamicAveName").text("鍒楀潎娓�");
+ $("#dynamicMaxName").text("鍒楅珮娓�");
+ $("#dynamicMinName").text("鍒椾綆娓�");
+ }
+};
--
Gitblit v1.9.3