using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using HeuristicLab.Analysis; using HeuristicLab.Analysis.Views; using HeuristicLab.Collections; using HeuristicLab.Core; using HeuristicLab.Core.Views; using HeuristicLab.Data; using HeuristicLab.DataPreprocessing.Implementations; using HeuristicLab.MainForm; namespace HeuristicLab.DataPreprocessing.Views { [View("Single Scatter Plot View")] [Content(typeof(ScatterPlotContent), false)] public partial class SingleScatterPlotView : ItemView { private IChartLogic logic; public SingleScatterPlotView() { InitializeComponent(); } public new ScatterPlotContent Content { get { return (ScatterPlotContent)base.Content; } set { base.Content = value; } } public void InitData() { IEnumerable variables = logic.GetVariableNames(); comboBoxXVariable.Items.Clear(); comboBoxYVariable.Items.Clear(); comboBoxXVariable.Items.AddRange(variables.ToArray()); comboBoxYVariable.Items.AddRange(variables.ToArray()); if (variables.Count() >= 2) { comboBoxXVariable.SelectedIndex = 0; comboBoxYVariable.SelectedIndex = 1; UpdateScatterPlot(); } } protected override void OnContentChanged() { base.OnContentChanged(); if (Content != null) { logic = Content.ChartLogic; InitData(); } } private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { UpdateScatterPlot(); } private void UpdateScatterPlot() { if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) { ScatterPlot scatterPlot = logic.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem); scatterPlotView.Content = scatterPlot; } } } }