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


Java ZoomEvent类代码示例

本文整理汇总了Java中org.achartengine.tools.ZoomEvent的典型用法代码示例。如果您正苦于以下问题:Java ZoomEvent类的具体用法?Java ZoomEvent怎么用?Java ZoomEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ZoomEvent类属于org.achartengine.tools包,在下文中一共展示了ZoomEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGraph

import org.achartengine.tools.ZoomEvent; //导入依赖的package包/类
public GraphicalView getGraph(Context context) {
    String title = "";
    double[] xValues = new double[0];
    double[] yValues = new double[0];
    mRenderer = buildRenderer(context);
    mDataset = buildDataset(title, xValues, yValues);

    mLogic.setGraph(this);

    mChartView = ChartFactory.getLineChartView(context, mDataset, mRenderer);
    mChartView.addPanListener(new PanListener() {
        @Override
        public void panApplied() {
            mLogic.mGraphModule.updateGraphCatchErrors(Graph.this);
        }
    });
    mChartView.addZoomListener(new ZoomListener() {
        @Override
        public void zoomReset() {
            mLogic.mGraphModule.updateGraphCatchErrors(Graph.this);
        }

        @Override
        public void zoomApplied(ZoomEvent event) {
            mLogic.mGraphModule.updateGraphCatchErrors(Graph.this);
        }
    }, true, true);

    mLogic.mGraphModule.updateGraphCatchErrors(this);

    return mChartView;
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:33,代码来源:Graph.java

示例2: zoomApplied

import org.achartengine.tools.ZoomEvent; //导入依赖的package包/类
@Override
public void zoomApplied(final ZoomEvent event) {
	double diffX = (maxXRange - minXRange) / 4;

	if (event.isZoomIn()) {
		minXRange += diffX;
		maxXRange -= diffX;
		scrollGraph();
	} else // zoomOut
	{
		minXRange -= diffX;
		maxXRange += diffX;
		scrollGraph();
	}
}
 
开发者ID:moguai2k,项目名称:ProjektWerkstatt13,代码行数:16,代码来源:DaymodeFragment.java

示例3: zoomApplied

import org.achartengine.tools.ZoomEvent; //导入依赖的package包/类
@Override
public void zoomApplied(ZoomEvent zoomEvent) {
	_zoomLevel = 100;
}
 
开发者ID:crownstone,项目名称:fridge-file-app,代码行数:5,代码来源:StatisticsActivity.java

示例4: onResume

import org.achartengine.tools.ZoomEvent; //导入依赖的package包/类
@Override
protected void onResume() {
  super.onResume();
  if (mChartView == null) {
    LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
    // mChartView = ChartFactory.getLineChartView(this, mDataset, mRenderer);
    // mChartView = ChartFactory.getBarChartView(this, mDataset, mRenderer,
    // Type.DEFAULT);
    mChartView = ChartFactory.getScatterChartView(this, mDataset, mRenderer);

    // enable the chart click events
    mRenderer.setClickEnabled(true);
    mRenderer.setSelectableBuffer(100);
    mChartView.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        // handle the click event on the chart
        SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
        if (seriesSelection == null) {
          Toast.makeText(XYChartBuilderBackup.this, "No chart element was clicked",
              Toast.LENGTH_SHORT).show();
        } else {
          // display information of the clicked point
          double[] xy = mChartView.toRealPoint(0);
          Toast.makeText(
              XYChartBuilderBackup.this,
              "Chart element in series index " + seriesSelection.getSeriesIndex()
                  + " data point index " + seriesSelection.getPointIndex() + " was clicked"
                  + " closest point value X=" + seriesSelection.getXValue() + ", Y="
                  + seriesSelection.getValue() + " clicked point value X=" + (float) xy[0]
                  + ", Y=" + (float) xy[1], Toast.LENGTH_SHORT).show();
        }
      }
    });
    // an example of handling the zoom events on the chart
    mChartView.addZoomListener(new ZoomListener() {
      public void zoomApplied(ZoomEvent e) {
        String type = "out";
        if (e.isZoomIn()) {
          type = "in";
        }
        Log.i("Zoom", "Zoom " + type + " rate " + e.getZoomRate());
      }

      public void zoomReset() {
        Log.i("Zoom", "Reset");
      }
    }, true, true);
    // an example of handling the pan events on the chart
    mChartView.addPanListener(new PanListener() {
      public void panApplied() {
        Log.i("Pan", "New X range=[" + mRenderer.getXAxisMin() + ", " + mRenderer.getXAxisMax()
            + "], Y range=[" + mRenderer.getYAxisMax() + ", " + mRenderer.getYAxisMax() + "]");
      }
    });
    layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.FILL_PARENT));
    boolean enabled = mDataset.getSeriesCount() > 0;
    setSeriesWidgetsEnabled(enabled);
  } else {
    mChartView.repaint();
  }
}
 
开发者ID:ddanny,项目名称:achartengine,代码行数:63,代码来源:XYChartBuilderBackup.java

示例5: onCreateView

import org.achartengine.tools.ZoomEvent; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_report, container, false);

    Calendar cal = Calendar.getInstance();
    Date now = new Date();
    cal.setTime(now);
    currentTimeStamp = cal.getTimeInMillis();
    ButterKnife.bind(this, view);


    mChartView = reportGraph.getChartGraph(getActivity());

    mChartView.addZoomListener(new ZoomListener() {
        public void zoomApplied(ZoomEvent e) {
            updateLabels();
        }

        public void zoomReset() {
        }
    }, true, true);
    mChartView.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // handle the click event on the chart
            SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
            if (seriesSelection == null) {
                //Toast.makeText(getActivity(), "No chart element", Toast.LENGTH_SHORT).show();
            } else if(workoutType == WorkoutTypes.STEP_COUNT.getValue()){
                // display information of the clicked point
                Toast.makeText(
                        getActivity(),
                        "" + reportGraph.getDataAtPoint(seriesSelection.getXValue()) + " steps", Toast.LENGTH_SHORT).show();
            }
        }
    });
    mChartView.addPanListener(new PanListener() {
        @Override
        public void panApplied() {
            updateLabels();
        }
    });
    mChartLayout.addView(mChartView);

    // Now return the SwipeRefreshLayout as this fragment's content view
    return view;
}
 
开发者ID:blackcj,项目名称:GoogleFitExample,代码行数:48,代码来源:ReportsFragment.java


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