ASP.NET MVC Controls > Controls > Gauge > Quick Start: Add and Configure > BulletGraph Quick Start |
This section describes how to add a BulletGraph control to your MVC webform and set its value. For information on how to add a control, See Adding controls.
This topic comprises of three steps:
The following image shows how the BulletGraph appears, after completing the steps above:
Create a new MVC application using the ComponentOne 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()
.Add a Model
Models are required to fetch data for the controls. See MVC Basics for more information.
Class1.cs
).Index.cshtml
to open it.Index.cshtml
file with the code given below to initialize a BulletGraph control and set the following properties:
Value
to 35. The Value
property denotes the gauge's current value.Max
properties to 0 and 100 respectively. The Min and Max
properties specify the range of the gauge. You can add multiple ranges to a single gauge.Target
, Good
and Bad
properties to 70, 60 and 40 respectively.isReadOnly
property to False. The isReadOnly specifies whether a user can edit the gauge's Value
using a keyboard or a mouse.Razor |
Copy Code
|
---|---|
@(Html.C1().BulletGraph() .Min(0).Max(100) .Good(60) .Bad(40) .Value(50) .Target(70) .IsReadOnly(false).Step(1).Width(500) .IsAnimated(true) ) |
HTML |
Copy Code
|
---|---|
<c1-bullet-graph min=0 max=100 good=60 bad=40 value=50 target=70 width="500px" is-read-only="false" step="1" is-animated="true"> </c1-bullet-graph> |
Append the folder name and view name to the generated URL (for example: http://localhost:1234/Default1/index) in the address bar of the browser to see the view. Or link the view to the home page. |