Skip to content

Commit

Permalink
add SaveCSV support
Browse files Browse the repository at this point in the history
  • Loading branch information
swharden committed Jul 30, 2019
1 parent 08883f6 commit 4a04ffc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/ScottPlot/plottables/PlottableScatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ public override void Render(Settings settings)

public override void SaveCSV(string filePath)
{
throw new NotImplementedException();
StringBuilder csv = new StringBuilder();
for (int i = 0; i < ys.Length; i++)
csv.AppendFormat("{0}, {1}\n", xs[i], ys[i]);
System.IO.File.WriteAllText(filePath, csv.ToString());
}
}
}
5 changes: 4 additions & 1 deletion src/ScottPlot/plottables/PlottableSignal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ public override void Render(Settings settings)

public override void SaveCSV(string filePath)
{
throw new NotImplementedException();
StringBuilder csv = new StringBuilder();
for (int i = 0; i < ys.Length; i++)
csv.AppendFormat("{0}, {1}\n", xOffset + i * samplePeriod, ys[i]);
System.IO.File.WriteAllText(filePath, csv.ToString());
}
}
}

0 comments on commit 4a04ffc

Please sign in to comment.