ChartProgressBar-Android icon indicating copy to clipboard operation
ChartProgressBar-Android copied to clipboard

Which attrs need to enable to get below chart

Open therajanmaurya opened this issue 7 years ago • 6 comments

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.

therajanmaurya avatar Aug 17 '18 14:08 therajanmaurya

Hello,

Thank you for using this library,

You can see from the code below that app:hdEmptyColor="@color/empty" has an empty color which it's nothing more than the transparent android color @android:color/transparent, you can change this empty color and you will get something like the image above.

Also don't forget to specify the max number.

<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"/>

hadiidbouk avatar Aug 18 '18 03:08 hadiidbouk

Hi, @hadiidbouk thanks for quick reply. as I can see when I set max value app:hdMaxValue="10". It sets for all the chart bars. Is it possible that I can set the max value for every chart bar separately?

therajanmaurya avatar Aug 18 '18 05:08 therajanmaurya

You are welcome, Unfortunately this feature isn't available, you can add maxValue to the BarData and then in the build() function you can use this value, I will be appreciated if you send me a PR 👍

hadiidbouk avatar Aug 18 '18 10:08 hadiidbouk

BarData.class

public class BarData {
private String barTitle;
private float barValue;
private String pinText;
private float maxValue = 0.0f;
...
}

Updated mMaxValue in build

addView(linearLayout);
		int i = 0;
		for (BarData data : mDataList) {
			int barValue = (int) (data.getBarValue() * 100);
			mMaxValue = data.getMaxValue();
			FrameLayout bar = getBar(data.getBarTitle(), barValue, i);
			linearLayout.addView(bar);
			i++;
		}
BarData data = new BarData("Sep", 3.4f, "3.4€", 10f);
		dataList.add(data);

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

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

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

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

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

But still there is not change in the max value in the bars.

Is anything else I need to change.

image

therajanmaurya avatar Aug 18 '18 12:08 therajanmaurya

As I said you need to change the build() function inside the ChartProgressBar class.

hadiidbouk avatar Aug 18 '18 13:08 hadiidbouk

@hadiidbouk I create a PR, let's talk there I did the exact same thing. Checkout: https://github.com/hadiidbouk/ChartProgressBar-Android/pull/4

therajanmaurya avatar Aug 22 '18 11:08 therajanmaurya