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 how to specify the empty data point style.
For detailed implementation, please take a look at the Aspx, Razor and Controller code tabs. <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> <%@ 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() .ID("jqChart") .Width(500) .Height(300) .Title("Empty Data Points") .Animation(TimeSpan.FromSeconds(1)) .Series(series => { series.Column() .XValues(new DateTime?[] { new DateTime(2010, 1, 1), new DateTime(2010, 1, 2), null, new DateTime(2010, 1, 4), null, new DateTime(2010, 1, 6), new DateTime(2010, 1, 7) }) .YValues(new double?[] { 36, 30, null, 25, null, 16, 30 }) .Markers(el => el.FillStyle(System.Drawing.Color.Black) .Size(12)) .NullHandling(NullHandling.EmptyPoint) .EmptyPointStyle(el => el.Marker(marker => marker.MarkerType(MarkerType.Cross) .FillStyle(System.Drawing.Color.Red) .StrokeStyle(System.Drawing.Color.Red) .LineWidth(4) .Size(10)) .FillStyle("#cccccc") .StrokeStyle("red") .LineWidth(2)); } ) .Render()%> </div> </body> </html> @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() .ID("jqChart") .Width(500) .Height(300) .Title("Empty Data Points") .Animation(TimeSpan.FromSeconds(1)) .Series(series => { series.Column() .XValues(new DateTime?[] { new DateTime(2010, 1, 1), new DateTime(2010, 1, 2), null, new DateTime(2010, 1, 4), null, new DateTime(2010, 1, 6), new DateTime(2010, 1, 7) }) .YValues(new double?[] { 36, 30, null, 25, null, 16, 30 }) .Markers(el => el.FillStyle(System.Drawing.Color.Black) .Size(12)) .NullHandling(NullHandling.EmptyPoint) .EmptyPointStyle(el => el.Marker(marker => marker.MarkerType(MarkerType.Cross) .FillStyle(System.Drawing.Color.Red) .StrokeStyle(System.Drawing.Color.Red) .LineWidth(4) .Size(10)) .FillStyle("#cccccc") .StrokeStyle("red") .LineWidth(2)); } ) .Render() ) </div> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace SamplesBrowser.Models { public class EmptyChartModel { } } 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 EmptyDataPoints() { return View(); } } } |