Exemple #1
0
        void RefreshComputedValues()
        {
            if (_selectedCut != null)
            {
                foreach (KeyValuePair <string, ComputedProperty> field in _computedFields)
                {
                    double value = _selectedCut.ComputeValue(field.Key);
                    field.Value.text.Text = value.ToString("0.#####");

                    bool warn = field.Value.model.warnAbove != 0 && value > field.Value.model.warnAbove;
                    warn = warn || (field.Value.model.warnBelow != 0 && value < field.Value.model.warnBelow);
                    field.Value.text.Background = new SolidColorBrush(warn ? k_warningColor : k_computedColor);
                }

                var    x     = Enumerable.Range(0, 360).Select(i => (double)i).ToList();
                var    y     = _selectedCut.ComputeCuttingForces(x);
                double total = y.Sum();
                //_graph.Description = "Force " + total;
                _graph.Plot(x, y);
                DataRect rect = _graph.ActualPlotRect;
                _graph.SetPlotRect(new DataRect(0, 0, 360, y.Max()));
            }

            Save();
        }
        public InteractiveDisplayControl()
        {
            InitializeComponent();

            double[] x = new double[200];
            for (int i = 0; i < x.Length; i++)
            {
                x[i] = 3.1415 * i / (x.Length - 1);
            }

            for (int i = 0; i < 25; i++)
            {
                var lg = new LineGraph();
                lines.Children.Add(lg);
                lg.Stroke          = new SolidColorBrush(Color.FromArgb(255, 0, (byte)(i * 10), 0));
                lg.Description     = String.Format("Data series {0}", i + 1);
                lg.StrokeThickness = 2;
                lg.Plot(x, x.Select(v => Math.Sin(v + i / 10.0)).ToArray());

                lg.SetPlotRect(new DataRect(0, -120, 100, -20));
            }

            plotter.IsAutoFitEnabled = false;
        }