@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_reset) { getForecastData(); chart.setLineChartData(data); previewChart.setLineChartData(previewData); previewX(true); return true; } if (id == R.id.action_preview_both) { previewXY(); previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL); return true; } if (id == R.id.action_preview_horizontal) { previewX(true); return true; } if (id == R.id.action_preview_vertical) { previewY(); return true; } if (id == R.id.action_change_color) { int color = ChartUtils.pickColor(); while (color == previewChart.getPreviewColor()) { color = ChartUtils.pickColor(); } previewChart.setPreviewColor(color); return true; } return super.onOptionsItemSelected(item); }