Add: input_score

This commit is contained in:
2018-12-10 08:21:43 +09:00
parent 13f59aee71
commit 364362618b
5 changed files with 228 additions and 200 deletions
+71 -21
View File
@@ -3,8 +3,9 @@ function Chart() {
this.printChartTitle();
this.printChartBaseLine();
this.records = [];
for(var i = 0; i < 7; i++)
new ChartRecord(i);
this.records.push(new ChartRecord(i));
}
Chart.prototype.printChartTitle = function() {
@@ -12,7 +13,7 @@ Chart.prototype.printChartTitle = function() {
var fontStyle = { font: "30px Arial", fill: "#fff", align: "center" };
Chart.drawText(Chart.DATE_POS_X, Chart.CHART_LINE_Y + offsetY, "날짜", fontStyle);
Chart.drawText(Chart.RECORD_POS_X, Chart.CHART_LINE_Y + offsetY, "점수", fontStyle);
Chart.drawText(Chart.SCORE_POS_X, Chart.CHART_LINE_Y + offsetY, "점수", fontStyle);
Chart.drawText(Chart.GRADE_POS_X, Chart.CHART_LINE_Y + offsetY, "등급", fontStyle);
Chart.drawText(Chart.SUBJECT_POS_X, Chart.CHART_LINE_Y + offsetY, "과목", fontStyle);
}
@@ -60,6 +61,18 @@ Chart.drawText = function(posX, posY, text, fontStyle) {
return textObject;
}
Chart.prototype.printContents = function() {
if(isDebugMode()) {
console.log("printContents : " + this.records.length);
for(var i = 0; i < this.records.length; i++) {
this.records[i].printDate("12/10");
this.records[i].printScore(360);
this.records[i].printGrade("B");
this.records[i].printSubject("ITQ 파워포인트");
}
}
}
Chart.CHART_COUNT = 7;
Chart.CHART_LINE_START_X = 230;
@@ -70,22 +83,40 @@ Chart.CHART_HEIGHT = 120;
Chart.CHART_GRAPH_OFFSET_X = 50;
Chart.CHART_DATE_OFFSET_Y = 20;
Chart.CHART_RECORD_OFFSET_Y = 30;
Chart.CHART_SCORE_OFFSET_Y = 30;
Chart.DATE_POS_X = Chart.CHART_LINE_START_X + 50;
Chart.RECORD_POS_X = Chart.DATE_POS_X + 100;
Chart.SCORE_POS_X = Chart.DATE_POS_X + 100;
Chart.GRADE_POS_X = Chart.DATE_POS_X + 200;
Chart.SUBJECT_POS_X = Chart.DATE_POS_X + 400;
function ChartRecord(index) {
this.date = new DateData(index);
this.record = new RecordData(index);
this.grade = new GradeData(index);
this.subject = new SubjectData(index);
function ChartRecord(indexRow) {
this.date = new DateData(indexRow);
this.score = new ScoreData(indexRow);
this.grade = new GradeData(indexRow);
this.subject = new SubjectData(indexRow);
return this;
}
ChartRecord.prototype.printDate = function(date) {
this.date.text = date;
}
ChartRecord.prototype.printScore = function(score) {
this.score.text = score;
}
ChartRecord.prototype.printGrade = function(grade) {
this.grade.text = grade;
}
ChartRecord.prototype.printSubject = function(subject) {
this.subject.text = subject;
}
ChartRecord.getPosX = function(columnName) {
var posX = Chart.CHART_LINE_START_X;
switch(columnName) {
@@ -93,8 +124,8 @@ ChartRecord.getPosX = function(columnName) {
posX = Chart.DATE_POS_X;
break;
case "record":
posX = Chart.RECORD_POS_X;
case "score":
posX = Chart.SCORE_POS_X;
break;
case "grade":
@@ -114,27 +145,46 @@ ChartRecord.getPosY = function(rowIndex) {
return Chart.CHART_LINE_Y + offsetY + ChartRecord.GAP_RECORD_Y * rowIndex;
}
ChartRecord.getDefaultFontStyle = function() {
return { font: "28px Arial", fill: "#fff", align: "center" };
}
ChartRecord.GAP_RECORD_Y = 40;
function DateData(index) {
var fontStyle = { font: "28px Arial", fill: "#fff", align: "center" };
this.dateText = Chart.drawText(ChartRecord.getPosX("date"), ChartRecord.getPosY(index), "월/일", fontStyle);
this.dateText = Chart.drawText(
ChartRecord.getPosX("date"), ChartRecord.getPosY(index),
"-", ChartRecord.getDefaultFontStyle()
);
return this.dateText;
}
function RecordData(index) {
var fontStyle = { font: "28px Arial", fill: "#fff", align: "center" };
this.dateText = Chart.drawText(ChartRecord.getPosX("record"), ChartRecord.getPosY(index), "350 점", fontStyle);
function ScoreData(index) {
this.scoreText = Chart.drawText(
ChartRecord.getPosX("score"), ChartRecord.getPosY(index),
"-", ChartRecord.getDefaultFontStyle()
);
return this.scoreText;
}
function GradeData(index) {
var fontStyle = { font: "28px Arial", fill: "#fff", align: "center" };
this.dateText = Chart.drawText(ChartRecord.getPosX("grade"), ChartRecord.getPosY(index), "B", fontStyle);
this.gradeText = Chart.drawText(
ChartRecord.getPosX("grade"), ChartRecord.getPosY(index),
"-", ChartRecord.getDefaultFontStyle()
);
return this.gradeText;
}
function SubjectData(index) {
var fontStyle = { font: "28px Arial", fill: "#fff", align: "center" };
this.dateText = Chart.drawText(ChartRecord.getPosX("subject"), ChartRecord.getPosY(index), "ITQ 파워포인트", fontStyle);
}
this.subjectText = Chart.drawText(
ChartRecord.getPosX("subject"), ChartRecord.getPosY(index),
"-", ChartRecord.getDefaultFontStyle()
);
return this.subjectText;
}