The quick start guides you through the steps of adding a LinearGauge control to your MVC web application and set its value. For information on how to add a control, See Adding controls.
To accomplish this, follow these steps:
Create a new MVC application using the ComponentOne or VisualStudio templates. For more information about creating an MVC application, see Configuring your MVC Application topic.
Add a new Controller:
Default1Controller
).Add a View for the controller:
Default1Controller
) to open it.Index()
.Index.cshtml
to open it.Index.cshtml
file with the code given below to initialize a LinearGauge control and set the following properties:
Razor |
Copy Code
|
---|---|
@(Html.C1().LinearGauge()
.Width(500)
.Height(100)
.Value(35)
.Thickness(0.1)
.Min(0).Max(100)
.Direction(C1.Web.Mvc.GaugeDirection.Right)
// Create and Customize Ranges
.Ranges(items => items
.Add(item => item.Min(0).Max(40).Color(System.Drawing.Color.Red))
.Add(item => item.Min(40).Max(80).Color(System.Drawing.Color.Yellow))
.Add(item => item.Min(80).Max(100).Color(System.Drawing.Color.Green))
)
)
|