Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Which attrs need to enable to get below chart #3

Open
therajanmaurya opened this issue Aug 17, 2018 · 6 comments
Open

Which attrs need to enable to get below chart #3

therajanmaurya opened this issue Aug 17, 2018 · 6 comments
Labels

Comments

@therajanmaurya
Copy link

therajanmaurya commented Aug 17, 2018

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.

@hadiidbouk
Copy link
Owner

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

@therajanmaurya
Copy link
Author

therajanmaurya commented Aug 18, 2018

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?

@hadiidbouk
Copy link
Owner

hadiidbouk commented Aug 18, 2018

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 👍

@therajanmaurya
Copy link
Author

therajanmaurya commented Aug 18, 2018

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

@hadiidbouk
Copy link
Owner

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

@therajanmaurya
Copy link
Author

@hadiidbouk I create a PR, let's talk there I did the exact same thing.
Checkout: #4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants