Commit cf55a664 authored by 潘栩锋's avatar 潘栩锋 🚴

改进 X轴小数点保留2位

parent fea0a991
...@@ -56,6 +56,9 @@ namespace FLY.Thick.Base.UI ...@@ -56,6 +56,9 @@ namespace FLY.Thick.Base.UI
chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold); chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisX.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); chartArea1.AxisX.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
//chartArea1.AxisX.LabelStyle.Format = "%F2";
chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold); chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisY.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); chartArea1.AxisY.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
...@@ -94,7 +97,7 @@ namespace FLY.Thick.Base.UI ...@@ -94,7 +97,7 @@ namespace FLY.Thick.Base.UI
series1.ShadowOffset = 2; series1.ShadowOffset = 2;
series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
series1.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32; series1.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32;
this.chart1.Series.Add(series1); this.chart1.Series.Add(series1);
...@@ -272,6 +275,7 @@ namespace FLY.Thick.Base.UI ...@@ -272,6 +275,7 @@ namespace FLY.Thick.Base.UI
} }
thick = CurveCore.AD2Value(ad, AD2ValueFlag.NoRevised); thick = CurveCore.AD2Value(ad, AD2ValueFlag.NoRevised);
thick = Math.Round(thick, 2);
chart1.Series["Series 1"].Points.AddXY(thick, ad); chart1.Series["Series 1"].Points.AddXY(thick, ad);
chart1.Series["Series 1"].Points[chart1.Series["Series 1"].Points.Count() - 1].MarkerStyle = chart1.Series["Series 1"].Points[chart1.Series["Series 1"].Points.Count() - 1].MarkerStyle =
System.Windows.Forms.DataVisualization.Charting.MarkerStyle.None; System.Windows.Forms.DataVisualization.Charting.MarkerStyle.None;
...@@ -375,25 +379,34 @@ namespace FLY.Thick.Base.UI ...@@ -375,25 +379,34 @@ namespace FLY.Thick.Base.UI
FromSheet(sheet, dataTable_info); FromSheet(sheet, dataTable_info);
} }
Curves.CollectionChanged -= Curves_CollectionChanged;
this.PropertyChanged -= PgCurveVm_PropertyChanged;
Curves.Clear();
for (int i = 0; i < dataTable_curve.Rows.Count; i++)
{
var dataRow = dataTable_curve.Rows[i];
int ad = System.Convert.ToInt32(dataRow["AD"]);
double value = System.Convert.ToDouble(dataRow["VALUE"]);
Curves.Add(new CurveCell2() { AD = ad, Value = value });
}
if (dataTable_info.Rows.Count > 0)
page.Dispatcher.Invoke(() =>
{ {
var dataRow = dataTable_curve.Rows[0]; Curves.CollectionChanged -= Curves_CollectionChanged;
Flag = (CurveType)Enum.Parse(typeof(CurveType), (string)dataRow["曲线类型"]); this.PropertyChanged -= PgCurveVm_PropertyChanged;
CorrectWay = (CurveCorrectWay)Enum.Parse(typeof(CurveCorrectWay), (string)dataRow["校正方式"]);
} Curves.Clear();
this.PropertyChanged += PgCurveVm_PropertyChanged; for (int i = 0; i < dataTable_curve.Rows.Count; i++)
Curves.CollectionChanged += Curves_CollectionChanged; {
var dataRow = dataTable_curve.Rows[i];
int ad = System.Convert.ToInt32(dataRow["AD"]);
double value = System.Convert.ToDouble(dataRow["VALUE"]);
Curves.Add(new CurveCell2() { AD = ad, Value = value });
}
if (dataTable_info.Rows.Count > 0)
{
var dataRow = dataTable_info.Rows[0];
Flag = (CurveType)Enum.Parse(typeof(CurveType), (string)dataRow["曲线类型"]);
CorrectWay = (CurveCorrectWay)Enum.Parse(typeof(CurveCorrectWay), (string)dataRow["校正方式"]);
}
this.PropertyChanged += PgCurveVm_PropertyChanged;
Curves.CollectionChanged += Curves_CollectionChanged;
});
} }
void FromSheet(ExcelWorksheet sheet, DataTable dataTable) void FromSheet(ExcelWorksheet sheet, DataTable dataTable)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment