use of com.github.mikephil.charting.components.XAxis in project Weather by Sparker0i.
the class GraphsFragment method loadRainChart.
public void loadRainChart() {
rainChart.setDrawGridBackground(false);
rainChart.setBackgroundColor(Color.BLACK);
rainChart.setTouchEnabled(true);
rainChart.setDragEnabled(true);
rainChart.setMaxHighlightDistance(300);
rainChart.setPinchZoom(true);
rainChart.setPadding(2, 2, 2, 2);
rainChart.getLegend().setEnabled(true);
rainChart.getLegend().setTextColor(Color.WHITE);
YAxis yAxisRight = rainChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setDrawAxisLine(false);
yAxisRight.setDrawLabels(false);
yAxisRight.setTextColor(Color.WHITE);
yAxisRight.enableAxisLineDashedLine(2f, 4f, 2f);
YAxis yAxisLeft = rainChart.getAxisLeft();
yAxisLeft.setTextColor(Color.WHITE);
XAxis x = rainChart.getXAxis();
x.setEnabled(true);
x.setPosition(XAxis.XAxisPosition.BOTTOM);
x.setDrawGridLines(false);
x.setTextColor(Color.parseColor("#FFFFFF"));
x.setValueFormatter(new XFormatter(dates));
LineDataSet set;
if (rainChart.getData() != null) {
rainChart.getData().removeDataSet(rainChart.getData().getDataSetByIndex(rainChart.getData().getDataSetCount() - 1));
rainChart.getLegend().setTextColor(Color.parseColor("#FFFFFF"));
}
set = new LineDataSet(rainEntries, getString(R.string.g_rain));
set.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
set.setCubicIntensity(0.2f);
set.setDrawCircles(false);
set.setLineWidth(2f);
set.setDrawValues(false);
set.setValueTextSize(10f);
set.setColor(Color.GREEN);
set.setHighlightEnabled(false);
set.setValueFormatter(mValueFormatter);
LineData data = new LineData(set);
rainChart.setData(data);
rainChart.invalidate();
}
use of com.github.mikephil.charting.components.XAxis in project Weather by Sparker0i.
the class GraphsFragment method loadTemperatureChart.
public void loadTemperatureChart() {
temperatureChart.setDrawGridBackground(false);
temperatureChart.setBackgroundColor(Color.BLACK);
temperatureChart.setTouchEnabled(true);
temperatureChart.setDragEnabled(true);
temperatureChart.setMaxHighlightDistance(300);
temperatureChart.setPinchZoom(true);
temperatureChart.setPadding(2, 2, 2, 2);
temperatureChart.getLegend().setEnabled(true);
temperatureChart.getLegend().setTextColor(Color.WHITE);
YAxis yAxisRight = temperatureChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setDrawAxisLine(false);
yAxisRight.setDrawLabels(false);
yAxisRight.setTextColor(Color.WHITE);
yAxisRight.enableAxisLineDashedLine(2f, 4f, 2f);
YAxis yAxisLeft = temperatureChart.getAxisLeft();
yAxisLeft.setTextColor(Color.WHITE);
XAxis x = temperatureChart.getXAxis();
x.setEnabled(true);
x.setPosition(XAxis.XAxisPosition.BOTTOM);
x.setDrawGridLines(false);
x.setTextColor(Color.parseColor("#FFFFFF"));
x.setValueFormatter(new XFormatter(dates));
LineDataSet set;
if (temperatureChart.getData() != null) {
temperatureChart.getData().removeDataSet(temperatureChart.getData().getDataSetByIndex(temperatureChart.getData().getDataSetCount() - 1));
temperatureChart.getLegend().setTextColor(Color.parseColor("#FFFFFF"));
}
String temp = String.format(Locale.ENGLISH, getString(R.string.g_temp), pf.getUnits().equals("metric") ? getString(R.string.c) : getString(R.string.f));
set = new LineDataSet(tempEntries, temp);
set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
set.setCubicIntensity(0.2f);
set.setDrawCircles(false);
set.setLineWidth(2f);
set.setDrawValues(false);
set.setValueTextSize(10f);
set.setColor(Color.MAGENTA);
set.setHighlightEnabled(false);
set.setValueFormatter(mValueFormatter);
LineData data = new LineData(set);
temperatureChart.setData(data);
temperatureChart.invalidate();
}
use of com.github.mikephil.charting.components.XAxis in project Gadgetbridge by Freeyourgadget.
the class LiveActivityFragment method setupHistoryChart.
private void setupHistoryChart(BarLineChartBase chart) {
configureBarLineChartDefaults(chart);
// no zooming or anything, because it's updated all the time
chart.setTouchEnabled(false);
chart.setBackgroundColor(BACKGROUND_COLOR);
chart.getDescription().setTextColor(DESCRIPTION_COLOR);
chart.getDescription().setText(getString(R.string.live_activity_steps_per_minute_history));
chart.setNoDataText(getString(R.string.live_activity_start_your_activity));
chart.getLegend().setEnabled(false);
Paint infoPaint = chart.getPaint(Chart.PAINT_INFO);
infoPaint.setTextSize(Utils.convertDpToPixel(20f));
infoPaint.setFakeBoldText(true);
chart.setPaint(infoPaint, Chart.PAINT_INFO);
XAxis x = chart.getXAxis();
x.setDrawLabels(true);
x.setDrawGridLines(false);
x.setEnabled(true);
x.setTextColor(CHART_TEXT_COLOR);
x.setDrawLimitLinesBehindData(true);
YAxis y = chart.getAxisLeft();
y.setDrawGridLines(false);
y.setDrawTopYLabelEntry(false);
y.setTextColor(CHART_TEXT_COLOR);
y.setEnabled(true);
y.setAxisMinimum(0);
YAxis yAxisRight = chart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setEnabled(true);
yAxisRight.setDrawLabels(true);
yAxisRight.setDrawTopYLabelEntry(false);
yAxisRight.setTextColor(CHART_TEXT_COLOR);
yAxisRight.setAxisMaximum(HeartRateUtils.MAX_HEART_RATE_VALUE);
yAxisRight.setAxisMinimum(HeartRateUtils.MIN_HEART_RATE_VALUE);
mHistorySet = new LineDataSet(new ArrayList<Entry>(), getString(R.string.live_activity_steps_history));
mHistorySet.setAxisDependency(YAxis.AxisDependency.LEFT);
mHistorySet.setColor(akActivity.color);
mHistorySet.setDrawCircles(false);
mHistorySet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
mHistorySet.setDrawFilled(true);
mHistorySet.setDrawValues(false);
mHeartRateSet = createHeartrateSet(new ArrayList<Entry>(), getString(R.string.live_activity_heart_rate));
mHeartRateSet.setDrawValues(false);
}
use of com.github.mikephil.charting.components.XAxis 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.XAxis 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);
}
Aggregations