Bläddra i källkod

绘图时也出来下分数的长度

htc 2 dagar sedan
förälder
incheckning
6703d7dc44
1 ändrade filer med 6 tillägg och 3 borttagningar
  1. 6 3
      pagesHome/pdfZyb.vue

+ 6 - 3
pagesHome/pdfZyb.vue

@@ -416,13 +416,16 @@
 								ctx.stroke();
 							});
 							
+							const minScore = ((row.minScore||0)+'').length>2?(row.minScore||0).toFixed(2):row.minScore;
+							const avgScore = ((row.avgScore||0)+'').length>2?(row.avgScore||0).toFixed(2):row.avgScore;
+							const maxScore = ((row.maxScore||0)+'').length>2?(row.maxScore||0).toFixed(2):row.maxScore;
 							ctx.font = `bold 14px ${FONT_FAMILY}`;
 							ctx.fillStyle = '#667E90';
-							ctx.fillText(row.minScore, COL_POSITIONS.min + COL_WIDTHS.min / 2, y + ROW_HEIGHT / 2);
+							ctx.fillText(minScore, COL_POSITIONS.min + COL_WIDTHS.min / 2, y + ROW_HEIGHT / 2);
 							ctx.fillStyle = '#27AE60';
-							ctx.fillText(row.avgScore, COL_POSITIONS.avg + COL_WIDTHS.avg / 2, y + ROW_HEIGHT / 2);
+							ctx.fillText(avgScore, COL_POSITIONS.avg + COL_WIDTHS.avg / 2, y + ROW_HEIGHT / 2);
 							ctx.fillStyle = '#667E90';
-							ctx.fillText(row.maxScore, COL_POSITIONS.max + COL_WIDTHS.max / 2, y + ROW_HEIGHT / 2);
+							ctx.fillText(maxScore, COL_POSITIONS.max + COL_WIDTHS.max / 2, y + ROW_HEIGHT / 2);
 							
 							// 5.3 绘制问卷陈述列
 							const statementX = COL_POSITIONS.statement;