private void SaveOneDimXDataToCsv(StreamWriter writer) { StringBuilder lineData = new StringBuilder(Constants.DefaultCsvLineSize); lineData.Append(XAxisCsvLabel).Append(CsvDelim); //写出列名称 foreach (Series plotSeries in PlotSeries) { lineData.Append(plotSeries.Name).Append(CsvDelim); } if (lineData.Length > 0) { lineData.Remove(lineData.Length - 1, 1); } writer.WriteLine(lineData); lineData.Clear(); //写出各行数据 for (int i = 0; i < DataEntity.SamplesInChart; i++) { lineData.Append(DataEntity.GetXValue(i)).Append(CsvDelim); for (int j = 0; j < DataEntity.DataInfo.LineCount; j++) { lineData.Append(DataEntity.GetYValue(i, j)).Append(CsvDelim); } lineData.Remove(lineData.Length - 1, 1); writer.WriteLine(lineData); lineData.Clear(); } }