I am creating a chart with a DateTime for the X axis. When I set BaseUnit to Days each days count is correct, but when I set BaseUnit to Months the count is not correct.
I'm not sure if my code is incorrect or this is an issue with RadHtmlChart functionality.
I assume there's nothing wrong with the code since the chart displays counts correctly when BaseUnit is set to Days.
The month count should be 49 but it's showing up as 17. There are 8 SeriesItems being added and 17 is the value of the 4th item; not sure if that has anything to do with where it's getting 17 from.
Any help is appreciated!
I'm not sure if my code is incorrect or this is an issue with RadHtmlChart functionality.
I assume there's nothing wrong with the code since the chart displays counts correctly when BaseUnit is set to Days.
The month count should be 49 but it's showing up as 17. There are 8 SeriesItems being added and 17 is the value of the 4th item; not sure if that has anything to do with where it's getting 17 from.
Any help is appreciated!
public static RadHtmlChart ChartDeploymentsByRemoteImaging(List<DeploymentsView> results){ RadHtmlChart RadHtmlChart1 = new RadHtmlChart(); RadHtmlChart1.ID = "RemoteImagingChart"; RadHtmlChart1.Width = Unit.Pixel(680); RadHtmlChart1.Height = Unit.Pixel(400); RadHtmlChart1.ChartTitle.Text = "Remote Imaging"; var groups = results.GroupBy(d => d.Date.Date) .Select(g => new { Date = g.Key, Count = g.Count(), RemoteCount = g.Where(d=>d.TaskSequence.ToUpper().Contains("OSD")).Count() }); ColumnSeries series = new ColumnSeries(); ColumnSeries seriesRemote = new ColumnSeries(); series.Name = "Local Imaging"; seriesRemote.Name = "Remote Imaging"; series.GroupName = "Total"; seriesRemote.GroupName = "Total"; foreach (var group in groups) { CategorySeriesItem seriesItem = new CategorySeriesItem((decimal?)(group.Count - group.RemoteCount)); series.SeriesItems.Add(seriesItem); CategorySeriesItem seriesRemoteItem = new CategorySeriesItem((decimal?)(group.RemoteCount)); seriesRemote.SeriesItems.Add(seriesRemoteItem); RadHtmlChart1.PlotArea.XAxis.Items.Add(new AxisItem { LabelText = group.Date.ToShortDateString() }); } series.LabelsAppearance.Visible = false; seriesRemote.LabelsAppearance.Visible = false; RadHtmlChart1.PlotArea.Series.Add(series); RadHtmlChart1.PlotArea.Series.Add(seriesRemote); RadHtmlChart1.PlotArea.XAxis.BaseUnit = Telerik.Web.UI.HtmlChart.DateTimeBaseUnit.Months; RadHtmlChart1.PlotArea.XAxis.Type = Telerik.Web.UI.HtmlChart.AxisType.Date; return RadHtmlChart1;}