当前位置: 首页>>代码示例>>Java>>正文


Java LineGraphView.addSeries方法代码示例

本文整理汇总了Java中com.jjoe64.graphview.LineGraphView.addSeries方法的典型用法代码示例。如果您正苦于以下问题:Java LineGraphView.addSeries方法的具体用法?Java LineGraphView.addSeries怎么用?Java LineGraphView.addSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jjoe64.graphview.LineGraphView的用法示例。


在下文中一共展示了LineGraphView.addSeries方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:LeonardoCardoso,项目名称:Silence-Please,代码行数:34,代码来源:PSilenceFragment.java

示例2: drawGraph

import com.jjoe64.graphview.LineGraphView; //导入方法依赖的package包/类
private void drawGraph(final Journey journey) {
  final LineGraphView graph = new LineGraphView(getActivity(), "");

  List<GraphView.GraphViewData> data = new ArrayList<>();
  for (Elevation elevation : journey.elevation().profile())
    data.add(new GraphView.GraphViewData(elevation.distance(), elevation.elevation()));

  GraphViewSeries graphSeries = new GraphViewSeries(data.toArray(new GraphView.GraphViewData[]{}));

  graph.addSeries(graphSeries);
  graph.setDrawBackground(true);
  graph.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.HORIZONTAL);
  graph.getGraphViewStyle().setNumHorizontalLabels(5);
  graph.getGraphViewStyle().setNumVerticalLabels(4);

  final ElevationFormatter formatter = ElevationFormatter.formatter(CycleStreetsPreferences.units());
  graph.setCustomLabelFormatter(new CustomLabelFormatter() {
    @Override
    public String formatLabel(double value, boolean isValueX) {
      if (isValueX)
        return (value != 0) ? formatter.distance((int)value) : "";
      return formatter.height((int) value);
    }
  });

  graphHolder_.removeAllViews();
  graphHolder_.addView(graph);
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:29,代码来源:ElevationProfileFragment.java

示例3: 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);
    }
}
 
开发者ID:Tetr4,项目名称:Spacecurl,代码行数:16,代码来源:StatusCard.java

示例4: 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;
}
 
开发者ID:patrickfav,项目名称:BlurTestAndroid,代码行数:46,代码来源:BenchmarkDetailsDialog.java

示例5: 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;
}
 
开发者ID:Kresshy,项目名称:Weather-Station,代码行数:79,代码来源:DashboardFragment.java

示例6: 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;
}
 
开发者ID:Tetr4,项目名称:Spacecurl,代码行数:42,代码来源:Sensor.java


注:本文中的com.jjoe64.graphview.LineGraphView.addSeries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。