本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.setOnChartGestureListener方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setOnChartGestureListener方法的具体用法?Java LineChart.setOnChartGestureListener怎么用?Java LineChart.setOnChartGestureListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.setOnChartGestureListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_lastscanchart, container, false);
LineChart cv_LastScan = (LineChart) view.findViewById(R.id.cv_LastScan);
cv_LastScan.setOnChartGestureListener(new myChartGestureListener(cv_LastScan));
XAxis xAxis = cv_LastScan.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(10f);
xAxis.setTextColor(getResources().getColor(R.color.colorGlucoseNow));
xAxis.enableGridDashedLine(5f, 5f, 0f);
xAxis.setDrawLimitLinesBehindData(true);
YAxis yAxisLeft = cv_LastScan.getAxisLeft();
YAxis yAxisRight = cv_LastScan.getAxisRight();
yAxisRight.setEnabled(false);
yAxisLeft.setTextSize(18f); // set the textsize
yAxisLeft.setTextColor(getResources().getColor(R.color.colorGlucoseNow));
yAxisLeft.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
yAxisLeft.setStartAtZero(true);
yAxisLeft.setYOffset(-6f);
yAxisLeft.setAxisMinValue(0.0f);
Legend legend = cv_LastScan.getLegend();
legend.setEnabled(false);
// no description text
cv_LastScan.setDescription("");
cv_LastScan.setNoDataText(getResources().getString(R.string.no_data));
cv_LastScan.setNoDataTextDescription("");
// enable touch gestures
cv_LastScan.setTouchEnabled(true);
// enable scaling and dragging
cv_LastScan.setDragEnabled(true);
cv_LastScan.setScaleEnabled(true);
cv_LastScan.setDrawGridBackground(false);
// if disabled, scaling can be done on x- and y-axis separately
cv_LastScan.setPinchZoom(true);
MyMarkerView mv = new MyMarkerView(view.getContext(), R.layout.custom_marker_view);
// set the marker to the chart
cv_LastScan.setMarkerView(mv);
try {
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
cv_LastScan.setHardwareAccelerationEnabled(false);
} else {
cv_LastScan.setHardwareAccelerationEnabled(true);
}
} catch (Exception e) {
}
refresh();
return (view);
}