This sample demonstrates how to specify linear gauge bar markers.
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.jqGauges.css" /> <script src="<%: Url.Content("~/Scripts/jquery-1.11.1.min.js") %>" type="text/javascript"></script> <script src="<%: Url.Content("~/Scripts/jquery.jqGauges.min.js") %>" type="text/javascript"></script> <body> <div> <%=Html.JQLinearGauge().LinearGauge() .ID("jqLinearGauge") .Orientation(GaugeOrientation.Vertical) .Background("#F7F7F7") .Width(110) .Height(400) .Border(border => { border.LineWidth(4) .StrokeStyle("#76786A") .Padding(8); }) .Shadows(true) .Tooltips(tooltips => { tooltips.Disabled(false).Highlighting(true); }) .Animation(new TimeSpan(0,0,1)) .Scales(scales => { scales.LinearScale() .Minimum(0) .Maximum(100) .Interval(10) .Labels(labels => { labels.Offset(0.03); }) .MajorTickMarks(majorTickMarks => { majorTickMarks.Offset(0.20) .LineWidth(2); }) .MinorTickMarks(minorTickMarks => { minorTickMarks.Offset(0.24) .Visible(true) .LineWidth(2) .Interval(2); }) .BarMarkers(barMarkers => { barMarkers.LinearBarMarker() .Value(80) .InnerOffset(0.4) .OuterOffset(0.56) .FillStyle(gradient => { gradient.LinearGradient(0, 0.5, 1, 0.5) .ColorStops(colorStops => { colorStops.Add(0, "#C5F80B"); colorStops.Add(1, "#6B8901"); }); }); barMarkers.LinearBarMarker() .Value(70) .InnerOffset(0.6) .OuterOffset(0.76) .FillStyle(gradient => { gradient.LinearGradient(0, 0.5, 1, 0.5) .ColorStops(colorStops => { colorStops.Add(0, "#FF3366"); colorStops.Add(1, "#B2183E"); }); }); barMarkers.LinearBarMarker() .Value(90) .InnerOffset(0.8) .OuterOffset(0.96) .FillStyle(gradient => { gradient.LinearGradient(0, 0.5, 1, 0.5) .ColorStops(colorStops => { colorStops.Add(0, "#339CFF"); colorStops.Add(1, "#1F66A8"); }); }); }); }) .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.jqGauges.css" /> <script src="@Url.Content("~/Scripts/jquery-1.11.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.jqGauges.min.js")" type="text/javascript"></script> <body> <div> @(Html.JQLinearGauge().LinearGauge() .ID("jqLinearGauge") .Orientation(GaugeOrientation.Vertical) .Background("#F7F7F7") .Width(110) .Height(400) .Border(border => { border.LineWidth(4) .StrokeStyle("#76786A") .Padding(8); }) .Shadows(true) .Tooltips(tooltips => { tooltips.Disabled(false).Highlighting(true); }) .Animation(new TimeSpan(0,0,1)) .Scales(scales => { scales.LinearScale() .Minimum(0) .Maximum(100) .Interval(10) .Labels(labels => { labels.Offset(0.03); }) .MajorTickMarks(majorTickMarks => { majorTickMarks.Offset(0.20) .LineWidth(2); }) .MinorTickMarks(minorTickMarks => { minorTickMarks.Offset(0.24) .Visible(true) .LineWidth(2) .Interval(2); }) .BarMarkers(barMarkers => { barMarkers.LinearBarMarker() .Value(80) .InnerOffset(0.4) .OuterOffset(0.56) .FillStyle(gradient => { gradient.LinearGradient(0, 0.5, 1, 0.5) .ColorStops(colorStops => { colorStops.Add(0, "#C5F80B"); colorStops.Add(1, "#6B8901"); }); }); barMarkers.LinearBarMarker() .Value(70) .InnerOffset(0.6) .OuterOffset(0.76) .FillStyle(gradient => { gradient.LinearGradient(0, 0.5, 1, 0.5) .ColorStops(colorStops => { colorStops.Add(0, "#FF3366"); colorStops.Add(1, "#B2183E"); }); }); barMarkers.LinearBarMarker() .Value(90) .InnerOffset(0.8) .OuterOffset(0.96) .FillStyle(gradient => { gradient.LinearGradient(0, 0.5, 1, 0.5) .ColorStops(colorStops => { colorStops.Add(0, "#339CFF"); colorStops.Add(1, "#1F66A8"); }); }); }); }) .Render() ) </div> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using SamplesBrowser.Models; namespace GaugesSamplesBrowser.Controllers { public class GaugeController : Controller { public ActionResult BarMarkers() { return View(); } } } |