예제 #1
0
 public QuoteGridViewModel()
 {
     this._gridList      = new QuoteGridList();
     _quoteupdateservice = ServiceLocator.Current.GetInstance <IQuoteUpdateService>() as QuoteUpdateService;
     _eventaggregator    = ServiceLocator.Current.GetInstance <EventAggregator>();
     _quoteupdateservice.GridViewModel = this;
 }
예제 #2
0
        public QuotePlotViewModel()
        {
            this._quoteupdateservice          = ServiceLocator.Current.GetInstance <IQuoteUpdateService>() as QuoteUpdateService;
            _quoteupdateservice.PlotViewModel = this;
            this._configmanager = ServiceLocator.Current.GetInstance <IConfigManager>();


            // initialize tickplot model
            _tickplot = new PlotModel()
            {
                PlotMargins = new OxyThickness(50, 0, 0, 40),
                Background  = OxyColors.Transparent,
                //LegendTitle = "Legend",
                LegendTextColor   = OxyColors.White,
                LegendOrientation = LegendOrientation.Horizontal,
                LegendPlacement   = LegendPlacement.Outside,
                LegendPosition    = LegendPosition.TopRight,
                //LegendBackground = OxyColor.FromAColor(200, OxyColors.White),
                LegendBorder = OxyColors.Black
            };

            if (_configmanager.PlotRegularTradingHours)
            {
                _plotxaxisleft  = DateTime.Today.Add(new TimeSpan(9, 15, 0));
                _plotxaxisright = DateTime.Today.Add(new TimeSpan(16, 15, 0));
            }
            else
            {
                _plotxaxisleft  = DateTime.Today;
                _plotxaxisright = DateTime.Today.AddDays(1);
            }

            var dateAxis = new OxyPlot.Axes.DateTimeAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "Time", StringFormat = "HH:mm:ss", Minimum = OxyPlot.Axes.DateTimeAxis.ToDouble(_plotxaxisleft), Maximum = OxyPlot.Axes.DateTimeAxis.ToDouble(_plotxaxisright), MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, IntervalLength = 80
            };

            dateAxis.TextColor = OxyColors.White; dateAxis.TitleColor = OxyColors.White;
            _tickplot.Axes.Add(dateAxis);
            var priceAxis = new OxyPlot.Axes.LinearAxis()
            {
                Position = OxyPlot.Axes.AxisPosition.Left, Title = "Price", MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot
            };

            priceAxis.TextColor = OxyColors.White; priceAxis.TitleColor = OxyColors.White;
            _tickplot.Axes.Add(priceAxis);
        }