use of com.a5corp.weather.utils.XFormatter 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.a5corp.weather.utils.XFormatter 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.a5corp.weather.utils.XFormatter in project Weather by Sparker0i.
the class GraphsFragment method loadSnowChart.
public void loadSnowChart() {
snowChart.setDrawGridBackground(false);
snowChart.setBackgroundColor(Color.BLACK);
snowChart.setTouchEnabled(true);
snowChart.setDragEnabled(true);
snowChart.setMaxHighlightDistance(300);
snowChart.setPinchZoom(true);
snowChart.setPadding(2, 2, 2, 2);
snowChart.getLegend().setEnabled(true);
snowChart.getLegend().setTextColor(Color.WHITE);
YAxis yAxisRight = snowChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setDrawAxisLine(false);
yAxisRight.setDrawLabels(false);
yAxisRight.setTextColor(Color.WHITE);
yAxisRight.enableAxisLineDashedLine(2f, 4f, 2f);
YAxis yAxisLeft = snowChart.getAxisLeft();
yAxisLeft.setTextColor(Color.WHITE);
XAxis x = snowChart.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 (snowChart.getData() != null) {
snowChart.getData().removeDataSet(snowChart.getData().getDataSetByIndex(snowChart.getData().getDataSetCount() - 1));
snowChart.getLegend().setTextColor(Color.parseColor("#FFFFFF"));
}
set = new LineDataSet(snowEntries, getString(R.string.g_snow));
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.YELLOW);
set.setHighlightEnabled(false);
set.setValueFormatter(mValueFormatter);
LineData data = new LineData(set);
snowChart.setData(data);
snowChart.invalidate();
}
use of com.a5corp.weather.utils.XFormatter in project Weather by Sparker0i.
the class GraphsFragment method loadWindChart.
public void loadWindChart() {
windChart.setDrawGridBackground(false);
windChart.setBackgroundColor(Color.BLACK);
windChart.setTouchEnabled(true);
windChart.setDragEnabled(true);
windChart.setMaxHighlightDistance(300);
windChart.setPinchZoom(true);
windChart.setPadding(2, 2, 2, 2);
windChart.getLegend().setEnabled(true);
windChart.getLegend().setTextColor(Color.WHITE);
YAxis yAxisRight = windChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setDrawAxisLine(false);
yAxisRight.setDrawLabels(false);
yAxisRight.setTextColor(Color.WHITE);
yAxisRight.enableAxisLineDashedLine(2f, 4f, 2f);
YAxis yAxisLeft = windChart.getAxisLeft();
yAxisLeft.setTextColor(Color.WHITE);
XAxis x = windChart.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 (windChart.getData() != null) {
windChart.getData().removeDataSet(windChart.getData().getDataSetByIndex(windChart.getData().getDataSetCount() - 1));
windChart.getLegend().setTextColor(Color.parseColor("#FFFFFF"));
}
String wind = String.format(Locale.ENGLISH, getString(R.string.g_wind), pf.getUnits().equals("metric") ? getString(R.string.mps) : getString(R.string.mph));
set = new LineDataSet(windEntries, wind);
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.RED);
set.setHighlightEnabled(false);
set.setValueFormatter(mValueFormatter);
LineData data = new LineData(set);
windChart.setData(data);
windChart.invalidate();
}
use of com.a5corp.weather.utils.XFormatter in project Weather by Sparker0i.
the class GraphsFragment method loadPressureChart.
public void loadPressureChart() {
pressureChart.setDrawGridBackground(false);
pressureChart.setBackgroundColor(Color.BLACK);
pressureChart.setTouchEnabled(true);
pressureChart.setDragEnabled(true);
pressureChart.setMaxHighlightDistance(300);
pressureChart.setPinchZoom(true);
pressureChart.setPadding(2, 2, 2, 2);
pressureChart.getLegend().setEnabled(true);
pressureChart.getLegend().setTextColor(Color.WHITE);
YAxis yAxisRight = pressureChart.getAxisRight();
yAxisRight.setDrawGridLines(false);
yAxisRight.setDrawAxisLine(false);
yAxisRight.setDrawLabels(false);
yAxisRight.setTextColor(Color.WHITE);
yAxisRight.enableAxisLineDashedLine(2f, 4f, 2f);
YAxis yAxisLeft = pressureChart.getAxisLeft();
yAxisLeft.setTextColor(Color.WHITE);
XAxis x = pressureChart.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 (pressureChart.getData() != null) {
pressureChart.getData().removeDataSet(pressureChart.getData().getDataSetByIndex(pressureChart.getData().getDataSetCount() - 1));
pressureChart.getLegend().setTextColor(Color.parseColor("#FFFFFF"));
}
set = new LineDataSet(pressureEntries, getString(R.string.g_pressure));
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.CYAN);
set.setHighlightEnabled(false);
set.setValueFormatter(mValueFormatter);
LineData data = new LineData(set);
pressureChart.setData(data);
pressureChart.invalidate();
}
Aggregations