use of com.github.mikephil.charting.components.YAxis in project Gadgetbridge by Freeyourgadget.
the class LiveActivityFragment method addEntries.
private void addEntries(int timestamp) {
mTotalStepsChart.setSingleEntryYValue(mSteps.getTotalSteps());
YAxis stepsPerMinuteCurrentYAxis = mStepsPerMinuteCurrentChart.getAxisLeft();
int maxStepsPerMinute = mSteps.getMaxStepsPerMinute();
// int extraRoom = maxStepsPerMinute/5;
// buggy in MPAndroidChart? Disable.
// stepsPerMinuteCurrentYAxis.setAxisMaxValue(Math.max(MIN_STEPS_PER_MINUTE, maxStepsPerMinute + extraRoom));
LimitLine target = new LimitLine(maxStepsPerMinute);
stepsPerMinuteCurrentYAxis.removeAllLimitLines();
stepsPerMinuteCurrentYAxis.addLimitLine(target);
int stepsPerMinute = mSteps.getStepsPerMinute(true);
mStepsPerMinuteCurrentChart.setSingleEntryYValue(stepsPerMinute);
if (!addHistoryDataSet(false)) {
return;
}
ChartData data = mStepsPerMinuteHistoryChart.getData();
if (stepsPerMinute < 0) {
stepsPerMinute = 0;
}
mHistorySet.addEntry(new Entry(timestamp, stepsPerMinute));
int hr = getCurrentHeartRate();
if (hr < 0) {
hr = 0;
}
mHeartRateSet.addEntry(new Entry(timestamp, hr));
}
use of com.github.mikephil.charting.components.YAxis in project Gadgetbridge by Freeyourgadget.
the class ActivitySleepChartFragment method setupChart.
private void setupChart() {
mChart.setBackgroundColor(BACKGROUND_COLOR);
mChart.getDescription().setTextColor(DESCRIPTION_COLOR);
configureBarLineChartDefaults(mChart);
XAxis x = mChart.getXAxis();
x.setDrawLabels(true);
x.setDrawGridLines(false);
x.setEnabled(true);
x.setTextColor(CHART_TEXT_COLOR);
x.setDrawLimitLinesBehindData(true);
YAxis y = mChart.getAxisLeft();
y.setDrawGridLines(false);
// y.setDrawLabels(false);
// TODO: make fixed max value optional
y.setAxisMaximum(1f);
y.setAxisMinimum(0);
y.setDrawTopYLabelEntry(false);
y.setTextColor(CHART_TEXT_COLOR);
// y.setLabelCount(5);
y.setEnabled(true);
YAxis yAxisRight = mChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setEnabled(supportsHeartrate(getChartsHost().getDevice()));
yAxisRight.setDrawLabels(true);
yAxisRight.setDrawTopYLabelEntry(true);
yAxisRight.setTextColor(CHART_TEXT_COLOR);
yAxisRight.setAxisMaximum(HeartRateUtils.MAX_HEART_RATE_VALUE);
yAxisRight.setAxisMinimum(HeartRateUtils.MIN_HEART_RATE_VALUE);
// refresh immediately instead of use refreshIfVisible(), for perceived performance
refresh();
}
use of com.github.mikephil.charting.components.YAxis in project Gadgetbridge by Freeyourgadget.
the class SleepChartFragment method setupActivityChart.
private void setupActivityChart() {
mActivityChart.setBackgroundColor(BACKGROUND_COLOR);
mActivityChart.getDescription().setTextColor(DESCRIPTION_COLOR);
configureBarLineChartDefaults(mActivityChart);
XAxis x = mActivityChart.getXAxis();
x.setDrawLabels(true);
x.setDrawGridLines(false);
x.setEnabled(true);
x.setTextColor(CHART_TEXT_COLOR);
x.setDrawLimitLinesBehindData(true);
YAxis y = mActivityChart.getAxisLeft();
y.setDrawGridLines(false);
// y.setDrawLabels(false);
// TODO: make fixed max value optional
y.setAxisMaximum(1f);
y.setAxisMinimum(0);
y.setDrawTopYLabelEntry(false);
y.setTextColor(CHART_TEXT_COLOR);
// y.setLabelCount(5);
y.setEnabled(true);
YAxis yAxisRight = mActivityChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setEnabled(supportsHeartrate(getChartsHost().getDevice()));
yAxisRight.setDrawLabels(true);
yAxisRight.setDrawTopYLabelEntry(true);
yAxisRight.setTextColor(CHART_TEXT_COLOR);
yAxisRight.setAxisMaxValue(HeartRateUtils.MAX_HEART_RATE_VALUE);
yAxisRight.setAxisMinValue(HeartRateUtils.MIN_HEART_RATE_VALUE);
}
use of com.github.mikephil.charting.components.YAxis in project AmazeFileManager by TeamAmaze.
the class ProcessViewerFragment method chartInit.
/**
* Initialize chart for the first time
* @param totalBytes maximum value for x-axis
*/
private void chartInit(long totalBytes) {
mLineChart.setBackgroundColor(accentColor);
mLineChart.getLegend().setEnabled(false);
// no description text
mLineChart.getDescription().setEnabled(false);
XAxis xAxis = mLineChart.getXAxis();
YAxis yAxisLeft = mLineChart.getAxisLeft();
mLineChart.getAxisRight().setEnabled(false);
yAxisLeft.setTextColor(Color.WHITE);
yAxisLeft.setAxisLineColor(Color.TRANSPARENT);
yAxisLeft.setTypeface(Typeface.DEFAULT_BOLD);
yAxisLeft.setGridColor(Utils.getColor(getContext(), R.color.white_translucent));
xAxis.setAxisMaximum(FileUtils.readableFileSizeFloat(totalBytes));
xAxis.setAxisMinimum(0.0f);
xAxis.setAxisLineColor(Color.TRANSPARENT);
xAxis.setGridColor(Color.TRANSPARENT);
xAxis.setTextColor(Color.WHITE);
xAxis.setTypeface(Typeface.DEFAULT_BOLD);
mLineChart.setData(mLineData);
mLineChart.invalidate();
}
use of com.github.mikephil.charting.components.YAxis in project android-client by GenesisVision.
the class ProfitChartView method initView.
private void initView() {
inflate(getContext(), R.layout.view_profit_chart, this);
ButterKnife.bind(this);
chart.getDescription().setEnabled(false);
chart.setDrawGridBackground(false);
chart.setDragEnabled(false);
chart.setTouchEnabled(false);
chart.getXAxis().setEnabled(false);
chart.getLegend().setEnabled(false);
chart.getAxisLeft().setEnabled(true);
chart.getAxisRight().setEnabled(false);
chart.setDrawBorders(false);
chart.setAutoScaleMinMaxEnabled(true);
chart.setNoDataText(getContext().getResources().getString(R.string.not_enough_data));
chart.setNoDataTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimaryDark));
YAxis yAxis = chart.getAxisLeft();
yAxis.setDrawLabels(false);
yAxis.setDrawAxisLine(false);
yAxis.setDrawGridLines(false);
LimitLine ll = new LimitLine(0f, "");
ll.setLineColor(ContextCompat.getColor(getContext(), R.color.grey400));
ll.setLineWidth(1f);
int lineLength = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getContext().getResources().getDisplayMetrics());
int spaceLength = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 7, getContext().getResources().getDisplayMetrics());
ll.enableDashedLine(lineLength, spaceLength, 0);
yAxis.setDrawLimitLinesBehindData(true);
yAxis.addLimitLine(ll);
chart.setHardwareAccelerationEnabled(false);
}
Aggregations