Beispiel #1
0
        private List <SeriesViewModelBase> GetSeriesData()
        {
            List <SeriesViewModelBase> seriesData = new List <SeriesViewModelBase>();

            Random               r    = new Random();
            DateTime             date = new DateTime(2015, 1, 1);
            MonthSeriesViewModel svm1 = new MonthSeriesViewModel();

            for (int i = 0; i < 12; i++)
            {
                svm1.MonthData.Add(new MonthSaleInfo {
                    Date = date.AddMonths(i), TotalAmmount = r.Next(600, 850),
                });
            }
            seriesData.Add(svm1);

            DailySeriesViewModel svm2 = new DailySeriesViewModel();

            svm2.DailyData.Add(new DailyProductInfo {
                Date = date, UnitsSold = 70
            });
            for (int i = 1; i < 350; i++)
            {
                svm2.DailyData.Add(new DailyProductInfo {
                    Date = date.AddDays(i), UnitsSold = r.Next(30, 45),
                });
            }
            seriesData.Add(svm2);

            return(seriesData);
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DailySeriesViewModel dailyVM = (DailySeriesViewModel)value;
            LinearAxis           axis    = new LinearAxis();

            axis.HorizontalLocation = AxisHorizontalLocation.Right;
            BindingOperations.SetBinding(axis, LinearAxis.ElementBrushProperty, new Binding("DailyStroke")
            {
                Source = dailyVM
            });
            return(axis);
        }
        public override ChartSeriesDescriptor SelectDescriptor(ChartSeriesProvider provider, object context)
        {
            DailySeriesViewModel dailyVM   = context as DailySeriesViewModel;
            MonthSeriesViewModel monthlyVM = context as MonthSeriesViewModel;

            if (dailyVM != null)
            {
                return(this.DailyDescriptor);
            }
            else if (monthlyVM != null)
            {
                return(this.MonthDescriptor);
            }

            throw new NotSupportedException("Not supported series viewmodel type.");
        }
        private List<SeriesViewModelBase> GetSeriesData()
        {
            List<SeriesViewModelBase> seriesData = new List<SeriesViewModelBase>();

            Random r = new Random();
            DateTime date = new DateTime(2015, 1, 1);
            MonthSeriesViewModel svm1 = new MonthSeriesViewModel();
            for (int i = 0; i < 12; i++)
            {
                svm1.MonthData.Add(new MonthSaleInfo { Date = date.AddMonths(i), TotalAmmount = r.Next(600, 850), });
            }
            seriesData.Add(svm1);

            DailySeriesViewModel svm2 = new DailySeriesViewModel();
            svm2.DailyData.Add(new DailyProductInfo { Date = date, UnitsSold = 70 });
            for (int i = 1; i < 350; i++)
            {
                svm2.DailyData.Add(new DailyProductInfo { Date = date.AddDays(i), UnitsSold = r.Next(30, 45), });
            }
            seriesData.Add(svm2);

            return seriesData;
        }