private IEnumerable <CustomGroupItem> GetGroupByWeek(FlexChartDateTimeFilter dtFilter) { var weeksData = finanicalData.Select(x => { DateTime dt = x.Date; var data = new { GroupKey = dt.GetFirstDateOfWeek(), High = x.High, Low = x.Low, Open = x.Open, Close = x.Close, }; return(data); }); return(weeksData.GroupBy(x => x.GroupKey).Select(x => new CustomGroupItem { XValue = dtFilter.GetFormattedString(x.Key, dtFilter.GroupFormats[DateTimeGroupOption.Weekly], x.Key.GetWeekOfMonth()), High = x.Max(y => y.High), Low = x.Min(y => y.Low), Open = x.First().Open, Close = x.Last().Close, Min = x.Key, Max = x.Key.GetLastDateOfWeek(), })); }
private IEnumerable <CustomGroupItem> GetGroupByMonth(FlexChartDateTimeFilter dtFilter) { var monthsData = finanicalData.Select(x => { DateTime dt = x.Date; var data = new { GroupKey = new DateTime(dt.Year, dt.Month, 1), High = x.High, Low = x.Low, Open = x.Open, Close = x.Close, }; return(data); }); return(monthsData.GroupBy(x => x.GroupKey).Select(x => new CustomGroupItem { XValue = x.Key.ToString(dtFilter.GroupFormats[DateTimeGroupOption.Monthly]), High = x.Max(y => y.High), Low = x.Min(y => y.Low), Open = x.First().Open, Close = x.Last().Close, Min = x.Key, Max = new DateTime(x.Key.Year, x.Key.Month, DateTime.DaysInMonth(x.Key.Year, x.Key.Month)), })); }
private void InitFilters() { var priceFilter = new FlexChartFilter(finanicalData, "Date", "High", C1.Chart.ChartType.Scatter); priceFilter.HeaderText = "Daily High Prices"; priceFilter.SelectionMode = SelectionMode.RangeSelect; priceFilter.ShowRangeSlider = true; priceFilter.SliderLowerValue = new DateTime(finanicalData.Last().Date.Year, 7, 15).ToOADate(); priceFilter.SliderUpperValue = finanicalData.Last().Date.ToOADate(); priceFilter.FlexChart.SelectionStyle.FillColor = Color.NavajoWhite; priceFilter.FlexChart.SelectionStyle.StrokeColor = Color.Red; c1DataFilter1.Filters.Add(priceFilter); var grpVolumeFilter = new FlexChartDateTimeFilter(finanicalData, "Date", "Volume", C1.Chart.ChartType.Column); grpVolumeFilter.ShowSelectionMode = false; grpVolumeFilter.HeaderText = "Volume"; grpVolumeFilter.FlexChart.AxisY.Format = "#,##0,,M"; grpVolumeFilter.GroupByChanged += (s, e) => { var dtFilter = (s as FlexChartDateTimeFilter); dtFilter.ShowRangeSlider = dtFilter.GroupBy != DateTimeGroupOption.Quarterly && dtFilter.GroupBy != DateTimeGroupOption.Yearly; }; grpVolumeFilter.GroupBy = DateTimeGroupOption.Yearly; c1DataFilter1.Filters.Add(grpVolumeFilter); var customDtFilter = new FlexChartDateTimeFilter(finanicalData, "Date", "High,Low,Open,Close", C1.Chart.ChartType.Candlestick); customDtFilter.HeaderText = "High-Low-Open-Close"; customDtFilter.FlexChart.ToolTip.Content = "X:{x}\nH:{High}\nL:{Low}\nO:{Open}\nC:{Close}"; customDtFilter.UseCustomGroups = true; customDtFilter.GroupByChanged += CustomDtFilter_GroupByChangedChanged; customDtFilter.GroupBy = DateTimeGroupOption.Monthly; customDtFilter.SliderLowerValue = 17; customDtFilter.SliderUpperValue = 24; customDtFilter.ShowAggregate = customDtFilter.ShowSelectionMode = false; c1DataFilter1.Filters.Add(customDtFilter); }