本文整理汇总了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;
}
示例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();
}
}
示例3: zoomApplied
import org.achartengine.tools.ZoomEvent; //导入依赖的package包/类
@Override
public void zoomApplied(ZoomEvent zoomEvent) {
_zoomLevel = 100;
}
示例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();
}
}
示例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;
}