/** * There is one chart for each signal type. Returns the chart component of a specific signal type. * * @return */ public LineChart getChart(String signalTypeId) { if (!charts.containsKey(signalTypeId)) { // Create a chart component // chart = (LineChart) findViewById(R.id.chart); final LineChart chart = new LineChart(this); // chart.setUnit("Db"); chart.setUnit(""); // chart.setDrawUnitsInChart(true); chart.setDrawYValues(false); chart.setDrawBorder(false); chart.setTouchEnabled(true); chart.setDragEnabled(true); chart.setNoDataTextDescription("No data gathered."); chart.setDescription("Samples"); chart.setPinchZoom(true); // if disabled, scaling can be done on x- and y-axis separately // set an alternative background color // mChart.setBackgroundColor(Color.GRAY) // Creates a chart tab. // http://www.java2s.com/Code/Android/UI/DynamicTabDemo.htm // http://www.java2s.com/Code/Android/UI/UsingatabcontentfactoryforthecontentviaTabHostTabSpecsetContentandroidwidgetTabHostTabContentFactory.htm TabHost.TabSpec spec = tabHost.newTabSpec(signalTypeId); spec.setIndicator(signalTypeId); spec.setContent( new TabHost.TabContentFactory() { public View createTabContent(String tag) { return chart; } }); tabHost.addTab(spec); // addContentToTab(tabHost.getChildCount(), chart); charts.put(signalTypeId, chart); tabHost.invalidate(); } return charts.get(signalTypeId); }