本文整理汇总了Java中com.jjoe64.graphview.LineGraphView.setScrollable方法的典型用法代码示例。如果您正苦于以下问题:Java LineGraphView.setScrollable方法的具体用法?Java LineGraphView.setScrollable怎么用?Java LineGraphView.setScrollable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jjoe64.graphview.LineGraphView
的用法示例。
在下文中一共展示了LineGraphView.setScrollable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: createGraph
import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
private GraphView createGraph(BenchmarkWrapper wrapper) {
Resources res = getResources();
int lineThicknessPx = (int) Math.ceil(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, res.getDisplayMetrics()));
GraphView.GraphViewData[] data = new GraphView.GraphViewData[wrapper.getStatInfo().getBenchmarkData().size()];
for (int j = 0; j < wrapper.getStatInfo().getBenchmarkData().size(); j++) {
data[j] = new GraphView.GraphViewData(j, wrapper.getStatInfo().getBenchmarkData().get(j));
}
LineGraphView graphView = new LineGraphView(getActivity(), "");
GraphViewSeries.GraphViewSeriesStyle seriesStyle = new GraphViewSeries.GraphViewSeriesStyle(res.getColor(R.color.graphBgGreen), lineThicknessPx);
if (wrapper.getStatInfo().getAsAvg().getMin() <= IBlur.MS_THRESHOLD_FOR_SMOOTH) {
graphView.addSeries(GraphUtil.getStraightLine(IBlur.MS_THRESHOLD_FOR_SMOOTH, wrapper.getStatInfo().getBenchmarkData().size() - 1, "16ms", new GraphViewSeries.GraphViewSeriesStyle(res.getColor(R.color.graphBgRed), lineThicknessPx)));
}
graphView.addSeries(GraphUtil.getStraightLine((int) wrapper.getStatInfo().getAsAvg().getAvg(), wrapper.getStatInfo().getBenchmarkData().size() - 1, "Avg", new GraphViewSeries.GraphViewSeriesStyle(res.getColor(R.color.graphBlue), lineThicknessPx)));
graphView.addSeries(new GraphViewSeries("Blur", seriesStyle, data));
graphView.setScrollable(true);
graphView.setScalable(true);
graphView.setManualYAxis(true);
graphView.getGraphViewStyle().setGridColor(res.getColor(R.color.transparent));
graphView.setCustomLabelFormatter(new CustomLabelFormatter() {
@Override
public String formatLabel(double value, boolean isValueX) {
if (!isValueX) {
return Math.round(value) + "ms";
} else {
return null;
}
}
});
graphView.setManualYAxisBounds(wrapper.getStatInfo().getAsAvg().getMax(), Math.max(0, wrapper.getStatInfo().getAsAvg().getMin() - 3l));
graphView.setDrawBackground(false);
graphView.setShowLegend(true);
graphView.getGraphViewStyle().setHorizontalLabelsColor(res.getColor(R.color.transparent));
graphView.getGraphViewStyle().setNumHorizontalLabels(0);
graphView.getGraphViewStyle().setVerticalLabelsColor(res.getColor(R.color.optionsTextColorDark));
graphView.getGraphViewStyle().setNumVerticalLabels(4);
graphView.getGraphViewStyle().setVerticalLabelsAlign(Paint.Align.CENTER);
graphView.getGraphViewStyle().setVerticalLabelsWidth((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, res.getDisplayMetrics()));
graphView.getGraphViewStyle().setTextSize((int) Math.ceil(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, res.getDisplayMetrics())));
return 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;
}