Beispiel #1
0
        //SET UP GRAPHS
        public void SetUpGraphs()
        {
            GraphVM main = new GraphVM(this.ObjectiveEvolution, "Objective");

            this.Graphs["Main"].Add(main);

            for (int i = 0; i < Design.Constraints.Count; i++)
            {
                GraphVM gvm = new GraphVM(ConstraintsEvolution[i], String.Format("C{0}", i));
                this.Graphs["Constraints"].Add(gvm);
                this.Constraints.Add(new ConstVM(Design.Constraints[i], gvm));
            }

            UpdateCurrentScoreDisplay();
        }
        //CONSTRUCTOR
        public GraphControl(GraphVM graphVM, RadicalVM radicalVM, RadicalWindow window)
        {
            this.RadicalVM   = radicalVM;
            this.GraphVM     = graphVM;
            this.DataContext = graphVM;
            this.MyWindow    = window;

            InitializeComponent();

            this.GraphVM.Window = window;
            this.GraphVM.Graph  = Chart;

            this.GraphVM.ChartLineVisibility = Visibility.Collapsed;

            ChartAxisY.LabelFormatter = value => value.ToString("N2");
        }
Beispiel #3
0
        public void ClearGraphs()
        {
            GraphVM MainGVM = this.Graphs["Main"][0];
            int     max     = MainGVM.DefaultMaxXAxis;

            MainGVM.ChartValues.Clear();
            MainGVM.ChartValues.Add(this.Design.Objectives[0]);
            MainGVM.XAxisStep           = 1;
            MainGVM.MaxXAxis            = max;
            MainGVM.ChartLineVisibility = Visibility.Collapsed;

            for (int i = 0; i < this.Graphs["Constraints"].Count; i++)
            {
                GraphVM ConstraintGVM = this.Graphs["Constraints"].ElementAt(i);
                ConstraintGVM.ChartValues.Clear();
                ConstraintGVM.ChartValues.Add(this.Design.Constraints.ElementAt(i).CurrentValue);
                ConstraintGVM.XAxisStep           = 1;
                ConstraintGVM.MaxXAxis            = max;
                ConstraintGVM.ChartLineVisibility = Visibility.Collapsed;
            }
        }
        //ADD GRAPHS
        //Creates a graph for the main objective and for all of the constraints
        private void AddGraphs()
        {
            //MAIN OBJECTIVE GRAPH
            var g = new GraphControl(this.RadicalVM.Graphs["Main"][0], this.RadicalVM, this);

            //g.GraphGrid.Height = MainGrid.ActualHeight * 0.9;
            g.UpdateHeightFullScreen();

            GraphControls["Main"].Add(g);
            MainBlock.Children.Add(GraphControls["Main"][0]);

            //CONSTRAINTS GRAPHS
            //Collapse Constraints expander if no constraints are imposed
            if (RadicalVM.Constraints.Any())
            {
                VariableHeaderControl labels = new VariableHeaderControl();
                labels.HeaderGrid.Margin = new Thickness(25, 0, 0, 0);
                this.Constraints.Children.Add(labels);

                for (int i = 0; i < RadicalVM.Constraints.Count; i++)
                {
                    GraphVM gvm = RadicalVM.Graphs["Constraints"][i];
                    g = new GraphControl(gvm, this.RadicalVM, this);
                    // g.GraphGrid.Height = MainGrid.ActualHeight * 0.45;
                    g.UpdateHeightHalfScreen();
                    GraphControls["Constraints"].Add(g);

                    ConstVM c = RadicalVM.Constraints[i];
                    this.Constraints.Children.Add(new ConstraintControl(c, this));
                }
            }
            else
            {
                this.ConstraintsExpander.Visibility = Visibility.Collapsed;
            }
        }