public DailyChart(StockBDContext con, string ticker, ChartDuration duration) : this(con) { m_Tickers = new TickerList(con, ticker); TickerList = new SelectList(m_Tickers.Tickers, "Value", "Text"); selectTicker = ticker; selectDuration = duration; EndDate = DateTime.Today; switch (duration) { case ChartDuration.OneMonth: StartDate = DateTime.Today.AddDays(-25); break; case ChartDuration.SixMonths: StartDate = DateTime.Today.AddDays(-150); break; case ChartDuration.OneYear: StartDate = DateTime.Today.AddDays(-300); break; case ChartDuration.ThreeYears: StartDate = DateTime.Today.AddDays(-900); break; case ChartDuration.AllYears: StartDate = EndDate; // use same start and end date for entire data break; } }
public DailyChart(StockBDContext con) { m_dBContext = con; m_Tickers = new TickerList(con); TickerList = new SelectList(m_Tickers.Tickers, "Value", "Text"); DurationList = new SelectList(Enum.GetValues(typeof(ChartDuration))); selectDuration = ChartDuration.OneMonth; }
public DailyChart(StockBDContext con, string ticker) : this(con) { selectTicker = ticker; selectDuration = ChartDuration.OneMonth; EndDate = DateTime.Today; StartDate = DateTime.Today.AddDays(-30); m_Tickers = new TickerList(con, ticker); TickerList = new SelectList(m_Tickers.Tickers, "Value", "Text"); }
// GET: /DailyChart/Show public ActionResult Show(string selectTicker, ChartDuration selectDuration = ChartDuration.OneMonth) { StockBDContext dbC = new StockBDContext(); DailyChart dChart = new DailyChart(dbC, selectTicker, selectDuration); // ViewBag.Dailychart = dChart; dChart.GetData(); ViewBag.ChosenTicker = selectTicker; ViewBag.PriceData = dChart.sPriceData; ViewBag.VolumeData = dChart.sVolumeData; return(View(dChart)); }
private async void elipChartDuration_Tapped(object sender, TappedRoutedEventArgs e) { var chartDuration = ((Ellipse)sender).Tag.ToString(); switch (chartDuration) { case "Last Week": { tbLastMonth.Foreground = App.Current.Resources["LightGrayTextColor"] as SolidColorBrush; tbLastYear.Foreground = App.Current.Resources["LightGrayTextColor"] as SolidColorBrush; tbLastWeek.Foreground = App.Current.Resources["OrangeTextColor"] as SolidColorBrush; elipLastMonth.Visibility = Visibility.Collapsed; elipLastYear.Visibility = Visibility.Collapsed; elipLastWeek.Visibility = Visibility.Visible; SelectedChartDuration = ChartDuration.LastWeek; break; } case "Last Month": { tbLastWeek.Foreground = App.Current.Resources["LightGrayTextColor"] as SolidColorBrush; tbLastYear.Foreground = App.Current.Resources["LightGrayTextColor"] as SolidColorBrush; tbLastMonth.Foreground = App.Current.Resources["OrangeTextColor"] as SolidColorBrush; elipLastYear.Visibility = Visibility.Collapsed; elipLastWeek.Visibility = Visibility.Collapsed; elipLastMonth.Visibility = Visibility.Visible; SelectedChartDuration = ChartDuration.LastMonth; break; } case "Last Year": { tbLastWeek.Foreground = App.Current.Resources["LightGrayTextColor"] as SolidColorBrush; tbLastMonth.Foreground = App.Current.Resources["LightGrayTextColor"] as SolidColorBrush; tbLastYear.Foreground = App.Current.Resources["OrangeTextColor"] as SolidColorBrush; elipLastWeek.Visibility = Visibility.Collapsed; elipLastMonth.Visibility = Visibility.Collapsed; elipLastYear.Visibility = Visibility.Visible; SelectedChartDuration = ChartDuration.LastYear; break; } } await CreateChartAsync(); }