private void refresh_plot()
{
PlotModel pm = plot1.Model;
pm.Series.Clear();
pm.Axes.Clear();
ResetPlotComponents();
if (checkBoxLines.Checked)
{
BlueComponent.lines.Smooth = false;
RedComponent.lines.Smooth = false;
if (dual)
{
GreenComponent.lines.Smooth = false;
YellowComponent.lines.Smooth = false;
}
}
GraphType type = comboBoxPlotType.SelectedItem as GraphType;
if (type == null)
{
MessageBox.Show("Something bad happened! SelectedItem is null...");
return;
}
else
{
reset_minmax();
type.PlotFunc(mlog, 0.0, BlueComponent, RedComponent);
if (type.DualGraph == GraphType.GT.nolines)
BlueComponent.Add(pm, checkBoxLines.Checked);
else
{
BlueComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
if (type.DualGraph == GraphType.GT.dual)
RedComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
}
if (dual)
{
type.PlotFunc(mlog2, -(double)numericUpDownDelay.Value, GreenComponent, YellowComponent);
if (type.DualGraph == GraphType.GT.nolines)
GreenComponent.Add(pm, checkBoxLines.Checked);
else
{
GreenComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
if (type.DualGraph == GraphType.GT.dual)
YellowComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
}
}
}
var linearAxis1 = new LinearAxis();
linearAxis1.AbsoluteMinimum = x_min - (x_max - x_min) / 20.0;
linearAxis1.AbsoluteMaximum = x_max + (x_max - x_min) / 20.0;
linearAxis1.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139);
linearAxis1.MajorGridlineStyle = LineStyle.Solid;
linearAxis1.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139);
linearAxis1.MinorGridlineStyle = LineStyle.Solid;
linearAxis1.Position = AxisPosition.Bottom;
linearAxis1.Title = type.AxisX;
pm.Axes.Add(linearAxis1);
var linearAxis2 = new LinearAxis();
linearAxis2.AbsoluteMinimum = y_min - (y_max - y_min) / 20.0;
linearAxis2.AbsoluteMaximum = y_max + (y_max - y_min) / 20.0;
linearAxis2.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139);
linearAxis2.MajorGridlineStyle = LineStyle.Solid;
linearAxis2.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139);
linearAxis2.MinorGridlineStyle = LineStyle.Solid;
linearAxis2.Title = type.AxisY;
pm.Axes.Add(linearAxis2);
plot1.RefreshPlot(true);
}