本文整理汇总了Java中com.jjoe64.graphview.LineGraphView.setViewPort方法的典型用法代码示例。如果您正苦于以下问题:Java LineGraphView.setViewPort方法的具体用法?Java LineGraphView.setViewPort怎么用?Java LineGraphView.setViewPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jjoe64.graphview.LineGraphView
的用法示例。
在下文中一共展示了LineGraphView.setViewPort方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityCreated
import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay()
.getMetrics(displaymetrics);
height = displaymetrics.heightPixels;
width = displaymetrics.widthPixels;
exampleSeries = new GraphViewSeries(
new GraphViewData[] { new GraphViewData(.0d, .0d) });
graphView = new LineGraphView(getActivity(), getString(R.string.empty));
graphView.addSeries(exampleSeries);
graphView.setLimit(limitDecibels);
graphView.setViewPort(0, 150);
graphView.setManualYAxisBounds(150, 0);
graphView.setScalable(true);
graphView.getGraphViewStyle().setHorizontalLabelsColor(
getResources().getColor(R.color.blue_bar));
graphView.getGraphViewStyle().setHorizontalLabelsColor(
getResources().getColor(android.R.color.transparent));
graphView.getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);
graphLayout.addView(graphView);
isListen = false;
buttonClicked();
super.onActivityCreated(savedInstanceState);
}
示例2: setupInnerViewElements
import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
@Override
public void setupInnerViewElements(ViewGroup parent, View view) {
mGraphView = new LineGraphView(getContext(), mTitle);
mGraphView.addSeries(mStatus.getGraphViewSeries());
mGraphView.setManualYAxisBounds(1.0f, 0.0f);
mGraphView.setViewPort(0.0f, 200.0f);
mGraphView.setScrollable(true);
mGraphView.setDisableTouch(true);
mGraphView.getGraphViewStyle().setNumHorizontalLabels(1);
LinearLayout graphLayout = (LinearLayout) view.findViewById(
R.id.card_status_graph);
if (graphLayout != null) {
graphLayout.addView(mGraphView);
}
}
示例3: initUi
import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
/**
* Init UI contols
*/
private void initUi(final View view) {
tvCellDescription = (TextView) view.findViewById(R.id.stats_cell_description);
tvCellStrength = (TextView) view.findViewById(R.id.stats_cell_strength);
tvWifiDescription = (TextView) view.findViewById(R.id.stats_wifi_description);
tvWifiStrength = (TextView) view.findViewById(R.id.stats_wifi_strength);
tvIgnored = (TextView) view.findViewById(R.id.stats_blacklisted);
tvFree = (TextView) view.findViewById(R.id.stats_free);
ivFree = (ImageView) view.findViewById(R.id.stats_icon_free);
ivAlert = (ImageView) view.findViewById(R.id.stats_icon_alert);
tbNa = (ToggleButton) view.findViewById(R.id.tbN_a);
tbGsm = (ToggleButton) view.findViewById(R.id.tbGsm);
tbEdge = (ToggleButton) view.findViewById(R.id.tbEdge);
tbUmts = (ToggleButton) view.findViewById(R.id.tbUmts);
tbCdma = (ToggleButton) view.findViewById(R.id.tbCdma);
tbEvdo0 = (ToggleButton) view.findViewById(R.id.tbEvdo0);
tbEvdoA = (ToggleButton) view.findViewById(R.id.tbEvdoA);
tbEvdoB = (ToggleButton) view.findViewById(R.id.tbEvdoB);
tbOneXRtt = (ToggleButton) view.findViewById(R.id.tbOneXRtt);
tbHsdpa = (ToggleButton) view.findViewById(R.id.tbHsdpa);
tbHsupa = (ToggleButton) view.findViewById(R.id.tbHsupa);
tbHspa = (ToggleButton) view.findViewById(R.id.tbHspa);
tbIden = (ToggleButton) view.findViewById(R.id.tbIden);
tbLte = (ToggleButton) view.findViewById(R.id.tbLte);
tbEhrpd = (ToggleButton) view.findViewById(R.id.tbEhrpd);
tbHspa_p = (ToggleButton) view.findViewById(R.id.tbHspa_p);
graphView = new LineGraphView(this.getActivity().getBaseContext() // context
, "Cell strength (dBm)");
graphView.setManualYAxisBounds(-50, -100);
graphView.getGraphViewStyle().setNumVerticalLabels(3);
graphView.setHorizontalLabels(new String[] {""});
graphView.setViewPort(2, 60000);
graphView.setScrollable(true);
final LinearLayout layout = (LinearLayout) view.findViewById(R.id.graph2);
layout.addView(graphView);
}
示例4: onCreateView
import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_dashboard, container, false);
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
NUM_SAMPLES = Integer.parseInt(sharedPreferences.getString(SettingsFragment.KEY_PREF_INTERVAL, "300"));
String[] horizontalLabels;
switch (NUM_SAMPLES) {
case 60:
horizontalLabels = new String[]{"1min", "45sec", "30sec", "15sec", "0min"};
Log.i(TAG, "Number of samples: 60");
break;
case 120:
horizontalLabels = new String[]{"2min", "1min", "0min"};
Log.i(TAG, "Number of samples: 120");
break;
case 300:
horizontalLabels = new String[]{"5min", "4min", "3min", "2min", "1min", "0min"};
Log.i(TAG, "Number of samples: 300");
break;
case 600:
horizontalLabels = new String[]{"10min", "8min", "6min", "4min", "2min", "0min"};
Log.i(TAG, "Number of samples: 600");
break;
case 1200:
horizontalLabels = new String[]{"20min", "15min", "10min", "5min", "0min"};
Log.i(TAG, "Number of samples: 1200");
break;
default:
horizontalLabels = new String[]{"5min", "4min", "3min", "2min", "1min", "0min"};
Log.i(TAG, "Number of samples: 300");
}
LinearLayout windSpeedContainer = (LinearLayout) view.findViewById(R.id.windSpeedContainer);
LinearLayout temperatureContainer = (LinearLayout) view.findViewById(R.id.temperatureContainer);
graphViewStyle = new GraphViewStyle(Color.BLACK, Color.BLACK, Color.GRAY);
graphViewStyle.setVerticalLabelsAlign(Paint.Align.LEFT);
graphViewStyle.setVerticalLabelsWidth(80);
windSpeedGraph = new LineGraphView(getActivity().getApplicationContext(), "Wind Speed");
windSpeedGraph.setScrollable(true);
// windSpeedGraph.setScalable(true);
windSpeedGraph.setViewPort(0, NUM_SAMPLES);
windSpeedGraph.setGraphViewStyle(graphViewStyle);
windSpeedGraph.setHorizontalLabels(horizontalLabels);
temperatureGraph = new LineGraphView(getActivity().getApplicationContext(), "Temperature");
temperatureGraph.setScrollable(true);
// temperatureGraph.setScalable(true);
temperatureGraph.setViewPort(0, NUM_SAMPLES);
temperatureGraph.setGraphViewStyle(graphViewStyle);
temperatureGraph.setHorizontalLabels(horizontalLabels);
temperatureGraph.setShowHorizontalLabels(false);
windSpeedData = new GraphViewData[1];
temperatureData = new GraphViewData[1];
windSpeedData[0] = new GraphViewData(0, 0);
temperatureData[0] = new GraphViewData(0, 0);
windSpeedSeries = new GraphViewSeries("Wind Speed", new GraphViewSeries.GraphViewSeriesStyle(Color.BLUE, 7), windSpeedData);
temperatureSeries = new GraphViewSeries("Temperature", new GraphViewSeries.GraphViewSeriesStyle(Color.RED, 7), temperatureData);
windSpeedGraph.addSeries(windSpeedSeries);
temperatureGraph.addSeries(temperatureSeries);
windSpeedContainer.addView(windSpeedGraph);
temperatureContainer.addView(temperatureGraph);
return view;
}
示例5: onCreateView
import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.game_sensor, container, false);
mOrientXValue = (TextView) rootView.findViewById(R.id.orient_x_value);
mOrientYValue = (TextView) rootView.findViewById(R.id.orient_y_value);
mOrientZValue = (TextView) rootView.findViewById(R.id.orient_z_value);
mLayoutGraph1 = (LinearLayout) rootView.findViewById(R.id.graph1);
mLayoutGraph2 = (LinearLayout) rootView.findViewById(R.id.graph2);
mGraphViewSeries1 = new GraphViewSeries(new
GraphViewData[] {
new GraphViewData(mValueX, 1.0f)
});
mGraphViewSeries2 = new GraphViewSeries(new
GraphViewData[] {
new GraphViewData(mValueX, 1.0f)
});
mGraph1 = new LineGraphView(getActivity(), "");
mGraph1.addSeries(mGraphViewSeries1);
mGraph1.setManualYAxisBounds(1.0f, 0.0f);
mGraph1.setViewPort(0.0f, 200.0f);
mGraph1.setScrollable(true);
mGraph1.setDisableTouch(true);
mGraph1.getGraphViewStyle().setNumHorizontalLabels(1);
mLayoutGraph1.addView(mGraph1);
mGraph2 = new LineGraphView(getActivity(), "");
mGraph2.addSeries(mGraphViewSeries2);
mGraph2.setManualYAxisBounds(1.0f, 0.0f);
mGraph2.setViewPort(0.0f, 200.0f);
mGraph2.setScrollable(true);
mGraph2.setDisableTouch(true);
mGraph2.getGraphViewStyle().setNumHorizontalLabels(1);
mLayoutGraph2.addView(mGraph2);
return rootView;
}