I am trying to add dates to my x-axis, but only generic dates are being returned. Am I missing something?
Here is my dataset:
CountryName LastUpdate Sites Running Total
United States 2009-02-02 00:00:00.000 4 4
United States 2009-02-19 00:00:00.000 1 5
More Details
1. The SQL returns the LastUpdate value as the datetime datatype.
2. AutoScale and IsZeroBased values for the X-Axis are set to false
3. My code is included below.
SQL:
Here is my dataset:
CountryName LastUpdate Sites Running Total
United States 2009-02-02 00:00:00.000 4 4
United States 2009-02-19 00:00:00.000 1 5
More Details
1. The SQL returns the LastUpdate value as the datetime datatype.
2. AutoScale and IsZeroBased values for the X-Axis are set to false
3. My code is included below.
<telerik:RadChart ID="RadChart1" runat="server" AutoLayout="True" DataGroupColumn="CountryName" |
DataSourceID="SqlDataSource1" DefaultType="Line" Height="400px"> |
<Series> |
<telerik:ChartSeries DataYColumn="RunningTotal" Name="United States" Type="Line"> |
<Appearance> |
<FillStyle MainColor="213, 247, 255"> |
</FillStyle> |
</Appearance> |
</telerik:ChartSeries> |
</Series> |
<PlotArea> |
<XAxis AutoScale="False" DataLabelsColumn="LastUpdate" IsZeroBased="False" MaxValue="2" |
MinValue="1" Step="1"> |
<Appearance ValueFormat="ShortDate"> |
<LabelAppearance Position-AlignedPosition="Top" RotationAngle="45"> |
</LabelAppearance> |
</Appearance> |
<AxisLabel Visible="True"> |
<Appearance Visible="True"> |
</Appearance> |
<TextBlock Text="Timeline"> |
</TextBlock> |
</AxisLabel> |
<Items> |
<telerik:ChartAxisItem Value="1"> |
</telerik:ChartAxisItem> |
<telerik:ChartAxisItem Value="2"> |
</telerik:ChartAxisItem> |
</Items> |
</XAxis> |
<YAxis> |
<AxisLabel Visible="True"> |
<Appearance Visible="True"> |
</Appearance> |
<TextBlock Text="Number of Sites"> |
</TextBlock> |
</AxisLabel> |
</YAxis> |
</PlotArea> |
<ChartTitle> |
<TextBlock Text="Site Completion Summary"> |
</TextBlock> |
</ChartTitle> |
</telerik:RadChart> |
Select a.CountryName, Convert(datetime, a.LastUpdate, 101) as LastUpdate, |
a.Sites, |
SUM(b.Sites) AS RunningTotal |
From |
( |
Select DATEADD(dd, 0, DATEDIFF(dd, 0, atss.LastUpdate)) as LastUpdate, c.CountryName, |
Max(DATEADD(dd, 0, DATEDIFF(dd, 0, atss.LastUpdate))) as LastUpdateMax, |
Count(ts.TrackedSiteID) as Sites |
From SLLS_TrackedSite ts |
Left Outer Join SLLS_AuditTrackSiteStatus atss On atss.TrackedSiteID = ts.TrackedSiteID |
Left Outer Join SLLS_Country c On c.CountryID = ts.CountryID |
Where ts.SiteStatusID = 1 And |
atss.SiteStatusID = 1 And |
ts.CountryID = 1 |
Group By DATEADD(dd, 0, DATEDIFF(dd, 0, atss.LastUpdate)), c.CountryName |
) a |
Cross Join |
( |
Select DATEADD(dd, 0, DATEDIFF(dd, 0, atss.LastUpdate)) as LastUpdate, c.CountryName, |
Max(DATEADD(dd, 0, DATEDIFF(dd, 0, atss.LastUpdate))) as LastUpdateMax, |
Count(ts.TrackedSiteID) as Sites |
From SLLS_TrackedSite ts |
Left Outer Join SLLS_AuditTrackSiteStatus atss On atss.TrackedSiteID = ts.TrackedSiteID |
Left Outer Join SLLS_Country c On c.CountryID = ts.CountryID |
Where ts.SiteStatusID = 1 And |
atss.SiteStatusID = 1 And |
ts.CountryID = 1 |
Group By DATEADD(dd, 0, DATEDIFF(dd, 0, atss.LastUpdate)), c.CountryName |
) b |
WHERE (b.LastUpdate <= a.LastUpdate) |
GROUP BY a.CountryName,a.LastUpdate,a.Sites |
ORDER BY a.CountryName,a.LastUpdate,a.Sites |