Вот мой код:
Я пытаюсь получить файлы CSV из папки. После этого я извлекаю данные из этих файлов и сохраняю их в списках zedX и zedY. Я передаю эти два массива в zedgraphControl.
Я получаю сюжет точно. Но есть линейная линия, соединяющая от 0 до последней точки на моем графике. Как мне это убрать?
//I am taking in a folder which have CSV files containing a data. So, iterating over files in the outer loop
for (int i = 0; i < inputFolder.Count; i++)
{
//Lists to contain the data
List<Double> zedXList = new List<double>();
List<Double> zedYList = new List<double>();
//Arrays to be passed into zedgraph
double[] zedX = new double[thisbin.IndLists[i].Count()];
double[] zedY = new double[thisbin.IndLists[i].Count()];
for (int l = 0; l < thisbin.IndLists[i].Count(); l++)
{
zedX[l] = 0;
zedY[l] = 0;
}
//In the inner loop I fetch the data from the file and store it in lists
for (int j = 0; j < thisbin.IndLists[i].Count(); j++)
{
if (j % 2 == 0)
{
zedXList.Add(thisbin.IndLists[i][j]);
}
if (j % 2 != 0)
{
zedYList.Add(thisbin.IndLists[i][j]);
}
}
//from the lists I pass the data into arrays, in order to pass it into zedgraph
for (int k = 0; k < zedXList.Count(); k++)
{
zedX[k] = Convert.ToDouble(zedXList[k]);
zedY[k] = Convert.ToDouble(zedYList[k]);
}
//zedgraph plot
string title = "PLOT-" + Convert.ToString(i + 1);
TabPage myTabPage = new TabPage(title);
var zed = new ZedGraphControl();
zed.Dock = DockStyle.Fill;
zed.Size = new System.Drawing.Size(575, 312);
zed.GraphPane.CurveList.Clear();
var Indpane2 = zed.GraphPane;
Indpane2.Title.Text = "PLOT" + Convert.ToString(i + 1);
Indpane2.XAxis.Title.Text = "m/z";
Indpane2.YAxis.Title.Text = "Intensity";
var ind2 = new PointPairList(zedX, zedY);
var IndCurve2 = Indpane2.AddCurve(title, ind2, Color.OrangeRed, SymbolType.Default);
Indpane2.AxisChange();
myTabPage.Controls.Add(zed);
tabControl1.TabPages.Add(myTabPage);
IndCurve2.Line.IsVisible = true;
IndCurve2.Line.Width = 2.0F;
zed.Invalidate();
zed.Refresh();
}