https://github.com/swapnil1104/lineargraphview
An Android custom view library to display color coded information in a graphical format
https://github.com/swapnil1104/lineargraphview
andr custom-vi graphics
Last synced: about 1 year ago
JSON representation
An Android custom view library to display color coded information in a graphical format
- Host: GitHub
- URL: https://github.com/swapnil1104/lineargraphview
- Owner: swapnil1104
- Created: 2019-10-26T09:03:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-15T07:01:56.000Z (about 6 years ago)
- Last Synced: 2025-04-29T23:58:45.152Z (about 1 year ago)
- Topics: andr, custom-vi, graphics
- Language: Java
- Homepage:
- Size: 170 KB
- Stars: 15
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LinearGraphView
[](https://jitpack.io/#swapnil1104/LinearGraphView)
[](https://jitpack.io/#swapnil1104/LinearGraphView)
A custom view to display information in a Linear Graph with smooth animations!


## How to integrate the library in your app?
Step 1: Add it in your root build.gradle at the end of repositories:
```
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
```
Step 2. Add the dependency
```
dependencies {
implementation 'com.github.swapnil1104:LinearGraphView:{current_lib_ver}'
}
```
Step 3. Add OtpEditText to your layout file
```
```
Step 4. Refer this View in your activity file, create a List and populate it with your values, use this list and invoke `setData(List dataModel, int range)`.
The second param is the entire span graph view, and `value` param in each DataModel object will occupy a percent length.
Width of each item is calculated by `model.value / range * viewWidth`.
```
LinearGraphView lgv = findViewById(R.id.linear_graph_view);
List dataList = new ArrayList<>();
dataList.add(new DataModel("One", "#00ffff", 100));
dataList.add(new DataModel("Two", "#74EEA1", 250));
dataList.add(new DataModel("Three", "#f2002f", 100));
dataList.add(new DataModel("four", "#B61CB3", 180));
lgv.setData(dataList, 1000);
```
The above code will result in this:

## How to customize the view.
### Setting custom border color
To use a custom color for the border of LinearGraphView, use
```app:lgv_border_color="@color/colorAccent"```
### Setting border animation duration
To change the animation duration of the initial border transition, use
```app:lgv_border_anim_duration="{TIME_IN_MS}"```