Giter Club home page Giter Club logo

chartprogressbar-android's Introduction

ChartProgressBar

Draw a chart with progress bar style - the ios version here

Installation

Add jitpack to your build.gradle (project) :

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Add the dependency to your build.gradle (app) :

 compile 'com.github.hadiidbouk:ChartProgressBar-Android:2.0.6'

Usage

  1. Add ChartProgressBar to your layout :
<com.hadiidbouk.charts.ChartProgressBar
		android:id="@+id/ChartProgressBar"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:layout_centerInParent="true"
		android:gravity="center"
		app:hdBarCanBeClick="true"
		app:hdBarHeight="170dp"
		app:hdBarWidth="7dp"
		app:hdBarRadius="10dp"
		app:hdMaxValue="10"
		app:hdEmptyColor="@color/empty"
		app:hdProgressColor="@color/progress"
		app:hdProgressClickColor="@color/progress_click"
		app:hdPinBackgroundColor="@color/pin_background"
		app:hdPinTextColor="@color/pin_text"
		app:hdPinPaddingBottom="5dp"
		app:hdBarTitleColor="@color/bar_title_color"
		app:hdBarTitleTxtSize="12sp"
		app:hdPinTxtSize="17sp"
		app:hdPinMarginTop="10dp"
		app:hdPinMarginBottom="55dp"
		app:hdPinMarginEnd="22dp"
		app:hdBarTitleMarginTop="9dp"
		app:hdPinDrawable="@drawable/ic_pin"
		app:hdProgressDisableColor="@color/progress_disable"
		app:hdBarTitleSelectedColor="@color/bar_title_selected_color"/>
  1. Add your Data to the chart :
		ArrayList<BarData> dataList = new ArrayList<>();

		BarData data = new BarData("Sep", 3.4f, "3.4€");
		dataList.add(data);

		data = new BarData("Oct", 8f, "8€");
		dataList.add(data);

		data = new BarData("Nov", 1.8f, "1.8€");
		dataList.add(data);

		data = new BarData("Dec", 7.3f, "7.3€");
		dataList.add(data);

		data = new BarData("Jan", 6.2f, "6.2€");
		dataList.add(data);

		data = new BarData("Feb", 3.3f, "3.3€");
		dataList.add(data);

		mChart = (ChartProgressBar) findViewById(R.id.ChartProgressBar);

		mChart.setDataList(dataList);
		mChart.build();

Useful methods

  1. mChart.removeBarValues() : Remove values of all progress bars in the chart.

  2. mChart.resetBarValues() : Set values to the chart ( it may used after removeBarValues()) .

  3. mChart.removeClickedBar() : Unselect the clicked bar.

  4. isBarsEmpty() : Check if bars values are empty.

  5. setMaxValue(float maxValue) : Setting bars max value programmatically .

  6. enableBar(int index) : Enable a bar

  7. disableBar(int index) : Disable a bar

  8. setOnBarClickedListener(OnBarClickedListener listener) : listening for click bar event

  9. selectBar(int index) : to select a bar like a click

  10. deselectBar(int index) : to deselect a bar

chartprogressbar-android's People

Contributors

hadiidbouk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chartprogressbar-android's Issues

Animation

Can we have animation with this..???

gap is shown but without any element

while testing with simple data and default xml settings I don't get same chart build as in the demo preview.
attaching the screenshot from uiautomator. As you can see some element's bounds are shown in top left but it is not clickable not is visible in right bar of visible elements

ChartProgressBar-issue

Resources$NotFoundException: Resource ID #0x0

Getting this error:
Process: com.spesa.app, PID: 12699 android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:259) at android.content.res.Resources.getDrawableForDensity(Resources.java:920) at android.content.res.Resources.getDrawable(Resources.java:860) at android.content.res.Resources.getDrawable(Resources.java:835) at com.hadiidbouk.charts.ChartProgressBar.build(ChartProgressBar.java:131)

at line:

mChart.build()

I have added ic_pin.xml in the drawables folder

Which attrs need to enable to get below chart

image.

Is it possible to set max height of chart? Like In my case max height of the chart is different and as selected chart is different too. Is it possible to set different different chart heights.

Hide Tooltips(pins)

Hi, Could you help me! How would one go about hiding the pins while using setOnBarClickedListener. Thanks!

how to set RTL direction in hdprogressbar??

i can't fix that issue because the arabic language layout direction is doesn't works properly. the default rtl root was changed automatically only in hdTittlebar when i change the language but not change the direction in hdProgressBar.please help me to fix these issue.
Thanks in advance

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.