1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Drawing;
|
---|
5 | using System.Data;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 | using HeuristicLab.Core;
|
---|
10 | using HeuristicLab.Charting;
|
---|
11 |
|
---|
12 | namespace HeuristicLab.CEDMA.Charting {
|
---|
13 | public partial class ResultListView : ViewBase {
|
---|
14 | private ResultList results;
|
---|
15 | private const string FREQUENCY = "<Frequency>";
|
---|
16 | private const string CONSTANT_SIZE = "<constant>";
|
---|
17 | private double xJitterFactor = 0.0;
|
---|
18 | private double yJitterFactor = 0.0;
|
---|
19 | private double maxXJitterPercent = .1;
|
---|
20 | private double maxYJitterPercent = .1;
|
---|
21 |
|
---|
22 | public ResultListView(ResultList results) {
|
---|
23 | this.results = results;
|
---|
24 | results.Changed += new EventHandler(results_Changed);
|
---|
25 | InitializeComponent();
|
---|
26 | xAxisComboBox.Items.AddRange(results.VariableNames);
|
---|
27 | yAxisComboBox.Items.Add(FREQUENCY);
|
---|
28 | yAxisComboBox.Items.AddRange(results.VariableNames);
|
---|
29 | sizeComboBox.Items.Add(CONSTANT_SIZE);
|
---|
30 | sizeComboBox.Items.AddRange(results.VariableNames);
|
---|
31 | sizeComboBox.SelectedItem = sizeComboBox.Items[0];
|
---|
32 | InitChart();
|
---|
33 | }
|
---|
34 |
|
---|
35 | private DateTime lastUpdate = DateTime.Now;
|
---|
36 | void results_Changed(object sender, EventArgs e) {
|
---|
37 | if(DateTime.Now.Subtract(lastUpdate).TotalSeconds < 3) return;
|
---|
38 | lastUpdate = DateTime.Now;
|
---|
39 | InitChart();
|
---|
40 | }
|
---|
41 |
|
---|
42 | private void InitChart() {
|
---|
43 | dataChart.Chart = new BubbleChart(results, 0, 0, 100, 100);
|
---|
44 | }
|
---|
45 |
|
---|
46 | private void yAxisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
47 | yJitterFactor = 0.0;
|
---|
48 | yTrackBar.Value = 0;
|
---|
49 | UpdateChart();
|
---|
50 | }
|
---|
51 |
|
---|
52 | private void xAxisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
53 | xJitterFactor = 0.0;
|
---|
54 | xTrackBar.Value = 0;
|
---|
55 | UpdateChart();
|
---|
56 | }
|
---|
57 |
|
---|
58 | private void UpdateChart() {
|
---|
59 | if(xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
|
---|
60 | if(yAxisComboBox.SelectedItem.Equals(FREQUENCY)) {
|
---|
61 | CreateHistogramChart();
|
---|
62 | } else {
|
---|
63 | dataChart.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | private void CreateHistogramChart() {
|
---|
68 | // TASK
|
---|
69 | }
|
---|
70 |
|
---|
71 | private void jitterTrackBar_ValueChanged(object sender, EventArgs e) {
|
---|
72 | if(dataChart.Chart != null) {
|
---|
73 | double xJitterFactor = xTrackBar.Value / 100.0;
|
---|
74 | double yJitterFactor = yTrackBar.Value / 100.0;
|
---|
75 | dataChart.Chart.SetJitter(xJitterFactor, yJitterFactor);
|
---|
76 | }
|
---|
77 | UpdateChart();
|
---|
78 | }
|
---|
79 |
|
---|
80 | private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
81 | if(dataChart.Chart != null) {
|
---|
82 | dataChart.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked);
|
---|
83 | UpdateChart();
|
---|
84 | }
|
---|
85 | }
|
---|
86 | }
|
---|
87 | }
|
---|