Created
April 23, 2010 20:24
-
-
Save carlhoerberg/377126 to your computer and use it in GitHub Desktop.
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<System.Web.UI.DataVisualization.Charting.Chart>" %> | |
<% | |
Model.Page = this.Page; | |
var writer = new HtmlTextWriter(Page.Response.Output); | |
Model.RenderControl(writer); | |
%> |
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 class ChartController: Controller | |
{ | |
public ActionResult MyChart() | |
{ | |
var chart = new Chart(); | |
// Configure chart | |
return View(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
protected void Application_Start() | |
{ | |
// It's importat that this ignore of any url ending with ChartImg.axd is inserted before any Area route registrations. | |
// If you won't use Charts in any Area you can put it in your RegisterRoutes() method. | |
RouteTable.Routes.Ignore("{*pathInfo}", new { pathInfo = @"^.*(ChartImg.axd)$" }); | |
AreaRegistration.RegisterAllAreas(); | |
RegisterRoutes(RouteTable.Routes); | |
// The rest.. | |
} |
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.RenderPartial("Chart", Model); %> |
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
<?xml version="1.0"?> | |
<configuration> | |
<!-- Your stuff --> | |
<appSettings> | |
<add key="ChartImageHandler" value="storage=file;timeout=20;" /> | |
</appSettings> | |
<!-- Your stuff --> | |
<system.web> | |
<compilation debug="true" targetFramework="4.0"> | |
<assemblies> | |
<!-- Other assemblies --> | |
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> | |
</assemblies> | |
</compilation> | |
<!-- Your stuff --> | |
<httpHandlers> | |
<!-- Other handlers --> | |
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> | |
</httpHandlers> | |
</system.web> | |
<!-- Your stuff --> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment