當前位置: 首頁>>代碼示例>>Java>>正文


Java ChartFactory.getTimeChartView方法代碼示例

本文整理匯總了Java中org.achartengine.ChartFactory.getTimeChartView方法的典型用法代碼示例。如果您正苦於以下問題:Java ChartFactory.getTimeChartView方法的具體用法?Java ChartFactory.getTimeChartView怎麽用?Java ChartFactory.getTimeChartView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.achartengine.ChartFactory的用法示例。


在下文中一共展示了ChartFactory.getTimeChartView方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
@Override
public View onCreateView(final LayoutInflater inflater,
		final ViewGroup container, final Bundle savedInstanceState) {
	Log.d(TAG, "onCreateView");

	if (Configuration.ORIENTATION_PORTRAIT == getResources()
			.getConfiguration().orientation) {
		mRenderer.setYLabels(15);
	}

	final LinearLayout view = (LinearLayout) inflater.inflate(
			R.layout.fragment_daymode_chart, container, false);
	mChartView = ChartFactory.getTimeChartView(getActivity(), mDataset,
			mRenderer, TIME);
	mChartView.addZoomListener(mZoomListener, true, false);
	view.addView(mChartView, new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.WRAP_CONTENT));
	return view;
}
 
開發者ID:moguai2k,項目名稱:ProjektWerkstatt13,代碼行數:20,代碼來源:DaymodeFragment.java

示例2: onResume

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
@Override
protected void onResume() {
    super.onResume();

    layout = (LinearLayout) findViewById(R.id.chart);
    LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, new IntentFilter(BaseActivity.MSG_SENSOR_DATA));
    if (graphicalView == null) {
        initChart();
        graphicalView = ChartFactory.getTimeChartView(PlotActivity.this, dataSet, dataRenderer, "HH:mm:ss.SSS");
        layout.addView(graphicalView);
    }

}
 
開發者ID:dumbfingers,項目名稱:SensorFun,代碼行數:14,代碼來源:PlotActivity.java

示例3: renderGraph

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public void renderGraph(Map<Long, Integer> scores){
   removeAllViews();
   String[] titles = new String[] { "" };
   List<Date[]> dates = new ArrayList<Date[]>();
   List<double[]> values = new ArrayList<double[]>();

   int maxScore = 100;
   Set<Long> keys = scores.keySet();
   int i = keys.size() - 1;
   if (0 > i){ return; }
   Date[] dateValues = new Date[keys.size()];
   double[] scoreValues = new double[keys.size()];
   for (Long when : keys){
      dateValues[i] = new Date(when);
      int score = scores.get(when);
      if (score > maxScore){ maxScore = score; }
      scoreValues[i--] = score;

      // store the last minimum date for later use by QamarGraphActivity
      mMinimumDate = when;
   }

   dates.add(dateValues);
   values.add(scoreValues);

   int[] colors = new int[] { Color.BLUE };
   PointStyle[] styles = new PointStyle[] { PointStyle.POINT };
   XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
   setChartSettings(renderer, dateValues[0].getTime(),
           dateValues[dateValues.length - 1].getTime(),
           0, maxScore + 100, Color.DKGRAY);
   renderer.setYLabels(10);
   renderer.setPanEnabled(false, false);
   renderer.setZoomEnabled(false, false);
   View view = ChartFactory.getTimeChartView(mContext,
           buildDateDataset(titles, dates, values),
           renderer, "MMM yyyy");

   addView(view, ViewGroup.LayoutParams.MATCH_PARENT,
           ViewGroup.LayoutParams.MATCH_PARENT);
}
 
開發者ID:batoulapps,項目名稱:qamardeen-android,代碼行數:42,代碼來源:GraphWidget.java

示例4: draw

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public void draw() {
	ArrayList<String> dates;
	ArrayList<Double> readings;

	// assign the data passed to the intent
	dates = getIntent().getStringArrayListExtra("dates");
	readings = (ArrayList<Double>) getIntent().getSerializableExtra(
			"readings");
	title = getIntent().getStringExtra("test");

	// create a new time series for the graph
	TimeSeries series = new TimeSeries(title + " Results");

	// populate the series with data retrieved from the database
	for (int i = dates.size() - 1; i >= 0; i--) {
		// parse the date object to calendar date time
		try {
			c.setTime(sdf.parse(dates.get(i)));
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		// add the current point to the time series
		series.add(c.getTime(), readings.get(i));

	}

	XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
	dataset.addSeries(series); // initialize the set of data to be drawn

	// Now create the renderer to control how the chart looks like
	XYSeriesRenderer renderer = new XYSeriesRenderer();
	renderer.setLineWidth(4);
	renderer.setColor(Color.WHITE);

	// add point markers
	renderer.setPointStyle(PointStyle.CIRCLE);
	renderer.setPointStrokeWidth(3);
	renderer.setDisplayChartValues(true);

	XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
	mRenderer.addSeriesRenderer(renderer);

	// avoid black border
	mRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); // transparent
																	// margins
	// Enable Pan on two axis
	mRenderer.setPanEnabled(true, true);
	mRenderer.setShowGrid(true); // show the grid
	mRenderer.setXTitle("Day");
	if (title.equals("HBA1C"))
		mRenderer.setYTitle("%");
	else
		mRenderer.setYTitle("mg/dl");
	mRenderer.setZoomButtonsVisible(true);

	GraphicalView chartView = ChartFactory.getTimeChartView(DrawGraph.this,
			dataset, mRenderer, "yyyy/MM/dd hh:mm aa");// combines the dataset with
												// the renderer and returns
												// a view
	
	
	LinearLayout chart_container = (LinearLayout) findViewById(R.id.Chart_layout);

	//set the created chart view to the linear layout of the layout created for the graph
	chart_container.addView(chartView, 0);

}
 
開發者ID:Falimbert,項目名稱:BgLogger,代碼行數:71,代碼來源:DrawGraph.java

示例5: onCreate

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
	                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

	// keep main display on?
	if(MainActivity.prefs.getBoolean("keep_screen_on", false))
	{
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	}

	// prevent activity from falling asleep
	PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
	wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
		getString(R.string.app_name));
	wakeLock.acquire();

	// set up action bar
	ActionBar actionBar = getActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayShowTitleEnabled(true);
	}

	setTitle(R.string.chart);

	/* get PIDs to be shown */
	int positions[] = getIntent().getIntArrayExtra(POSITIONS);

	// set up overall chart properties
	sensorData = new XYMultipleSeriesDataset();
	renderer = new XYMultipleSeriesRenderer(positions.length);
	chartView = ChartFactory.getTimeChartView(this, sensorData, renderer, "H:mm:ss");
	// set up global renderer
	renderer.setXTitle(getString(R.string.time));
	renderer.setXLabels(5);
	renderer.setYLabels(5);
	renderer.setGridColor(Color.DKGRAY);
	renderer.setShowGrid(true);
	renderer.setFitLegend(true);
	renderer.setClickEnabled(false);
	// set up chart data
	setUpChartData(positions);
	// make chart visible
	setContentView(chartView);
	// limit selected PIDs to selection
	MainActivity.setFixedPids(pidNumbers);
	// if auto hiding selected ...
	if(MainActivity.prefs.getBoolean(MainActivity.PREF_AUTOHIDE,false))
	{
		// get autohide timeout [s]
		int timeout = Integer.valueOf(
			MainActivity.prefs.getString(MainActivity.PREF_AUTOHIDE_DELAY,"15") );
		// auto hide toolbar
		toolBarHider = new AutoHider( this,
		                              mHandler,
		                              MainActivity.MESSAGE_TOOLBAR_VISIBLE,
		                              timeout * 1000);
		toolBarHider.start(1000);
		// wake up on touch
		chartView.setOnTouchListener(toolBarHider);
	}
}
 
開發者ID:fr3ts0n,項目名稱:AndrOBD,代碼行數:66,代碼來源:ChartActivity.java

示例6: getChartGraphicalView

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
public GraphicalView getChartGraphicalView(Context context){
    return ChartFactory.getTimeChartView(context, dataset, renderer,null);
}
 
開發者ID:yzxsunshine,項目名稱:SensorFusionPedometer,代碼行數:4,代碼來源:PeakValleyChart.java

示例7: drawChart

import org.achartengine.ChartFactory; //導入方法依賴的package包/類
private void drawChart() {
	mRenderer = new XYMultipleSeriesRenderer();
	mDataset = new XYMultipleSeriesDataset();
	
	XYSeriesRenderer renderer = new XYSeriesRenderer();
	renderer.setLineWidth(5);
	renderer.setColor(Color.parseColor("#0099cc")); 
	renderer.setDisplayBoundingPoints(true);
       renderer.setPointStyle(PointStyle.CIRCLE);
       renderer.setPointStrokeWidth(10);
       //FillOutsideLine fillOutsideLine = new FillOutsideLine(Type.BOUNDS_ALL);
       //fillOutsideLine.setColor(Color.parseColor("#0099cc")); 
       //renderer.addFillOutsideLine(fillOutsideLine); 
	
       //mRenderer.setChartTitle("Battery Level (%)");
       mRenderer.setChartTitleTextSize(30f);
       mRenderer.setLabelsTextSize(20f);
	mRenderer.addSeriesRenderer(renderer);
	mRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
	mRenderer.setPanEnabled(true, false);
	mRenderer.setZoomEnabled(false, false);
       mRenderer.setYAxisMax(DeviceUtils.getBatteryScale(getActivity()));
       mRenderer.setYAxisMin(0);
       //mRenderer.setShowGrid(true);
       mRenderer.setGridColor(Color.GRAY);
       mRenderer.setClickEnabled(false);
       
       
       TimeSeries series = new TimeSeries("");
       
 /*      long value = new Date().getTime() - 3 * TimeChart.DAY;
       for (int i = 0; i < 5; i++) {
		series.add(new Date(value + i * TimeChart.DAY / 4), i);
	}*/
       
       List<BatteryTrace> traces = BatteryTrace.getClosestTraceData(getActivity().getContentResolver(), LIMIT_DATE_SHOW);
       
       boolean chartVisible = traces.size() >= MINIMUM_VALUE_TO_SHOW_CHART;
       
       if (chartVisible) {
           Calendar panMinimumX = Calendar.getInstance();
           panMinimumX.set(Calendar.HOUR_OF_DAY, traces.get(0).hour);
           panMinimumX.set(Calendar.MINUTE, traces.get(0).minutes);
           
           Calendar panMaximumX = Calendar.getInstance();
           panMaximumX.set(Calendar.HOUR_OF_DAY, traces.get(traces.size()-1).hour); 
           panMaximumX.set(Calendar.MINUTE, traces.get(traces.size()-1).minutes); 
           //mRenderer.setPanLimits(new double[] {panMinimumX.getTimeInMillis(), panMaximumX.getTimeInMillis() * 2, 0, 0});
           for (BatteryTrace b : traces) {
           	//System.out.println(b.toString()); 
           	Calendar c = Calendar.getInstance();
           	c.set(Calendar.HOUR_OF_DAY, b.hour);
           	c.set(Calendar.MINUTE, b.minutes);
           	series.add(c.getTime(), b.level);
   		}
           mDataset.addSeries(series); 
           mChartView = ChartFactory.getTimeChartView(getActivity(), mDataset, mRenderer, "hh:mm aa");
	}
}
 
開發者ID:jackvt93,項目名稱:Open-Battery-Saver,代碼行數:60,代碼來源:BatteryInfoFragment.java


注:本文中的org.achartengine.ChartFactory.getTimeChartView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。