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 chart crosshairs.
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("Crosshairs") .Border(border => border.StrokeStyle("#6ba851")) .Background(background => background.LinearGradient(0, 0, 0, 1).ColorStops(stop => { stop.Add(0, "#d2e6c9"); stop.Add(1, "white"); })) .Legend(false) .Tooltips(tooltips => tooltips.TooltipsType(TooltipsType.Shared)) .Crosshairs(el => el.Enabled(true).VerticalLine(line => line.StrokeStyle("#cc0a0c")).HorizontalLine(false)) .Animation(TimeSpan.FromSeconds(1)) .Series(series => { series.Line().Title("Series 1") .XValues(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }) .YValues(new double[] { 62, 70, 68, 58, 52, 60, 48, 52, 54, 47, 49 }); series.Line().Title("Series 2") .XValues(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }) .YValues(new double[] { 56, 30, 62, 65, 40, 36, 70, 68, 60, 65, 68 }); } ) .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("Crosshairs") .Border(border => border.StrokeStyle("#6ba851")) .Background(background => background.LinearGradient(0, 0, 0, 1).ColorStops(stop => { stop.Add(0, "#d2e6c9"); stop.Add(1, "white"); })) .Legend(false) .Tooltips(tooltips => tooltips.TooltipsType(TooltipsType.Shared)) .Crosshairs(el => el.Enabled(true).VerticalLine(line => line.StrokeStyle("#cc0a0c")).HorizontalLine(false)) .Animation(TimeSpan.FromSeconds(1)) .Series(series => { series.Line().Title("Series 1") .XValues(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }) .YValues(new double[] { 62, 70, 68, 58, 52, 60, 48, 52, 54, 47, 49 }); series.Line().Title("Series 2") .XValues(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }) .YValues(new double[] { 56, 30, 62, 65, 40, 36, 70, 68, 60, 65, 68 }); } ) .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 Crosshairs() { return View(); } } } |