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
namespace Sparkline.Helpers | |
{ | |
public static class ChartHelper | |
{ | |
public static String DrawSparkline(this HtmlHelper helper, String display, List<Int32?> plotData) | |
{ | |
int? max = plotData.Max(); | |
int? min = plotData.Min(); | |
string list = String.Join(",", plotData); | |
String spark = "<img src=\"http://chart.apis.google.com/chart?cht=lc&chf=bg,s,F5F5F5&cgh=0,50,1,0&chds={0},{1}&chs={2}&chd=t:{3}&chco=999999&chls=1,1,0&chm=o,990000,0,20,4&chxt=r,x,y&chxs=0,990000,11,0,_|1,990000,1,0,_|2,990000,1,0,_&chxl=0:|{4}|1:||2:||\">"; |
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
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> | |
<%@ Import Namespace="Sparkline.Helpers" %> | |
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> | |
Spark Line Example | |
</asp:Content> | |
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> | |
<h2>Hello Sparkline</h2> | |
<p> |
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
declare @MaxTagFrequency int | |
declare @tt_Tags table( | |
BlogCategory_ID int, | |
[Count] int | |
) | |
insert into | |
@tt_Tags | |
select top(@CountLimit) | |
bc.BlogCategory_ID, |
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
var categories = from c in data.GraphicCategories | |
join g in data.Graphics on c.GraphicCategory_ID equals g.GraphicCategory_ID | |
group c by c.LongDescription into categoryGroup | |
select new | |
{ | |
Category = categoryGroup.Key, | |
CategoryFrequency = categoryGroup.Count() | |
}; | |
Int32 maxCategoryFrequency = (from c in categories select c.CategoryFrequency).Max(); |
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
<script type="text/javascript" src="/Content/swfobject.js"></script> | |
<script type="text/javascript"> | |
var divRecentTags = document.getElementById("recent-tags"); | |
if (divRecentTags) { | |
var cloud = new SWFObject("/Content/tagcloud.swf", "tagcloudflash", "275", "200", "9", "#ffffff"); | |
cloud.addParam("allowScriptAccess", "always"); | |
cloud.addVariable("tcolor", "0x6290B8"); | |
cloud.addVariable("tcolor2", "0x000000"); | |
cloud.addVariable("hicolor", "0xFE5655"); | |
cloud.addVariable("tspeed", "100"); |
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
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> | |
<div id="recent-tags"> | |
<% foreach (var t in (IEnumerable<Models.BlogCategory>)ViewData["TagCloud"]) | |
{%> | |
<a href="http://mysite/Blog/Listing/<%= Html.Encode(t.Category) %>" class="<%= BlogHelper.GetTagClass(t.BlogCategory_ID) %>" ><%= t.Category %></a> | |
<% }%> | |
</div> |
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
public static class BlogHelper | |
{ | |
public static string GetTagClass(int id) | |
{ | |
if (id % 2 == 0) | |
{ | |
return "post-tag pop1"; | |
} | |
else | |
{ |
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
// Repository | |
public IEnumerable<BlogCategory> FindAllBlogCategories() | |
{ | |
return db.BlogCategories.OrderBy(c => c.BlogCategory_ID); | |
} |
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
routes.MapRoute( | |
"BlogPost", | |
"Entries", | |
new { controller = "Blog", action = "BlogPost"} | |
); // outputs: mysite.com/Entries?id=0 | |
routes.MapRoute( | |
"BlogPost1", | |
"Entries/{id}", | |
new { controller = "Blog", action = "BlogPost" } |
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
Html.RouteLink(Html.Encode(!String.IsNullOrEmpty(item.Title) ? item.Title : "No Title..."), "BlogPost2", | |
new { | |
year = item.Published.Year, | |
month = item.Published.Month, | |
day = item.Published.Day, | |
title = Html.Encode(item.Title) | |
}) |
OlderNewer