-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Chart on homepage to show stats of package downloads/hour.
- Loading branch information
pranavkm
committed
Mar 9, 2011
1 parent
591c0a1
commit 9065099
Showing
2 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
<Chart BackColor="#D3DFF0" BackGradientStyle="TopBottom" BackSecondaryColor="White" BorderColor="26, 59, 105" BorderlineDashStyle="Solid" BorderWidth="2" Palette="BrightPastel"> | ||
<ChartAreas> | ||
<ChartArea Name="Default" _Template_="All" BackColor="64, 165, 191, 228" BackGradientStyle="TopBottom" BackSecondaryColor="White" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" ShadowColor="Transparent"> | ||
<AxisY> | ||
<LabelStyle Format="{0:0,0}" /> | ||
<MajorGrid Enabled="True" LineDashStyle="Dash" /> | ||
<MinorGrid Enabled="False" /> | ||
</AxisY> | ||
<AxisX LineColor="64, 64, 64, 64"> | ||
<MajorGrid Enabled="False" /> | ||
<MinorGrid Enabled="False" /> | ||
</AxisX> | ||
</ChartArea> | ||
</ChartAreas> | ||
<Legends> | ||
<Legend _Template_="All" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold" IsTextAutoFit="False" /> | ||
</Legends> | ||
|
||
<ChartAreas> | ||
<ChartArea Name="Default" _Template_="All" BackColor="64, 165, 191, 228" BackGradientStyle="TopBottom" BackSecondaryColor="White" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" ShadowColor="Transparent"> | ||
<AxisY> | ||
<LabelStyle Format="{0:0,0}" /> | ||
<MajorGrid Enabled="True" LineDashStyle="Dash" /> | ||
<MinorGrid Enabled="False" /> | ||
</AxisY> | ||
<AxisX LineColor="64, 64, 64, 64"> | ||
<LabelStyle Format="{0:ddd d, HH:mm}" /> | ||
<MajorGrid Enabled="False" /> | ||
<MinorGrid Enabled="False" /> | ||
</AxisX> | ||
</ChartArea> | ||
</ChartAreas> | ||
<Legends> | ||
<Legend _Template_="All" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold" IsTextAutoFit="False" /> | ||
</Legends> | ||
|
||
</Chart> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
@{ | ||
var stats = NuGetStatistics.GetStatsHistory(1000); | ||
var stats = NuGetStatistics.GetStatsHistory(100); | ||
var statDiffs = new List<object>(); | ||
dynamic previous = stats.Last(); | ||
foreach (var current in stats.Reverse().Skip(1)) { | ||
statDiffs.Add(new { Downloads = current.Downloads - previous.Downloads, LogTime = (DateTime)current.LogTime }); | ||
previous = current; | ||
} | ||
|
||
var chart = new Chart(600, 300, themePath: "ChartTemplate.xml") | ||
.AddSeries(chartType: "Line", xValue: stats, xField: "LogTime", yValues: stats, yFields: "Downloads") | ||
.AddSeries(chartType: "Spline", xValue: statDiffs, xField: "LogTime", yValues: statDiffs, yFields: "Downloads") | ||
.AddTitle("Downloads") | ||
.SetYAxis(min: 130000) | ||
.Write(format: "png"); | ||
} |