FlexChart
FlexChart
ErrorBar
ErrorBar helps you see margins of error and standard deviations at a glance.
Features
Settings
Direction: Both
Error Amount: FixedValue
Value: 50
End Style: Cap
Description
ErrorBar helps you see margins of error and standard deviations at a glance. They can be shown as a standard error amount, a percentage, or a standard deviation. You can also set your own values to display the exact error amounts you want.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcExplorer.Models; using C1.Web.Mvc.Chart; namespace MvcExplorer.Controllers { public partial class FlexChartController : Controller { List<PopulationByCountry> _populationByCountry = PopulationByCountry.GetData(); public ActionResult ErrorBar() { var width = new object [] { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 }; var boolValues = new object [] { false , true }; var settings = new ClientSettingsModel { Settings = new Dictionary< string , object []> { { "Direction" , Enum.GetValues( typeof (ErrorBarDirection)).Cast< object >().ToArray()}, { "ErrorAmount" , Enum.GetValues( typeof (ErrorAmount)).Cast< object >().ToArray()}, { "Value" , new object []{50, 100, 150, 200}}, { "EndStyle" , Enum.GetValues( typeof (ErrorBarEndStyle)).Cast< object >().ToArray()} } }; settings.LoadRequestData(Request); ViewBag.DemoSettingsModel = settings; return View(_populationByCountry); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | @model IEnumerable< PopulationByCountry > @section Scripts{ <script> function setProperty(control, property, value) { control.series.forEach( function (serie) { serie[property] = value; }); } function customChangeDirection(control, value) { setProperty(control, 'direction' , value); } function customChangeErrorAmount(control, value) { setProperty(control, 'errorAmount' , value); } function customChangeValue(control, value) { setProperty(control, 'value' , value); } function customChangeEndStyle(control, value) { setProperty(control, 'endStyle' , value); } </script> } @ { ViewBag.DemoSettings = true ; ClientSettingsModel demoSettingsModel = ViewBag.DemoSettingsModel; } @ (Html.C1().FlexChart() .Id(demoSettingsModel.ControlId) .Bind( "Country" , "Population" , Model) .Series(ser => { ser.AddErrorBar().Name( "Population" ).Value(50) .ErrorAmount(demoSettingsModel.GetEnum( "ErrorAmount" , C1.Web.Mvc.Chart.ErrorAmount.FixedValue)) .ErrorBarStyle(errorBarStyle => errorBarStyle.Fill( "#e6e6e6" ).Stroke( "#918254" ).StrokeWidth(2)); }) ) @section Description{ < p > @Html .Raw(Resources.FlexChart.ErrorBar_Text0)</ p > } |