Android Library that shows simple percent chart and time chart.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
compile 'com.github.EunsilJo:TimePercentChart:1.0'
}
percentChart.setDrawValueColor(R.color.white);
You can change the text color of chart value. (default black)
percentChart.setUnit(PercentChartView.TIME_UNIT);
You can change the unit of chart value.
percentChart.setDrawValue(PercentChartView.DrawValue.PERCENT);
You can change the text of chart value. (default NONE)
percentChart.setPercentChart(mSamples);
- ArrayList percents : items of percent chart
public void setLabelCount(int count)
You can change the count of X label. (default 5)
public void showX(boolean show)
public void showLegend(boolean show)
public void showPercentUnit(boolean show)
You can show/hidden X, legend and percent unit.
new PercentChartData(R.color.color_chart_1, new LegendData("Korean"), 28800000)
- @ColorRes int colorRes : the background color of item
- LegendData legend : the legend of item
- float value : the value of item
public class LegendData {
private String legend;
private String value;
private String subValue;
private boolean showValue = true;
private boolean showSubValue = true;
...
}
- String legend : the title of legend
- String value : the value of legend
- String subValue : the subValue of legend
timeChart.setStartHour(6);
You can change start time. (default 0)
timeChart.setTimeChart(getMillis("2017-11-10 00:00:00"), mSamples);
- long date : the reference date
- ArrayList charts : items of time chart
public void setLabelCount(int count)
You can change the count of X label. (default 5)
public void showLegend(boolean show)
You can show/hidden legend.
new TimeData(getMillis("2017-11-10 06:00:00"), getMillis("2017-11-10 06:00:22"))
- long startMills : the start time of item
- long stopMills : the end time of item
new TimeChartData(R.color.color_chart_1, new LegendData("Plan"), values)
- @ColorRes int colorRes : the background color of item
- LegendData legend : the legend of item
- ArrayList values : items of time
Please check the demo app to see examples.