220 lines
		
	
	
		
			8.2 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			220 lines
		
	
	
		
			8.2 KiB
		
	
	
	
		
			C#
		
	
| using System;
 | |
| using System.Linq;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Drawing;
 | |
| using System.Data;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| 
 | |
| using SmartX;
 | |
| using INT_LKD.Forms;
 | |
| using INT_LKD.DataStore;
 | |
| 
 | |
| namespace INT_LKD.Controls
 | |
| {
 | |
|     public partial class ControlMainDisplayDotGraph : UserControl
 | |
|     {
 | |
|         #region Field
 | |
|         private int FlagIgnoreCNT;
 | |
| 
 | |
|         private FormMain m_ParentForm;
 | |
|         #endregion
 | |
|         
 | |
|         #region Constructor
 | |
|         public ControlMainDisplayDotGraph(int lane, FormMain parent)
 | |
|         {
 | |
|             InitializeComponent();
 | |
| 
 | |
|             this.ParentForm = parent;
 | |
|             this.InitializeDraw();
 | |
|             this.Initialize(lane);
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Property
 | |
|         public FormMain ParentForm
 | |
|         {
 | |
|             get { return this.m_ParentForm; }
 | |
|             private set { this.m_ParentForm = value; }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region Method
 | |
|         private void Initialize(int lane)
 | |
|         {
 | |
|             this.FlagIgnoreCNT = 0;
 | |
| 
 | |
|             this.labelLane.Text = string.Format("Lane {0}", lane);
 | |
| 
 | |
|             this.labelCurrentValue.Text = "0.000";
 | |
|             this.labelMaxValue.Text = "0.000";
 | |
|             this.labelStDev.Text = "0.0000";
 | |
|             this.labelResult.Text = "-";
 | |
|             this.labelResultSD.Text = "0.0000";
 | |
|             this.smartDraw.Chart.PutDataAllClear();
 | |
|         }
 | |
|         private void InitializeDraw()
 | |
|         {
 | |
|             // SetChartConfig
 | |
|             this.smartDraw.Chart.SetChartConfig(100, 442, 700, 442, 2, SmartDraw.ChartRefresh.LEFTSCROLL);
 | |
|            
 | |
|             // BackLayer 기준선 표시
 | |
|             this.smartDraw.BackLayer.SetPenStyle(Color.Gray, 2);
 | |
|             // BackLayer 세로
 | |
|             this.smartDraw.BackLayer.Line(100, 0, 100, 442);
 | |
|             // BackLayer 가로 -2.000
 | |
|             this.smartDraw.BackLayer.Line(100, 442, 800, 442);
 | |
|             
 | |
|             // BackLayer 기준선 표시
 | |
|             this.smartDraw.BackLayer.SetPenStyle(Color.Gray, 1);
 | |
|             // BackLayer 가로 -1.000
 | |
|             this.smartDraw.BackLayer.Line(100, 416, 800, 416);
 | |
|             // BackLayer 가로 0.000
 | |
|             this.smartDraw.BackLayer.Line(100, 390, 800, 390);
 | |
|             // BackLayer 가로 1.000
 | |
|             this.smartDraw.BackLayer.Line(100, 364, 800, 364);
 | |
|             // BackLayer 가로 2.000
 | |
|             this.smartDraw.BackLayer.Line(100, 338, 800, 338);
 | |
|             // BackLayer 가로 3.000
 | |
|             this.smartDraw.BackLayer.Line(100, 312, 800, 312);
 | |
|             // BackLayer 가로 4.000
 | |
|             this.smartDraw.BackLayer.Line(100, 286, 800, 286);
 | |
|             // BackLayer 가로 5.000
 | |
|             this.smartDraw.BackLayer.Line(100, 260, 800, 260);
 | |
|             // BackLayer 가로 6.000
 | |
|             this.smartDraw.BackLayer.Line(100, 234, 800, 234);
 | |
|             // BackLayer 가로 7.000
 | |
|             this.smartDraw.BackLayer.Line(100, 208, 800, 208);
 | |
|             // BackLayer 가로 8.000
 | |
|             this.smartDraw.BackLayer.Line(100, 182, 800, 182);
 | |
|             // BackLayer 가로 9.000
 | |
|             this.smartDraw.BackLayer.Line(100, 156, 800, 156);
 | |
|             // BackLayer 가로 10.000
 | |
|             this.smartDraw.BackLayer.Line(100, 130, 800, 130);
 | |
|             // BackLayer 가로 11.000
 | |
|             this.smartDraw.BackLayer.Line(100, 104, 800, 104);
 | |
|             // BackLayer 가로 12.000
 | |
|             this.smartDraw.BackLayer.Line(100, 78, 800, 78);
 | |
|             // BackLayer 가로 13.000
 | |
|             this.smartDraw.BackLayer.Line(100, 52, 800, 52);
 | |
|             // BackLayer 가로 14.000
 | |
|             this.smartDraw.BackLayer.Line(100, 26, 800, 26);
 | |
| 
 | |
|             // TextOut
 | |
|             // SetFont
 | |
|             this.smartDraw.BackLayer.SetFont("Arial", 18, Color.Gray, true, false, false);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 16, "{0,6:F3}", 14.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 42, "{0,6:F3}", 13.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 68, "{0,6:F3}", 12.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 94, "{0,6:F3}", 11.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 120, "{0,6:F3}", 10.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 146, "{0,6:F3}", 9.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 172, "{0,6:F3}", 8.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 198, "{0,6:F3}", 7.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 224, "{0,6:F3}", 6.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 250, "{0,6:F3}", 5.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 276, "{0,6:F3}", 4.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 302, "{0,6:F3}", 3.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 328, "{0,6:F3}", 2.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 354, "{0,6:F3}", 1.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 380, "{0,6:F3}", 0.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 406, "{0,6:F3}", -1.000);
 | |
|             this.smartDraw.BackLayer.TextOut(20, 432, "{0,6:F3}", -2.000);
 | |
| 
 | |
|             this.smartDraw.Chart.ChartChannelPenStyle = this.smartDraw_ChartChannelPenStyle1;
 | |
|         }
 | |
| 
 | |
|         private void UpdateDotGraphDisplay(DiffData diff, DispData disp)
 | |
|         {
 | |
|             int iValue = 0;
 | |
|             double dValue = 0.0;
 | |
| 
 | |
|             // 값 표시 범위
 | |
|             // 15.000 ~ -2.000  (17.000 ~ 0)
 | |
|             // 그래프 영역 높이 460
 | |
|             // 17000 / 460 = 36.95652173913043
 | |
|             //dValue = (int.Parse(data.CurrentValueSign + data.CurrentValue) + 2000) / 36.95652173913043;
 | |
| 
 | |
|             if (dValue > 460)
 | |
|                 dValue = 460;
 | |
|             if (dValue < 1)
 | |
|                 dValue = 1;
 | |
| 
 | |
|             iValue = int.Parse(string.Format("{0:f0}", dValue));
 | |
| 
 | |
|             this.smartDraw.Chart.PutData(iValue);
 | |
|         }
 | |
|         public void UpdateNomalLeakDataDisplay(DiffData diff, DispData disp)
 | |
|         {
 | |
|             string value = "";
 | |
|             bool bValue = false;
 | |
| 
 | |
|             if (this.ParentForm.SystemConfig.CHART2_DRAW_STEP == 1)
 | |
|             {
 | |
|                 bValue = true;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (this.FlagIgnoreCNT == this.ParentForm.SystemConfig.CHART2_DRAW_STEP)
 | |
|                 {
 | |
|                     bValue = true;
 | |
|                     this.FlagIgnoreCNT = 0;
 | |
|                 }
 | |
|                 else
 | |
|                     this.FlagIgnoreCNT++;
 | |
|             }
 | |
| 
 | |
|             // Current Value
 | |
|             //value = Helper.StringToDecimalPlaces(data.CurrentValue, this.ParentForm.DecimalPlaces3);
 | |
|             //if (data.CurrentValueSign == "-")
 | |
|             //    value = string.Format("{0}{1}", data.CurrentValueSign, value);
 | |
|             if (this.labelCurrentValue.Text != value)
 | |
|                 this.labelCurrentValue.Text = value;
 | |
| 
 | |
|             // Max Value
 | |
|             //value = Helper.StringToDecimalPlaces(data.MaxValue, this.ParentForm.DecimalPlaces3);
 | |
|             //if(data.MaxValueSign == "-")
 | |
|             //    value = string.Format("{0}{1}", data.MaxValueSign, value);
 | |
|             if (this.labelMaxValue.Text != value)
 | |
|                 this.labelMaxValue.Text = value;
 | |
| 
 | |
|             // Standard Deviation
 | |
|             //value = Helper.StringToDecimalPlaces(data.StDev, this.ParentForm.DecimalPlaces4);
 | |
|             if (this.labelStDev.Text != value)
 | |
|                 this.labelStDev.Text = value;
 | |
| 
 | |
|             // Draw
 | |
|             if (bValue == true)
 | |
|                 this.UpdateDotGraphDisplay(diff, disp);
 | |
|         }
 | |
|         public void UpdateStartLeakDataDisplay(DiffData diff, DispData disp, LeakResult judg)
 | |
|         {
 | |
|             string value = "";
 | |
| 
 | |
|             value = judg.Result.ToString();
 | |
|             if (this.labelResult.Text != value)
 | |
|                 this.labelResult.Text = value;
 | |
| 
 | |
|             //value = Helper.StringToDecimalPlaces(data.ResultSD, this.ParentForm.DecimalPlaces4);
 | |
|             if (this.labelResultSD.Text != value)
 | |
|                 this.labelResultSD.Text = value;
 | |
|         }
 | |
|         public void ClearAllData()
 | |
|         {
 | |
|             this.labelCurrentValue.Text = "0.000";
 | |
|             this.labelMaxValue.Text = "0.000";
 | |
|             this.labelStDev.Text = "0.0000";
 | |
|             this.labelResult.Text = "-";
 | |
|             this.labelResultSD.Text = "0.0000";
 | |
|             this.smartDraw.Chart.PutDataAllClear();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         private void smartButton1_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
|     }
 | |
| }
 |