FlexChart
FlexChart
Funnel
This example shows how to create and customize a Funnel chart.
Features
Settings
Funnel Type: Default
Description
This example shows how to create and customize a Funnel chart.
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 | using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcExplorer.Models; namespace MvcExplorer.Controllers { public partial class FlexChartController { private List<SalesData> _salesData = SalesData.GetData(); public ActionResult Funnel() { var settings = new ClientSettingsModel { Settings = new Dictionary< string , object []> { { "FunnelType" , new object []{ "Default" , "Rectangle" }}, } }; settings.LoadRequestData(Request); ViewBag.DemoSettingsModel = settings; return View(_salesData); } } } |
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | @model IEnumerable< SalesData > @using C1.Web.Mvc.Chart @ { ViewBag.DemoSettings = true ; ClientSettingsModel demoSettingsModel = ViewBag.DemoSettingsModel; var funnelType = demoSettingsModel.GetEnum( "FunnelType" , FunnelType.Default); } @ (Html.C1().FlexChart().Id( "chart" ) .Bind( "CountryName" , "Sale" , Model) .ChartType(ChartType.Funnel) .DataLabel(label => { label.Content( "{y}" ); }) .Series(ser => { ser.Add().Name( "Sales" ); }) .Options(ext => { ext.Funnel(funnel => { funnel.Type(funnelType); funnel.NeckHeight(0.2f); }); }) .Width( "500px" ) .Height( "400px" ) ) @section Scripts{ <script type="text/javascript"> function updateMenu(menu, headerNamePrefix) { menu.header = headerNamePrefix + ': <b>' + menu.selectedItem.Header + '</b>' ; } function setFunnelOption(option, value) { var chart = wijmo.Control.getControl( '#chart' ); if (chart) { chart.options.funnel[option] = value; chart.refresh( true ); } } function customChangeFunnelType(chart, name) { setFunnelOption( 'type' , name.toLowerCase()); } function neckChanged(sender, args) { setFunnelOption(sender.hostElement.id, wijmo.clamp(sender.value, sender.min, sender.max)); } </script> } @section Settings{ < label style = "display: inline-block; font-weight: normal" > @Html .Raw(Resources.FlexChart.Funnel_NeckWidth)</ label > @ (Html.C1().InputNumber().Min(0).Max(1).Step(0.1).Value(0.2).Format( "n1" ) .OnClientValueChanged( "neckChanged" ).Width(150).Id( "neckWidth" )) < label style = "display: inline-block; font-weight: normal" > @Html .Raw(Resources.FlexChart.Funnel_NeckHeight)</ label > @ (Html.C1().InputNumber().Min(0).Max(1).Step(0.1).Value(0.2).Format( "n1" ) .OnClientValueChanged( "neckChanged" ).Width(150).Id( "neckHeight" )) } @section Description{ < p > @Html .Raw(Resources.FlexChart.Funnel_Text0)</ p > } |