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(); //写出各行数据 DataEntity saveData = PlotDatas[0]; for (int i = 0; i < saveData.DataInfo.Size; i++) { lineData.Append(saveData.GetXData(i)).Append(CsvDelim); for (int j = 0; j < saveData.DataInfo.LineNum; j++) { lineData.Append(saveData.GetYData(j, i)).Append(CsvDelim); } lineData.Remove(lineData.Length - 1, 1); writer.WriteLine(lineData); lineData.Clear(); } }