コード例 #1
0
        public CoilChangeChart()
        {
            InitializeComponent();

            var mapper = Mappers.Xy <CoilChangeModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <CoilChangeModel>(mapper);

            //the values property will store our values array
            ChartValues = new GearedValues <CoilChangeModel>();
            ChartValues.WithQuality(Quality.Highest);

            //lets set how to display the X Labels
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");

            //AxisStep forces the distance between each separator in the X axis
            AxisStep = TimeSpan.FromSeconds(1).Ticks;
            //AxisUnit forces lets the axis know that we are plotting seconds
            //this is not always necessary, but it can prevent wrong labeling
            AxisUnit = TimeSpan.TicksPerSecond;

            SetAxisLimits(DateTime.Now);

            //The next code simulates data changes every 300 ms

            IsReading = false;

            DataContext = this;
        }
コード例 #2
0
        public PLGraphVM()
        {
            DataSeries = new SeriesCollection();
            var strategyPLValue = new GearedValues <ObservablePoint>();

            strategyPLValue.WithQuality(Quality.Highest);
            StrategyPL = new GLineSeries()
            {
                Title           = "Strategy P/L",
                Values          = strategyPLValue,
                Fill            = Brushes.Transparent,
                Stroke          = Brushes.Blue,
                StrokeThickness = 2,
                PointGeometry   = null
            };
            var benchmarkPLValue = new GearedValues <ObservablePoint>();

            benchmarkPLValue.WithQuality(Quality.Highest);
            BenchmarkPL = new GLineSeries()
            {
                Title           = "Benchmark P/L",
                Values          = benchmarkPLValue,
                Fill            = Brushes.Transparent,
                Stroke          = Brushes.DarkGray,
                StrokeThickness = 2,
                PointGeometry   = null
            };

            DataSeries.Add(StrategyPL);
            DataSeries.Add(BenchmarkPL);
        }
コード例 #3
0
            public IPInfo(string serverIp)
            {
                this.serverIp = serverIp;

                outboundChartValues.WithQuality(Quality.Medium);
                inboundChartValues.WithQuality(Quality.Medium);
                outboundTimeDiffChartValues.WithQuality(Quality.High);
                inboundTimeDiffChartValues.WithQuality(Quality.High);
            }
コード例 #4
0
        public MainWindow()
        {
            InitializeComponent();

            Graph.DisableAnimations = true;
            Graph.AnimationsSpeed   = TimeSpan.FromMilliseconds(50);
            Graph.Hoverable         = false;

            GearedValues <double> gvalues1 = new GearedValues <double>();

            gvalues1.WithQuality(Quality.Low);
            GearedValues <double> gvalues2 = new GearedValues <double>();

            gvalues2.WithQuality(Quality.Low);
            GearedValues <double> gvalues3 = new GearedValues <double>();

            gvalues3.WithQuality(Quality.Low);
            GearedValues <double> gvalues4 = new GearedValues <double>();

            gvalues4.WithQuality(Quality.Low);

            SeriesCollection = new SeriesCollection
            {
                new GLineSeries
                {
                    Title          = "Total Cost 1",
                    Values         = gvalues1,
                    LineSmoothness = 1.0,
                },
                new GLineSeries
                {
                    Title          = "Total Cost 2",
                    Values         = gvalues2,
                    LineSmoothness = 1.0,
                },
                new GLineSeries
                {
                    Title          = "Total Cost 3",
                    Values         = gvalues3,
                    LineSmoothness = 1.0,
                },
                new GLineSeries
                {
                    Title          = "Total Cost 4",
                    Values         = gvalues4,
                    LineSmoothness = 1.0,
                },
            };
            DataContext = this;
            Loaded     += MainWindow_Loaded;
        }
コード例 #5
0
        public GraphingForm()
        {
            InitializeComponent();
            MainInterface.graphingOpen = true;

            // Populate the axes selection boxes
            foreach (ControlEnums.AXISOPTIONS axis in Enum.GetValues(typeof(ControlEnums.AXISOPTIONS)))
            {
                XAxisSelectionBox.Items.Add(ControlEnums.GetAttribute(axis).disp);
                YAxis1SelectionBox.Items.Add(ControlEnums.GetAttribute(axis).disp);
                YAxis2SelectionBox.Items.Add(ControlEnums.GetAttribute(axis).disp);
            }
            XAxisSelectionBox.SelectedIndex  = 0;
            YAxis1SelectionBox.SelectedIndex = 3;
            YAxis2SelectionBox.SelectedIndex = 4;

            // Create the mappers for the 3 series
            series1Mapper = Mappers.Xy <GraphingEntry>().X(entry => entry.uptime / 1000.0).Y(entry => entry.position);
            series2Mapper = Mappers.Xy <GraphingEntry>().X(entry => entry.uptime / 1000.0).Y(entry => entry.velocity);
            lineMapper    = Mappers.Xy <GraphingLine>().X(line => line.uptime / 1000.0).Y(line => line.y);

            series1 = new LineSeries(series1Mapper)
            {
                Values = series1Values, PointGeometrySize = 2, StrokeThickness = 2, Fill = System.Windows.Media.Brushes.Transparent
            };
            series2 = new LineSeries(series2Mapper)
            {
                Values = series2Values, PointGeometrySize = 2, StrokeThickness = 2, Fill = System.Windows.Media.Brushes.Transparent
            };
            setLine1 = new LineSeries(lineMapper)
            {
                Values = setLine1Values, PointGeometrySize = 2, StrokeThickness = 2, Fill = System.Windows.Media.Brushes.Transparent,
                Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 33, 149, 242)), StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    2
                }
            };
            setLine2 = new LineSeries(lineMapper)
            {
                Values = setLine2Values, PointGeometrySize = 2, StrokeThickness = 2, Fill = System.Windows.Media.Brushes.Transparent,
                Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 243, 67, 54)), StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    2
                }
            };
            setLine3 = new LineSeries(lineMapper)
            {
                Values = setLine3Values, PointGeometrySize = 2, StrokeThickness = 2, Fill = System.Windows.Media.Brushes.Transparent,
                Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 243, 67, 54)), StrokeDashArray = new System.Windows.Media.DoubleCollection {
                    2
                }
            };

            // Create the chart series
            Chart.Series = new SeriesCollection {
                series1, series2, setLine1, setLine2
            };

            // Chart option setup
            Chart.DisableAnimations = true;
            //Chart.Hoverable = false;
            Chart.DataTooltip = null;
            series1Values.WithQuality(Quality.Medium);
            series2Values.WithQuality(Quality.Medium);
            setLine1Values.WithQuality(Quality.Low);
            setLine2Values.WithQuality(Quality.Low);
            setLine3Values.WithQuality(Quality.Low);

            pictureBox1.BackColor   = Color.FromArgb(255, 33, 149, 242);
            pictureBox2.BackColor   = Color.FromArgb(255, 243, 67, 54);
            GraphPeriodTextBox.Text = (double)(DataPointsUpDown.Value * (MainInterface.instance.ProgramLoopTimer.Interval / 1000.0m)) + " s";
        }