public Plot(Read rr, ComboBox xBox, ComboBox yBox, Chart chart) { int indX = xBox.SelectedIndex; int indY = yBox.SelectedIndex; float[,] data = rr.get_Data(); int nLines = rr.get_nLines(); int nColumns = rr.get_nColumns(); string [] header = rr.get_Header(); chart.Series.Clear(); //ensure that the chart is empty chart.Series.Add("Series0"); chart.Series[0].ChartType = SeriesChartType.Line; chart.ChartAreas[0].AxisX.LabelStyle.Format = "{F2}"; chart.ChartAreas[0].AxisX.Title = header[indX]; chart.ChartAreas[0].AxisY.Title = header[indY]; float x_grids = 6; float[] ext = get_Extrema(data, nLines, nColumns, indX); chart.ChartAreas[0].AxisX.MajorGrid.Interval = (ext[1] - ext[0]) / x_grids; chart.ChartAreas[0].AxisX.LabelStyle.Interval = (ext[1] - ext[0]) / x_grids; chart.ChartAreas[0].AxisX.MajorTickMark.Interval = (ext[1] - ext[0]) / x_grids; chart.Legends.Clear(); for (int j = 0; j < nLines; j++) { chart.Series[0].Points.AddXY(data[j, indX], data[j, indY]); } }
public Plot(Read rr, ComboBox xBox, ComboBox yBox, Chart chart) { int indX = xBox.SelectedIndex; int indY = yBox.SelectedIndex; float[,] data = rr.get_Data(); int nLines = rr.get_nLines(); int nColumns = rr.get_nColumns(); string []header = rr.get_Header(); chart.Series.Clear(); //ensure that the chart is empty chart.Series.Add("Series0"); chart.Series[0].ChartType = SeriesChartType.Line; chart.ChartAreas[0].AxisX.LabelStyle.Format = "{F2}"; chart.ChartAreas[0].AxisX.Title = header[indX]; chart.ChartAreas[0].AxisY.Title = header[indY]; float x_grids = 6; float[] ext = get_Extrema(data, nLines, nColumns, indX); chart.ChartAreas[0].AxisX.MajorGrid.Interval = (ext[1] - ext[0]) / x_grids; chart.ChartAreas[0].AxisX.LabelStyle.Interval = (ext[1] - ext[0]) / x_grids; chart.ChartAreas[0].AxisX.MajorTickMark.Interval = (ext[1] - ext[0]) / x_grids; chart.Legends.Clear(); for (int j = 0; j < nLines; j++) { chart.Series[0].Points.AddXY(data[j, indX], data[j, indY]); } }
public Plot(Read rr, ComboBox xBox, ComboBox yBox, Chart chart) { int indX = xBox.SelectedIndex; int indY = yBox.SelectedIndex; float[,] data = rr.get_Data(); int nLines = rr.get_nLines(); chart.Series.Clear(); //ensure that the chart is empty chart.Series.Add("Series0"); chart.Series[0].ChartType = SeriesChartType.Line; chart.Legends.Clear(); for (int j = 0; j < nLines; j++) { chart.Series[0].Points.AddXY(data[j, indX], data[j, indY]); } }