diff --git a/EcomAnalysis/Feedback.cs b/EcomAnalysis/Feedback.cs index bcf9ff9..37acfec 100644 --- a/EcomAnalysis/Feedback.cs +++ b/EcomAnalysis/Feedback.cs @@ -5,7 +5,8 @@ using System.Threading.Tasks; namespace EcomAnalysis { - class Feedback { + public class Feedback { + public enum FBITEM { OK, GOOD, NICE, GREAT, EXCELLENT, TOTAL } private const int NUM_ITEMS = 5; private int[] _Counts = new int[NUM_ITEMS]; diff --git a/EcomAnalysis/Form1.Designer.cs b/EcomAnalysis/Form1.Designer.cs index ea89c3f..a031b7b 100644 --- a/EcomAnalysis/Form1.Designer.cs +++ b/EcomAnalysis/Form1.Designer.cs @@ -45,6 +45,7 @@ this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -57,7 +58,6 @@ this.saveFileDialogCsv = new System.Windows.Forms.SaveFileDialog(); this.label12 = new System.Windows.Forms.Label(); this.TxtVisit = new System.Windows.Forms.TextBox(); - this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.listView2 = new System.Windows.Forms.ListView(); this.columnHeader10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader11 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -67,6 +67,7 @@ this.BtnOpenLog = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.BtnCompareLogs = new System.Windows.Forms.Button(); + this.BtnClose = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 @@ -294,6 +295,12 @@ this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.columnHeader3.Width = 100; // + // columnHeader9 + // + this.columnHeader9.Text = "EC回数"; + this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader9.Width = 100; + // // columnHeader4 // this.columnHeader4.Text = "潜時"; @@ -358,9 +365,9 @@ // BtnSaveSceneTable // this.BtnSaveSceneTable.Font = new System.Drawing.Font("MS UI Gothic", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); - this.BtnSaveSceneTable.Location = new System.Drawing.Point(559, 621); + this.BtnSaveSceneTable.Location = new System.Drawing.Point(468, 621); this.BtnSaveSceneTable.Name = "BtnSaveSceneTable"; - this.BtnSaveSceneTable.Size = new System.Drawing.Size(140, 38); + this.BtnSaveSceneTable.Size = new System.Drawing.Size(117, 38); this.BtnSaveSceneTable.TabIndex = 21; this.BtnSaveSceneTable.Text = "CSV保存"; this.BtnSaveSceneTable.UseVisualStyleBackColor = true; @@ -394,12 +401,6 @@ this.TxtVisit.TabIndex = 23; this.TxtVisit.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // - // columnHeader9 - // - this.columnHeader9.Text = "EC回数"; - this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.columnHeader9.Width = 100; - // // listView2 // this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { @@ -471,7 +472,7 @@ // BtnCompareLogs // this.BtnCompareLogs.Font = new System.Drawing.Font("MS UI Gothic", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); - this.BtnCompareLogs.Location = new System.Drawing.Point(259, 621); + this.BtnCompareLogs.Location = new System.Drawing.Point(225, 621); this.BtnCompareLogs.Name = "BtnCompareLogs"; this.BtnCompareLogs.Size = new System.Drawing.Size(220, 38); this.BtnCompareLogs.TabIndex = 27; @@ -479,12 +480,24 @@ this.BtnCompareLogs.UseVisualStyleBackColor = true; this.BtnCompareLogs.Click += new System.EventHandler(this.BtnCompareLogs_Click); // + // BtnClose + // + this.BtnClose.Font = new System.Drawing.Font("MS UI Gothic", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.BtnClose.Location = new System.Drawing.Point(608, 621); + this.BtnClose.Name = "BtnClose"; + this.BtnClose.Size = new System.Drawing.Size(91, 38); + this.BtnClose.TabIndex = 28; + this.BtnClose.Text = "閉じる"; + this.BtnClose.UseVisualStyleBackColor = true; + this.BtnClose.Click += new System.EventHandler(this.BtnClose_Click); + // // Form1 // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(723, 671); + this.Controls.Add(this.BtnClose); this.Controls.Add(this.BtnCompareLogs); this.Controls.Add(this.BtnOpenLog); this.Controls.Add(this.label13); @@ -514,6 +527,8 @@ this.Controls.Add(this.TxtLogFilename); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "Form1"; this.Text = "Ecom Analysis"; this.Load += new System.EventHandler(this.Form1_Load); @@ -569,6 +584,7 @@ private System.Windows.Forms.Button BtnOpenLog; private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.Button BtnCompareLogs; + private System.Windows.Forms.Button BtnClose; } } diff --git a/EcomAnalysis/Form1.cs b/EcomAnalysis/Form1.cs index 192c408..4edc8d0 100644 --- a/EcomAnalysis/Form1.cs +++ b/EcomAnalysis/Form1.cs @@ -27,7 +27,8 @@ private double[] LF = new double[BLOCKS]; private double[] HF = new double[BLOCKS]; private LogFileInfo _LogFileInfo = new LogFileInfo(); - private Feedback _Feedback = new Feedback(); + private FormCompareLogs _FormCompareLogs = new FormCompareLogs(); + private bool _NewLog = true; /// /// コンストラクタ @@ -87,24 +88,24 @@ TxtVisit.Text = _LogFileInfo.Visit.ToString(); // フィードバック処理 - _Feedback.Calc(_Data); + _LogFileInfo.FB.Calc(_Data); // 表示 - TxtFB1.Text = $"{_Feedback.Count(Feedback.FBITEM.OK),2}回 " + - $"{_Feedback.Point(Feedback.FBITEM.OK),4}ポイント"; - TxtFB2.Text = $"{_Feedback.Count(Feedback.FBITEM.GOOD),2}回 " + - $"{_Feedback.Point(Feedback.FBITEM.GOOD),4}ポイント"; - TxtFB3.Text = $"{_Feedback.Count(Feedback.FBITEM.NICE),2}回 " + - $"{_Feedback.Point(Feedback.FBITEM.NICE),4}ポイント"; - TxtFB4.Text = $"{_Feedback.Count(Feedback.FBITEM.GREAT),2}回 " + - $"{_Feedback.Point(Feedback.FBITEM.GREAT),4}ポイント"; - TxtFB5.Text = $"{_Feedback.Count(Feedback.FBITEM.EXCELLENT),2}回 " + - $"{_Feedback.Point(Feedback.FBITEM.EXCELLENT),4}ポイント"; - TxtFBTotal.Text = $"{_Feedback.Count(Feedback.FBITEM.TOTAL),2}回 " + - $"{_Feedback.Point(Feedback.FBITEM.TOTAL),4}ポイント"; + TxtFB1.Text = $"{_LogFileInfo.FB.Count(Feedback.FBITEM.OK),2}回 " + + $"{_LogFileInfo.FB.Point(Feedback.FBITEM.OK),4}ポイント"; + TxtFB2.Text = $"{_LogFileInfo.FB.Count(Feedback.FBITEM.GOOD),2}回 " + + $"{_LogFileInfo.FB.Point(Feedback.FBITEM.GOOD),4}ポイント"; + TxtFB3.Text = $"{_LogFileInfo.FB.Count(Feedback.FBITEM.NICE),2}回 " + + $"{_LogFileInfo.FB.Point(Feedback.FBITEM.NICE),4}ポイント"; + TxtFB4.Text = $"{_LogFileInfo.FB.Count(Feedback.FBITEM.GREAT),2}回 " + + $"{_LogFileInfo.FB.Point(Feedback.FBITEM.GREAT),4}ポイント"; + TxtFB5.Text = $"{_LogFileInfo.FB.Count(Feedback.FBITEM.EXCELLENT),2}回 " + + $"{_LogFileInfo.FB.Point(Feedback.FBITEM.EXCELLENT),4}ポイント"; + TxtFBTotal.Text = $"{_LogFileInfo.FB.Count(Feedback.FBITEM.TOTAL),2}回 " + + $"{_LogFileInfo.FB.Point(Feedback.FBITEM.TOTAL),4}ポイント"; Analyze(); - + _NewLog = true; return true; } @@ -435,31 +436,47 @@ /// private void BtnCompareLogs_Click(object sender, EventArgs e) { - var preCursor = Cursor.Current; - Cursor.Current = Cursors.WaitCursor; - - var dir = Path.GetDirectoryName(_LogFileInfo.Filepath); - var files = Directory.GetFiles(dir, "*.csv"); - var LogFiles = new List() { _LogFileInfo}; - var FBs = new List() { _Feedback}; - foreach (var f in files) { - if (f.Equals(_LogFileInfo.Filepath)) continue; - var lfi = new LogFileInfo(); - if (!lfi.Set(f)) continue; - if (!lfi.Subject.Equals(_LogFileInfo.Subject)) continue; - if (!File.Exists(f)) continue; + if (_NewLog) { + var preCursor = Cursor.Current; + Cursor.Current = Cursors.WaitCursor; - var data = new List(); - ReadCSV(lfi, data); - var fb = new Feedback(); - fb.Calc(data); + // 同じ被験者のLogファイルを取得 + var dir = Path.GetDirectoryName(_LogFileInfo.Filepath); + var files = Directory.GetFiles(dir, "*.csv"); + var LogFiles = new List() { _LogFileInfo }; - LogFiles.Add(lfi); + foreach (var f in files) { + // ファイル情報の確認 + if (f.Equals(_LogFileInfo.Filepath)) continue; + var lfi = new LogFileInfo(); + if (!lfi.Set(f)) continue; + if (!lfi.Subject.Equals(_LogFileInfo.Subject)) continue; + if (!File.Exists(f)) continue; + + // フィードバック集計 + var data = new List(); + ReadCSV(lfi, data); + var fb = new Feedback(); + lfi.FB.Calc(data); + + LogFiles.Add(lfi); + } + + _FormCompareLogs.SetData(LogFiles); + _NewLog = false; + + Cursor.Current = preCursor; } - Cursor.Current = preCursor; + _FormCompareLogs.ShowDialog(); + } - var form = new FormCompareLogs(); - form.ShowDialog(); + /// + /// 閉じるボタン + /// + /// + /// + private void BtnClose_Click(object sender, EventArgs e) { + Close(); } } } diff --git a/EcomAnalysis/FormCompareLogs.Designer.cs b/EcomAnalysis/FormCompareLogs.Designer.cs index a24c25b..9bbac58 100644 --- a/EcomAnalysis/FormCompareLogs.Designer.cs +++ b/EcomAnalysis/FormCompareLogs.Designer.cs @@ -24,11 +24,24 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title4 = new System.Windows.Forms.DataVisualization.Charting.Title(); this.listView1 = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.RadioFBTotal = new System.Windows.Forms.RadioButton(); + this.RadioPoint = new System.Windows.Forms.RadioButton(); + this.label1 = new System.Windows.Forms.Label(); + this.RadioOK = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // @@ -36,48 +49,183 @@ // this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3, + this.columnHeader4, + this.columnHeader5, + this.columnHeader6, + this.columnHeader7, + this.columnHeader8, + this.columnHeader9}); + this.listView1.Font = new System.Drawing.Font("MS UI Gothic", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); this.listView1.GridLines = true; this.listView1.HideSelection = false; this.listView1.Location = new System.Drawing.Point(12, 12); this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(561, 212); + this.listView1.Size = new System.Drawing.Size(848, 212); this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; // + // columnHeader1 + // + this.columnHeader1.Text = "実施日"; + this.columnHeader1.Width = 160; + // + // columnHeader2 + // + this.columnHeader2.Text = "Visit"; + this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader2.Width = 50; + // + // columnHeader3 + // + this.columnHeader3.Text = "FB回数"; + this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader3.Width = 90; + // + // columnHeader4 + // + this.columnHeader4.Text = "ポイント"; + this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader4.Width = 90; + // + // columnHeader5 + // + this.columnHeader5.Text = "OK"; + this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader5.Width = 90; + // + // columnHeader6 + // + this.columnHeader6.Text = "Good"; + this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader6.Width = 90; + // + // columnHeader7 + // + this.columnHeader7.Text = "Nice"; + this.columnHeader7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader7.Width = 90; + // + // columnHeader8 + // + this.columnHeader8.Text = "Great"; + this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader8.Width = 90; + // + // columnHeader9 + // + this.columnHeader9.Text = "Excellent"; + this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader9.Width = 90; + // // chart1 // this.chart1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - legend1.Name = "Legend1"; - this.chart1.Legends.Add(legend1); - this.chart1.Location = new System.Drawing.Point(12, 230); + chartArea4.AxisX.MajorGrid.LineColor = System.Drawing.Color.Gray; + chartArea4.AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash; + chartArea4.AxisY.MajorGrid.LineColor = System.Drawing.Color.Gray; + chartArea4.AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash; + chartArea4.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea4); + this.chart1.Location = new System.Drawing.Point(12, 265); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series1.Legend = "Legend1"; - series1.MarkerColor = System.Drawing.Color.Blue; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Square; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(561, 406); + series4.BorderColor = System.Drawing.Color.White; + series4.BorderWidth = 2; + series4.ChartArea = "ChartArea1"; + series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series4.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + series4.IsValueShownAsLabel = true; + series4.MarkerBorderColor = System.Drawing.Color.Black; + series4.MarkerColor = System.Drawing.Color.DarkOrange; + series4.MarkerSize = 10; + series4.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series4.Name = "Series1"; + this.chart1.Series.Add(series4); + this.chart1.Size = new System.Drawing.Size(848, 404); this.chart1.TabIndex = 1; this.chart1.Text = "chart1"; + title4.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + title4.Name = "Title1"; + title4.Text = "フィードバック回数"; + this.chart1.Titles.Add(title4); + // + // RadioFBTotal + // + this.RadioFBTotal.Appearance = System.Windows.Forms.Appearance.Button; + this.RadioFBTotal.AutoSize = true; + this.RadioFBTotal.Font = new System.Drawing.Font("MS UI Gothic", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.RadioFBTotal.Location = new System.Drawing.Point(171, 230); + this.RadioFBTotal.Name = "RadioFBTotal"; + this.RadioFBTotal.Size = new System.Drawing.Size(79, 29); + this.RadioFBTotal.TabIndex = 2; + this.RadioFBTotal.TabStop = true; + this.RadioFBTotal.Text = "FB回数"; + this.RadioFBTotal.UseVisualStyleBackColor = true; + this.RadioFBTotal.CheckedChanged += new System.EventHandler(this.RadioFBTotal_CheckedChanged); + // + // RadioPoint + // + this.RadioPoint.Appearance = System.Windows.Forms.Appearance.Button; + this.RadioPoint.AutoSize = true; + this.RadioPoint.Font = new System.Drawing.Font("MS UI Gothic", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.RadioPoint.Location = new System.Drawing.Point(256, 230); + this.RadioPoint.Name = "RadioPoint"; + this.RadioPoint.Size = new System.Drawing.Size(76, 29); + this.RadioPoint.TabIndex = 3; + this.RadioPoint.TabStop = true; + this.RadioPoint.Text = "ポイント"; + this.RadioPoint.UseVisualStyleBackColor = true; + this.RadioPoint.CheckedChanged += new System.EventHandler(this.RadioPoint_CheckedChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("MS UI Gothic", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.label1.Location = new System.Drawing.Point(12, 235); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(153, 19); + this.label1.TabIndex = 4; + this.label1.Text = "グラフ表示切り替え"; + // + // RadioOK + // + this.RadioOK.Appearance = System.Windows.Forms.Appearance.Button; + this.RadioOK.AutoSize = true; + this.RadioOK.Font = new System.Drawing.Font("MS UI Gothic", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.RadioOK.Location = new System.Drawing.Point(338, 230); + this.RadioOK.Name = "RadioOK"; + this.RadioOK.Size = new System.Drawing.Size(43, 29); + this.RadioOK.TabIndex = 5; + this.RadioOK.TabStop = true; + this.RadioOK.Text = "OK"; + this.RadioOK.UseVisualStyleBackColor = true; + this.RadioOK.CheckedChanged += new System.EventHandler(this.RadioOK_CheckedChanged); // // FormCompareLogs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(585, 648); + this.ClientSize = new System.Drawing.Size(872, 681); + this.Controls.Add(this.RadioOK); + this.Controls.Add(this.label1); + this.Controls.Add(this.RadioPoint); + this.Controls.Add(this.RadioFBTotal); this.Controls.Add(this.chart1); this.Controls.Add(this.listView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "FormCompareLogs"; - this.Text = "他の実施結果の比較"; + this.Text = "過去の実施結果と比較"; ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -85,5 +233,18 @@ private System.Windows.Forms.ListView listView1; private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ColumnHeader columnHeader3; + private System.Windows.Forms.ColumnHeader columnHeader4; + private System.Windows.Forms.ColumnHeader columnHeader5; + private System.Windows.Forms.ColumnHeader columnHeader6; + private System.Windows.Forms.ColumnHeader columnHeader7; + private System.Windows.Forms.ColumnHeader columnHeader8; + private System.Windows.Forms.ColumnHeader columnHeader9; + private System.Windows.Forms.RadioButton RadioFBTotal; + private System.Windows.Forms.RadioButton RadioPoint; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.RadioButton RadioOK; } } \ No newline at end of file diff --git a/EcomAnalysis/FormCompareLogs.cs b/EcomAnalysis/FormCompareLogs.cs index 3d5c386..653bcdf 100644 --- a/EcomAnalysis/FormCompareLogs.cs +++ b/EcomAnalysis/FormCompareLogs.cs @@ -7,15 +7,77 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Diagnostics; namespace EcomAnalysis { + public partial class FormCompareLogs : Form { private List _LogFiles; - public FormCompareLogs() { InitializeComponent(); } + + public void SetData(List logs) { + _LogFiles = logs; + MakeTable(); + MakeChart(0); + } + + private void MakeTable() { + listView1.Items.Clear(); + + foreach (var log in _LogFiles.OrderBy(s => s.ExecDate)) { + listView1.Items.Add(new ListViewItem(new string[] { + log.ExecDate.ToString("yyyy/MM/dd HH:mm"), + log.Visit.ToString(), + $"{log.FB.Count(Feedback.FBITEM.TOTAL)} 回", + $"{log.FB.Point(Feedback.FBITEM.TOTAL)} pts", + $"{log.FB.Count(Feedback.FBITEM.OK)} 回", + $"{log.FB.Count(Feedback.FBITEM.GOOD)} 回", + $"{log.FB.Count(Feedback.FBITEM.NICE)} 回", + $"{log.FB.Count(Feedback.FBITEM.GREAT)} 回", + $"{log.FB.Count(Feedback.FBITEM.EXCELLENT)} 回"})); + + chart1.Series[0].Points.AddXY($"visit {log.Visit}\r\n{log.ExecDate.ToString("MM/dd")}", + log.FB.Count(Feedback.FBITEM.TOTAL)); + } + } + + private void MakeChart(int type) { + chart1.Series[0].Points.Clear(); + foreach (var log in _LogFiles.OrderBy(s => s.ExecDate)) { + var val = 0; + switch (type) { + case 0: val = log.FB.Count(Feedback.FBITEM.TOTAL); break; + case 1: val = log.FB.Point(Feedback.FBITEM.TOTAL); break; + case 2: val = log.FB.Count(Feedback.FBITEM.OK); break; + case 3: val = log.FB.Count(Feedback.FBITEM.GOOD); break; + case 4: val = log.FB.Count(Feedback.FBITEM.NICE); break; + case 5: val = log.FB.Count(Feedback.FBITEM.GREAT); break; + case 6: val = log.FB.Count(Feedback.FBITEM.EXCELLENT); break; + } + + chart1.Series[0].Points.AddXY($"visit {log.Visit}\r\n{log.ExecDate.ToString("MM/dd")}", + val); + } + + var titles = new string[] {"フィードバック回数", "獲得ポイント", "OK回数", + "Good回数", "Nice回数", "Great回数", "Excellent回数"}; + chart1.Titles[0].Text = titles[type]; + } + + private void RadioFBTotal_CheckedChanged(object sender, EventArgs e) { + MakeChart(0); + } + + private void RadioPoint_CheckedChanged(object sender, EventArgs e) { + MakeChart(1); + } + + private void RadioOK_CheckedChanged(object sender, EventArgs e) { + MakeChart(2); + } } } diff --git a/EcomAnalysis/LogData.cs b/EcomAnalysis/LogData.cs index 72d2749..6fd963c 100644 --- a/EcomAnalysis/LogData.cs +++ b/EcomAnalysis/LogData.cs @@ -6,17 +6,17 @@ namespace EcomAnalysis { - struct Point2f { + public struct Point2f { public float x; public float y; } - struct LR { + public struct LR { public float L; public float R; } - class LogData { + public class LogData { public double ElapTime; // 経過時間 public int StimNo; // 刺激データ番号 public int SceneNo; // シーン番号 @@ -32,7 +32,7 @@ public LR Pupil; // 瞳孔径 } - class SceneData { + public class SceneData { public int SceneNo; public int FBCount; public int Blink; @@ -43,7 +43,7 @@ public LR Pupil; } - class SceneMean { + public class SceneMean { public double FBCount; public double ECTime; public double ECCount; diff --git a/EcomAnalysis/LogFileInfo.cs b/EcomAnalysis/LogFileInfo.cs index 43ef919..c2dc9ff 100644 --- a/EcomAnalysis/LogFileInfo.cs +++ b/EcomAnalysis/LogFileInfo.cs @@ -12,13 +12,20 @@ /// ログファイル情報クラス /// ファイル名から得られる情報の管理 /// - class LogFileInfo { + public class LogFileInfo { + public string Filepath { get; private set; } public string Filename { get; private set; } public DateTime ExecDate { get; private set; } public int Visit { get; private set; } public string Subject { get; private set; } + public Feedback FB { get; } = new Feedback(); + /// + /// ファイル名からログ情報をセット + /// + /// + /// public bool Set(string fn) { Filepath = fn; Filename = Path.GetFileNameWithoutExtension(fn);