public void UnInitializeControl() { if (this.DesignMode) { return; } _account.UpdatedEvent -= new Account.AccountUpdateDelegate(_account_UpdateEvent); chartControl1.MasterPane.Remove(_chartSeries); _chartSeries.ClearValues(); _chartSeries = null; }
private void buttonCalculate_Click(object sender, EventArgs e) { List <double> positiveResults = new List <double>(); List <double> negativeResults = new List <double>(); for (int i = 0; i < (int)numericUpDownIterations.Value; i++) { int positives, negatives; PerformConsecutivesIteration(out positives, out negatives); if (positiveResults.Count < positives + 1) { positiveResults.AddRange(new double[positives - positiveResults.Count + 1]); negativeResults.AddRange(new double[positives - negativeResults.Count + 1]); } if (negativeResults.Count < negatives + 1) { positiveResults.AddRange(new double[negatives - positiveResults.Count + 1]); negativeResults.AddRange(new double[negatives - negativeResults.Count + 1]); } positiveResults[positives] = positiveResults[positives] + 1; negativeResults[negatives] = negativeResults[negatives] + 1; } graphControl.Clear(); LinesChartSeries series1 = new LinesChartSeries("+", LinesChartSeries.ChartTypeEnum.Histogram, GeneralHelper.DoublesToFloats(positiveResults.ToArray())); series1.DefaultPen = Pens.Green; graphControl.MasterPane.Add(series1); LinesChartSeries series2 = new LinesChartSeries("-", LinesChartSeries.ChartTypeEnum.Histogram, GeneralHelper.DoublesToFloats(negativeResults.ToArray())); series2.DefaultPen = Pens.Red; graphControl.MasterPane.Add(series2); graphControl.MasterPane.FitDrawingSpaceToScreen(true, true); }
private void buttonCall_Click(object sender, EventArgs e) { float[] values = new float[(int)numericUpDownEnd.Value - (int)numericUpDownStart.Value]; float price = (float)numericUpDownPrice.Value; float strike = (float)numericUpDownStrike.Value; for (int i = 0; i < values.Length; i++) { float difference = i - price - strike; if (difference > 0) { values[i] = difference / (float)numericUpDownPrice.Value; } } LinesChartSeries series = new LinesChartSeries(); series.Name = "call " + price.ToString("#.00") + ";" + strike.ToString("#.00"); series.AddValueSet(values); chartControl1.MasterPane.Add(series); }