This topic explains using a code example how to add the {LinearGaugeName}™ control to {PlatformName} applications.
This topic contains the following sections:
The following procedure demonstrates adding the {LinearGaugeName} to {PlatformName} applications.
To complete the procedure, you need the following:
-
A {PlatformName} project with a page
-
The required Jars added to the project (See RequirementsRequirements.)
Following is a conceptual overview of the process:
1. Adding the {LinearGaugeName} control to {PlatformName} applications
2. Verifying the results
Following are the general requirements for adding the {LinearGaugeName} control.
Requirement | Description |
---|---|
Jar References |
|
Namespace References |
import com.infragistics.controls.LinearGaugeView; import com.infragistics.controls.LinearGraphRange; |
The following procedure takes you through the steps necessary for adding the {LinearGaugeName} control to a page.
-
Start a new project and select the option "blank activity with fragment" when prompted.
-
Open the "MainActivityFragment" file and enter the following code snippet in the "onCreateView" method
-
In Java:
LinearGaugeView linearGauge = new LinearGaugeView(rootView.getContext());
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, getResources().getDisplayMetrics());
int width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 300, getResources().getDisplayMetrics());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height);
linearGauge.setMaximumValue(55);
linearGauge.setMinimumValue(5);
linearGauge.setValue(43);
LinearGraphRange range1 = new LinearGraphRange();
range1.setStartValue(0);
range1.setEndValue(15);
range1.setBrush(new SolidColorBrush(Color.RED));
LinearGraphRange range2 = new LinearGraphRange();
range2.setStartValue(15);
range2.setEndValue(30);
range2.setBrush(new SolidColorBrush(Color.YELLOW));
LinearGraphRange range3 = new LinearGraphRange();
range3.setStartValue(30);
range3.setEndValue(55);
range3.setBrush(new SolidColorBrush(Color.GREEN));
linearGauge.addRange(range1);
linearGauge.addRange(range2);
linearGauge.addRange(range3);
The following topics provide additional information related to this topic:
Topic | Purpose |
---|---|
This topic provides a conceptual overview of the {LinearGaugeName}™ control’s backing feature. It describes the properties of the backing area and provides an example of its implementation. |
|
This topic provides a conceptual overview of labels with the {LinearGaugeName}™ control. It describes the properties of the labels and also provides an example of how to configure the labels. |
|
This topic provides a conceptual overview of needles with the {LinearGaugeName}™ control. It describes the properties of the needles and also provides an example of how to configure them. |
|
This topic provides a conceptual overview of the {LinearGaugeName}™ control’s ranges. It describes the properties of the ranges and provides an example of how to add ranges to the radial gauge. |
|
This topic provides a conceptual overview of the {LinearGaugeName}™ control’s scale. It describes the properties of the scale and also provides an example of how to implement it. |
|
This topic provides a conceptual overview of tick marks with the {LinearGaugeName}™ control. It describes the tick marks’ properties and provides an example of how to implement them. |