Skip to content

Latest commit

 

History

History
174 lines (117 loc) · 5.37 KB

android-adding-linear-gauge.adoc

File metadata and controls

174 lines (117 loc) · 5.37 KB

Adding {LinearGaugeName}

Topic Overview

Purpose

This topic explains using a code example how to add the {LinearGaugeName}™ control to {PlatformName} applications.

Adding {LinearGaugeName} to the {PlatformName} application

Introduction

The following procedure demonstrates adding the {LinearGaugeName} to {PlatformName} applications.

Preview

The following is a screenshot of the {LinearGaugeName} .

XamLinearGauge Adding 1

Prerequisites

To complete the procedure, you need the following:

  • A {PlatformName} project with a page

  • The required Jars added to the project (See RequirementsRequirements.)

Overview

Following is a conceptual overview of the process:

1. Adding the {LinearGaugeName} control to {PlatformName} applications

2. Verifying the results

Requirements

Following are the general requirements for adding the {LinearGaugeName} control.

Requirement Description

Jar References

  • Infragistics.Gauges.jar

  • Infragistics.UI.jar

  • Infragistics.DV.Shared.jar

Namespace References

import com.infragistics.controls.LinearGaugeView;

import com.infragistics.controls.LinearGraphRange;

Steps

The following procedure takes you through the steps necessary for adding the {LinearGaugeName} control to a page.

1. Add the {LinearGaugeName} control to the page.

  1. Start a new project and select the option "blank activity with fragment" when prompted.

  2. Open the "MainActivityFragment" file and enter the following code snippet in the "onCreateView" method

  3. 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);

2. Verify the results.

Build and run your project with either an emulator or a connected device. If you built it properly it will look like the screenshot at the top of the page.

Related Content

Topics

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.