Files
friction/PanelRadarGraph.cs
mjjo53 879b3abda4 - 글자 크기와 툴바 아이콘 크기 조정
- Material compatibility table 리포트에 추가
- Material compatibility table 정렬되지 않도록
- 탭 패널 아이콘 적용

Radar Graph
- 항목의 폰트 크기 조정
- 영역에 색 지정 데이터는 라인으로
- 이 창을 띄울 땐 무조건 All이 선택되도록
- 데이터가 3개보다 적을 때 팝업

Trend Graph
- 재질 쌍 표시
- 영역 색을 조정

Analysis Table
- 재질 더블클릭 시 Material Table이 선택
2017-06-28 01:26:07 +09:00

156 lines
4.8 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using WeifenLuo.WinFormsUI.Docking;
namespace friction
{
public partial class PanelRadarGraph : DockContent
{
MainForm m_Owner = null;
DataHandler m_DataHandler = null;
string m_CurSpring = "";
bool m_bShowAlert = false;
public PanelRadarGraph(MainForm owner, DataHandler data)
{
InitializeComponent();
m_Owner = owner;
m_DataHandler = data;
Theme.Apply(this);
chart.ChartAreas[0].AxisY.Maximum = 10;
//chart.Series["SeriesHigh"].Color = Color.FromArgb(255, 200, 200, 200);
//chart.Series["SeriesPotential"].Color = Color.FromArgb(255, 180, 180, 180);
//chart.Series["SeriesNo"].Color = Color.FromArgb(255, 140, 140, 140);
chart.Series["SeriesHigh"].Color = Theme.Red;
chart.Series["SeriesHigh"].Font = new Font(chart.Series["SeriesNo"].Font.FontFamily, 20.0f);
chart.Series["SeriesPotential"].Color = Theme.Yellow;
chart.Series["SeriesPotential"].Font = new Font(chart.Series["SeriesNo"].Font.FontFamily, 20.0f);
chart.Series["SeriesNo"].Color = Theme.Green;
chart.Series["SeriesNo"].Font = new Font(chart.Series["SeriesNo"].Font.FontFamily, 20.0f);
chart.Series["SeriesMax"].Color = Theme.Red;
chart.Series["SeriesMax"]["RadarDrawingStyle"] = "Line";
chart.Series["SeriesMax"].BorderWidth = 3;
chart.Series["SeriesMax"].Font = new Font(chart.Series["SeriesNo"].Font.FontFamily, 20.0f);
chart.Series["SeriesAvg"].Color = Theme.Yellow;
chart.Series["SeriesAvg"]["RadarDrawingStyle"] = "Line";
chart.Series["SeriesAvg"].BorderWidth = 3;
chart.Series["SeriesAvg"].Font = new Font(chart.Series["SeriesNo"].Font.FontFamily, 20.0f);
chart.Series["SeriesMin"].Color = Theme.Green;
chart.Series["SeriesMin"]["RadarDrawingStyle"] = "Line";
chart.Series["SeriesMin"].BorderWidth = 3;
chart.Series["SeriesMin"].Font = new Font(chart.Series["SeriesNo"].Font.FontFamily, 20.0f);
chart.ChartAreas[0].AxisX.LabelStyle.Font = new Font(chart.ChartAreas[0].AxisX.LabelStyle.Font.FontFamily, 14.0f);
chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Black;
chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true;
chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(150, 0, 0, 0);
chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
foreach (var series in chart.Series)
series["AreaDrawingStyle"] = "Polygon";
}
public void Reset()
{
m_CurSpring = "";
}
public void UpdateGraph()
{
string strSpring = m_DataHandler.GetCurSpring();
if (m_CurSpring == strSpring)
return;
lbSpring.Text = "Material Spring: " + strSpring;
lbSpring.BackColor = Color.Transparent;
lbSpring.ForeColor = Theme.Orange;
foreach (var series in chart.Series)
series.Points.Clear();
List<DataHandler.RADAR_CHART> graphData = m_DataHandler.GetAvgAll(strSpring);
List<string> xValues = new List<string>();
List<float> yValues = new List<float>();
foreach(var data in graphData)
{
chart.Series["SeriesMax"].Points.AddXY(data.m_strTable, data.m_fMax);
chart.Series["SeriesAvg"].Points.AddXY(data.m_strTable, data.m_fAvg);
chart.Series["SeriesMin"].Points.AddXY(data.m_strTable, data.m_fMin);
chart.Series["SeriesHigh"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.HIGH);
chart.Series["SeriesPotential"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.POTENTIAL);
chart.Series["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO);
}
m_CurSpring = strSpring;
if (graphData.Count < 3)
{
if (Visible == true)
MessageBox.Show(this, "데이터가 부족합니다");
else
m_bShowAlert = true;
}
}
public Bitmap CopyChart()
{
MemoryStream ms = new MemoryStream();
chart.SaveImage(ms, ChartImageFormat.Bmp);
Bitmap bm = new Bitmap(ms);
return bm;
}
private void chart_MouseClick(object sender, MouseEventArgs e)
{
HitTestResult result = chart.HitTest(e.X, e.Y);
if(result.ChartElementType == ChartElementType.AxisLabels &&
result.Object != null)
{
string strTable = (string)result.Object;
m_Owner.OnRadarSelectTable(strTable);
}
}
private void PanelRadarGraph_VisibleChanged(object sender, EventArgs e)
{
if(m_bShowAlert == true)
{
MessageBox.Show(this, "데이터가 부족합니다");
m_bShowAlert = false;
}
}
}
}