Git Product home page Git Product logo

dashboardview's Introduction

DashboardView

Download

This is an Android dashboard View, like a mechanical dashboard such as a car. Support many custom styles.

Preview

image image

Using DashboardView in your application

ADT

No more support

Gradle โ€‹

Add dependencies in build.gradle of your module:

dependencies {
	compile 'com.ayst.dbv:dashboardview:1.5.1'
}

Usage

Simple Example

public class MainActivity extends AppCompatActivity {

    private DashboardView mDashboardView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mDashboardView = (DashboardView) findViewById(R.id.dashboardview_1);
        mDashboardView.setValue(50); // Set value
        mDashboardView.resetValue(50); // Set value and clear maximum and minimum
    }
}

XML Usage

If you decide to use DashboardView as a view, you can define it in your xml layouts like this:

<com.ayst.dashboardview.DashboardView
    android:id="@+id/dashboardview_1"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    app:dbv_firstColor="@color/red"
    app:dbv_secondColor="@color/yellow"
    app:dbv_thirdColor="@color/green"
    app:dbv_max="0"
    app:dbv_min="-100"
    app:dbv_section="10"
    app:dbv_portion="10"
    app:dbv_lineWidth="2dp"
    app:dbv_colorWidth="10dp"
    app:dbv_colorPadding="10dp"
    app:dbv_longScaleLength="15dp"
    app:dbv_shortScaleLength="10dp"
    app:dbv_startAngle="180"
    app:dbv_sweepAngle="180"
    app:dbv_value="-30"
    app:dbv_showValueText="false"
    app:dbv_showPointerRange="true"
    app:dbv_firstRange="30"
    app:dbv_secondRange="20"
    app:dbv_headerText="dbm"
    app:dbv_headerTextColor="@color/white"
    app:dbv_pointerColor="@color/white"
    app:dbv_minPointerColor="@color/white_30"
    app:dbv_maxPointerColor="@color/white_30"
    app:dbv_scaleColor="@color/white"
    app:dbv_scaleTextSize="12sp"
    />

NOTE:

  • dbv_firstColor - First range color
  • dbv_secondColor - Second range color
  • dbv_thirdColor - Third range color
  • dbv_max - Max value
  • dbv_min - Min value
  • dbv_section - Value range (mMax-mMin) equal parts
  • dbv_portion - One section equal parts
  • dbv_lineWidth - Line stroke width
  • dbv_colorWidth - Color progress stroke width
  • dbv_colorPadding - Color progress padding
  • dbv_longScaleLength - Length of long scale
  • dbv_shortScaleLength - Length of short scale
  • dbv_startAngle - Starting angle, 0 degrees at 3 o'clock
  • dbv_sweepAngle - Draw the angle, the difference from the start angle to the end
  • dbv_value - Value
  • dbv_showValueText - Whether to display value text
  • dbv_showPointerRange - Whether to display pointer range
  • dbv_firstRange - This is a percentage, starting with the minimum value, showing first color within this percentage
  • dbv_secondRange - This is a percentage, starting with the first range, showing second color within this percentage
  • dbv_headerText - The header text
  • dbv_headerTextColor - Header text color
  • dbv_pointerColor - Pointer color
  • dbv_minPointerColor - Min Pointer color
  • dbv_maxPointerColor - Max Pointer color
  • dbv_scaleColor - Scale color
  • dbv_scaleTextSize - Scale text size

Developed By

License

Copyright(c) 2018 Habo Shen <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

dashboardview's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.