private void refreshChart() { // TODO Auto-generated method stub Float lightNum = collection.getLight(); int index = mDataCache.addLightData(lightNum); if (index == 1) { mCurrentSeries.clear(); } mCurrentSeries.add(index, lightNum); mChartView.repaint(); }
@Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); mDataCache = DataCache.getInstance(); mDataset = new XYMultipleSeriesDataset(); mRenderer = new XYMultipleSeriesRenderer(); // Renderer // Basic mRenderer.setMargins(new int[] {100, 150, 30, 100}); mRenderer.setChartTitleTextSize(20); mRenderer.setApplyBackgroundColor(true); mRenderer.setBackgroundColor(0xffE8E8E7); mRenderer.setMarginsColor(0xffE8E8E7); mRenderer.setLegendTextSize(15); mRenderer.setPointSize(5); mRenderer.setShowLegend(true); mRenderer.setClickEnabled(false); // Axes mRenderer.setAxisTitleTextSize(50); mRenderer.setBarSpacing(50); mRenderer.setYTitle("Light"); // mRenderer.setAxesColor(Color.BLACK); // Labels // mRenderer.setLabelsColor(Color.WHITE); mRenderer.setLabelsTextSize(35); mRenderer.setXLabels(0); mRenderer.setYLabels(10); mRenderer.setYAxisMin(0); mRenderer.setYAxisMax(1000); mRenderer.setXLabelsColor(Color.BLACK); mRenderer.setYLabelsColor(0, Color.BLACK); mRenderer.setXLabelsAngle(-45f); mRenderer.setXLabelsAlign(Align.CENTER); mRenderer.setYLabelsAlign(Align.RIGHT); mRenderer.setPanEnabled(false, false); mRenderer.setZoomEnabled(false, false); }