更新20260608
This commit is contained in:
@@ -131,22 +131,39 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Services
|
||||
{
|
||||
var rows = new List<IReadOnlyList<object?>>
|
||||
{
|
||||
new object?[] { "时间(s)", "垂直压力(N)", "水平拉力(N)", "距离(mm)", "摩擦系数" }
|
||||
new object?[] { "时间(s)", "垂直压力(N)", "水平拉力(N)", "距离(mm)", "摩擦系数", "位移直线时间(s)", "距离(mm)" }
|
||||
};
|
||||
|
||||
foreach (var point in points)
|
||||
for (var index = 0; index < points.Count; index++)
|
||||
{
|
||||
var point = points[index];
|
||||
var lineTime = index switch
|
||||
{
|
||||
0 => 0,
|
||||
1 => points[^1].TimeSeconds,
|
||||
_ => (double?)null
|
||||
};
|
||||
var lineDisplacement = index switch
|
||||
{
|
||||
0 => 0,
|
||||
1 => points[^1].DisplacementMm,
|
||||
_ => (double?)null
|
||||
};
|
||||
|
||||
rows.Add(new object?[]
|
||||
{
|
||||
point.TimeSeconds,
|
||||
point.VerticalLoadN,
|
||||
point.HorizontalFrictionN,
|
||||
point.DisplacementMm,
|
||||
point.FrictionCoefficient
|
||||
point.FrictionCoefficient,
|
||||
lineTime,
|
||||
lineDisplacement
|
||||
});
|
||||
}
|
||||
|
||||
var worksheetPart = AddWorksheet(workbookPart, sheets, sheetId, DataSheetName, rows, "A", "E");
|
||||
var worksheetPart = AddWorksheet(workbookPart, sheets, sheetId, DataSheetName, rows, "A", "G");
|
||||
HideColumns(worksheetPart, 6, 7);
|
||||
if (points.Count > 0)
|
||||
{
|
||||
AddChart(worksheetPart, points.Count + 1);
|
||||
@@ -211,6 +228,23 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Services
|
||||
return columns;
|
||||
}
|
||||
|
||||
private static void HideColumns(WorksheetPart worksheetPart, uint firstColumn, uint lastColumn)
|
||||
{
|
||||
var columns = worksheetPart.Worksheet.GetFirstChild<Columns>();
|
||||
if (columns is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var column in columns.Elements<Column>()
|
||||
.Where(column => column.Min?.Value >= firstColumn && column.Max?.Value <= lastColumn))
|
||||
{
|
||||
column.Hidden = true;
|
||||
}
|
||||
|
||||
worksheetPart.Worksheet.Save();
|
||||
}
|
||||
|
||||
private static Cell CreateCell(int columnIndex, int rowIndex, object? value)
|
||||
{
|
||||
var cell = new Cell { CellReference = $"{GetColumnName(columnIndex)}{rowIndex}" };
|
||||
@@ -312,7 +346,7 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Services
|
||||
new C.AxisId { Val = coefficientAxisId });
|
||||
var distanceChart = new C.ScatterChart(
|
||||
new C.ScatterStyle { Val = C.ScatterStyleValues.LineMarker },
|
||||
CreateSeries(3, 4, lastRow),
|
||||
CreateSeries(3, 6, 7, Math.Min(lastRow, 3)),
|
||||
new C.AxisId { Val = xAxisId },
|
||||
new C.AxisId { Val = forceAndDistanceAxisId });
|
||||
|
||||
@@ -329,7 +363,7 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Services
|
||||
new C.Legend(
|
||||
new C.LegendPosition { Val = C.LegendPositionValues.Bottom },
|
||||
new C.Layout()),
|
||||
new C.PlotVisibleOnly { Val = true });
|
||||
new C.PlotVisibleOnly { Val = false });
|
||||
|
||||
return new C.ChartSpace(
|
||||
new C.EditingLanguage { Val = "zh-CN" },
|
||||
@@ -337,9 +371,15 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Services
|
||||
}
|
||||
|
||||
private static C.ScatterChartSeries CreateSeries(uint index, int yColumnIndex, int lastRow)
|
||||
{
|
||||
return CreateSeries(index, 1, yColumnIndex, lastRow);
|
||||
}
|
||||
|
||||
private static C.ScatterChartSeries CreateSeries(uint index, int xColumnIndex, int yColumnIndex, int lastRow)
|
||||
{
|
||||
var sheet = EscapeSheetName(DataSheetName);
|
||||
var xFormula = $"'{sheet}'!$A$2:$A${lastRow}";
|
||||
var xColumn = GetColumnName(xColumnIndex);
|
||||
var xFormula = $"'{sheet}'!${xColumn}$2:${xColumn}${lastRow}";
|
||||
var yColumn = GetColumnName(yColumnIndex);
|
||||
var yFormula = $"'{sheet}'!${yColumn}$2:${yColumn}${lastRow}";
|
||||
var titleFormula = $"'{sheet}'!${yColumn}$1";
|
||||
|
||||
Reference in New Issue
Block a user