Chart DataPerformance !!!Bar and Column ChartsLine and Area ChartsPie and Funnel ChartsScatter and Bubble ChartsRadar and Polar ChartsFinancial ChartsGantt ChartsCombinational ChartsDynamic ChartsWorking with Chart AxesChart FeaturesCustomizing ChartClient-Side Events |
This sample demonstrates the Polar Spline Area chart type.
For detailed implementation, please take a look at the Aspx, Razor and Controller code tabs. <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<SamplesBrowser.Models.PolarChartData>>" %> <%@ Import Namespace="JQChart.Web.Mvc" %> <!DOCTYPE html> <html> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="~/Content/jquery.jqChart.css" /> <link rel="stylesheet" type="text/css" href="~/Content/themes/le-frog/jquery-ui-1.8.20.css" /> <script src="<%: Url.Content("~/Scripts/jquery-1.11.1.min.js") %>" type="text/javascript"></script> <script src="<%: Url.Content("~/Scripts/jquery.jqChart.min.js") %>" type="text/javascript"></script> <body> <div> <%= Html.JQChart() .Chart(Model) .ID("jqChart") .Width(500) .Height(300) .Title("Polar Spline Area Chart") .Border(border => border.StrokeStyle("#6ba851")) .Background(background => background.LinearGradient(0, 0, 0, 1).ColorStops(stop => { stop.Add(0, "#d2e6c9"); stop.Add(1, "white"); })) .Series(series => { series.PolarSplineArea() .XValues(el => el.ValueX1) .YValues(el => el.ValueY1) .FillStyle("rgba(65,140,240,0.75)"); series.PolarSplineArea() .XValues(el => el.ValueX2) .YValues(el => el.ValueY2) .FillStyle("rgba(252,180,65,0.75)"); } ) .Render()%> </div> </body> </html> @model IEnumerable<SamplesBrowser.Models.PolarChartData> @using JQChart.Web.Mvc <!DOCTYPE html> <html> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="~/Content/jquery.jqChart.css" /> <link rel="stylesheet" type="text/css" href="~/Content/themes/le-frog/jquery-ui-1.8.20.css" /> <script src="@Url.Content("~/Scripts/jquery-1.11.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.jqChart.min.js")" type="text/javascript"></script> <body> <div> @(Html.JQChart() .Chart(Model) .ID("jqChart") .Width(500) .Height(300) .Title("Polar Spline Area Chart") .Border(border => border.StrokeStyle("#6ba851")) .Background(background => background.LinearGradient(0, 0, 0, 1).ColorStops(stop => { stop.Add(0, "#d2e6c9"); stop.Add(1, "white"); })) .Series(series => { series.PolarSplineArea() .XValues(el => el.ValueX1) .YValues(el => el.ValueY1) .FillStyle("rgba(65,140,240,0.75)"); series.PolarSplineArea() .XValues(el => el.ValueX2) .YValues(el => el.ValueY2) .FillStyle("rgba(252,180,65,0.75)"); } ) .Render() ) </div> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace SamplesBrowser.Models { public class PolarChartData { public static List<PolarChartData> GetData() { var data = new List<PolarChartData>(); for (var angle = 0.0; angle <= 360.0; angle += 10.0) { var yValue = (1.0 + Math.Sin(angle / 180.0 * Math.PI)) * 10.0; yValue = Math.Round(yValue, 2); var x1 = angle + 90; var x2 = angle + 270; if (x1 > 360) { x1 -= 360; } if (x2 > 360) { x2 -= 360; } data.Add(new PolarChartData(x1, yValue, x2, yValue)); } return data; } public PolarChartData(double valueX1, double valueY1, double valueX2, double valueY2) { this.ValueX1 = valueX1; this.ValueX2 = valueX2; this.ValueY1 = valueY1; this.ValueY2 = valueY2; } public double ValueX1 { get; set; } public double ValueX2 { get; set; } public double ValueY1 { get; set; } public double ValueY2 { get; set; } } } using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using SamplesBrowser.Models; namespace SamplesBrowser.Controllers { public class ChartController : Controller { public ActionResult PolarSplineAreaChart() { return View(PolarChartData.GetData()); } } } |