本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.setPinchZoom方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setPinchZoom方法的具体用法?Java LineChart.setPinchZoom怎么用?Java LineChart.setPinchZoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.setPinchZoom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_device, container, false);
mXAxis = (TextView) layout.findViewById(R.id.tvXAxis);
mYAxis = (TextView) layout.findViewById(R.id.tvYAxis);
mZAxis = (TextView) layout.findViewById(R.id.tvZAxis);
mMax = (TextView) layout.findViewById(R.id.tvMax);
mStart = (Button) layout.findViewById(R.id.bStart);
mStop = (Button) layout.findViewById(R.id.bStop);
mExport = (Button) layout.findViewById(R.id.bExport);
mChart = (LineChart) layout.findViewById(R.id.chart);
mChart.setDescription(null);
mChart.setHighlightPerDragEnabled(false);
mChart.setHighlightPerTapEnabled(false);
mChart.setPinchZoom(true);
mChart.getLegend().setDrawInside(true);
mChart.setExtraTopOffset(10);
mStart.setOnClickListener(this);
mStop.setOnClickListener(this);
mExport.setOnClickListener(this);
return layout;
}
示例2: initInValidGoNoGoGameLineChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initInValidGoNoGoGameLineChart(Activity activity, View view) {
inValidGoNoGoGamesLineChart = (LineChart) view.findViewById(R.id.line_chart_invalid_gonogogames);
inValidGoNoGoGamesLineChart.setDescription("");
String noData = activity.getResources().getString(R.string.no_failures_to_display);
inValidGoNoGoGamesLineChart.setNoDataText(noData);
inValidGoNoGoGamesLineChart.setTouchEnabled(false);
inValidGoNoGoGamesLineChart.setDragEnabled(true);
inValidGoNoGoGamesLineChart.setScaleEnabled(true);
inValidGoNoGoGamesLineChart.setPinchZoom(true);
inValidGoNoGoGamesLineChart.setBackgroundColor(Color.WHITE);
inValidGoNoGoGamesLineChart.setDrawGridBackground(false);
YAxis leftAxis = inValidGoNoGoGamesLineChart.getAxisLeft();
leftAxis.setAxisMinValue(0);
YAxis righAxis = inValidGoNoGoGamesLineChart.getAxisRight();
if (righAxis != null)
righAxis.setEnabled(false);
}
示例3: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);
mChart.setGridBackgroundColor(mFillColor);
mChart.setDrawGridBackground(true);
mChart.setDrawBorders(true);
// no description text
mChart.getDescription().setEnabled(false);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
Legend l = mChart.getLegend();
l.setEnabled(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setAxisMaximum(900f);
leftAxis.setAxisMinimum(-250f);
leftAxis.setDrawAxisLine(false);
leftAxis.setDrawZeroLine(false);
leftAxis.setDrawGridLines(false);
mChart.getAxisRight().setEnabled(false);
// add data
setData(100, 60);
mChart.invalidate();
}
示例4: buildView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
this.fragmentManager = fragmentManager;
LineChart chart = new LineChart(context);
chart.setDescription(getDescription(context));
chart.setHighlightEnabled(true);
chart.setTouchEnabled(true);
chart.setDragDecelerationFrictionCoef(0.9f);
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
chart.setDrawGridBackground(false);
chart.setHighlightPerDragEnabled(true);
chart.setPinchZoom(true);
chart.animateX(2500);
chart.animateY(2500);
viewGroup.addView(chart);
return chart;
}
示例5: init
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void init(){
inflate(getContext(), R.layout.view_chart, this);
mToolbar = (Toolbar) findViewById(R.id.chart_toolbar);
mLineChart = (LineChart) findViewById(R.id.chart);
mToolbar.inflateMenu(R.menu.chart);
mToolbar.setOnMenuItemClickListener(this);
mLineChart.getLegend().setEnabled(false);
mLineChart.getXAxis().setDrawLabels(false);
mLineChart.getAxisLeft().setDrawLabels(true);
mLineChart.getAxisRight().setDrawLabels(false);
mLineChart.setDescription("");
mLineChart.setPinchZoom(false);
mLineChart.setDoubleTapToZoomEnabled(false);
}
示例6: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_performance_linechart);
mTvCount = (TextView) findViewById(R.id.tvValueCount);
mSeekBarValues = (SeekBar) findViewById(R.id.seekbarValues);
mTvCount.setText("500");
mSeekBarValues.setProgress(500);
mSeekBarValues.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setDrawGridBackground(false);
// no description text
mChart.getDescription().setEnabled(false);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.getAxisLeft().setDrawGridLines(false);
mChart.getAxisRight().setEnabled(false);
mChart.getXAxis().setDrawGridLines(true);
mChart.getXAxis().setDrawAxisLine(false);
// dont forget to refresh the drawing
mChart.invalidate();
}
示例7: prepareChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void prepareChart(@NonNull LineChart chart) {
chart.getDescription().setEnabled(false);
chart.setTouchEnabled(false);
chart.setDragEnabled(false);
chart.setScaleEnabled(false);
chart.setHighlightPerDragEnabled(false);
chart.setPinchZoom(false);
chart.setDrawGridBackground(true);
chart.getLegend().setEnabled(false);
chart.getAxisRight().setEnabled(false);
chart.getAxisLeft().setEnabled(false);
chart.getXAxis().setEnabled(false);
chart.setViewPortOffsets(0, 0, 0, 0);
}
示例8: initChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initChart(@NonNull LineChart chart) {
chart.getDescription().setEnabled(false);
chart.setTouchEnabled(false);
chart.setDragEnabled(false);
chart.setScaleEnabled(false);
chart.setHighlightPerDragEnabled(false);
chart.setPinchZoom(false);
chart.setDrawGridBackground(false);
chart.getLegend().setEnabled(false);
chart.getAxisRight().setEnabled(false);
chart.getXAxis().setEnabled(false);
chart.getAxisLeft().setEnabled(false);
chart.getXAxis().setEnabled(false);
chart.setViewPortOffsets(0, 0, 0, 0);
}
示例9: initHeartRateChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initHeartRateChart(LineChart mChart) {
mChart.setViewPortOffsets(0, 0, 0, 0);
mChart.setBackgroundColor(getResources().getColor(R.color.gold_pressed));
mChart.setDescription("Heart Rate");
mChart.setTouchEnabled(true);
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
mChart.setMaxHighlightDistance(300);
XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
xAxis.setTextSize(11f);
xAxis.setTextColor(Color.WHITE);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(false);
YAxis y = mChart.getAxisLeft();
y.setTypeface(BandApplication.INSTANCE.getTfLight());
y.setLabelCount(6, false);
y.setTextColor(Color.RED);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
y.setLabelCount(6, false);
y.setTextColor(Color.RED);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);
mChart.getLegend().setEnabled(false);
mChart.animateXY(2000, 2000);
}
示例10: initResistanceChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initResistanceChart(LineChart mChart) {
// mChart.setOnChartValueSelectedListener(this);
mChart.setDescription("Skin Resistance");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
mChart.setTouchEnabled(true);
mChart.setDragDecelerationFrictionCoef(0.9f);
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setDrawGridBackground(false);
mChart.setHighlightPerDragEnabled(true);
mChart.setPinchZoom(true);
mChart.setBackgroundColor(getResources().getColor(R.color.green_pressed));
mChart.animateX(2500);
Legend l = mChart.getLegend();
l.setForm(Legend.LegendForm.LINE);
l.setTypeface(BandApplication.INSTANCE.getTfLight());
l.setTextSize(11f);
l.setTextColor(Color.WHITE);
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
mChart.getXAxis().setEnabled(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
leftAxis.setTextColor(Color.RED);
leftAxis.setDrawGridLines(true);
leftAxis.setGranularityEnabled(true);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
rightAxis.setTextColor(Color.RED);
rightAxis.setDrawGridLines(false);
rightAxis.setDrawZeroLine(false);
rightAxis.setGranularityEnabled(false);
}
示例11: ChartViewHolder
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
public ChartViewHolder(View itemView) {
super(itemView);
mChart = (LineChart) itemView.findViewById(R.id.chart);
mChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
mChart.getAxisRight().setEnabled(false);
mChart.setTouchEnabled(false);
mChart.setDoubleTapToZoomEnabled(false);
mChart.setPinchZoom(false);
mChart.setDescription("");
}
示例12: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_performance_linechart);
mTvCount = (TextView) findViewById(R.id.tvValueCount);
mSeekBarValues = (SeekBar) findViewById(R.id.seekbarValues);
mTvCount.setText("500");
mSeekBarValues.setProgress(500);
mSeekBarValues.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setDrawGridBackground(false);
// no description text
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.getAxisLeft().setDrawGridLines(false);
mChart.getAxisRight().setEnabled(false);
mChart.getXAxis().setDrawGridLines(true);
mChart.getXAxis().setDrawAxisLine(false);
// dont forget to refresh the drawing
mChart.invalidate();
}
示例13: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View rootView = inflater.inflate(R.layout.fragment_analysis, container, false);
chart = (LineChart) rootView.findViewById(R.id.chart);
chart.setDragEnabled(true);
chart.setScaleXEnabled(true);
chart.setScaleYEnabled(false);
chart.setPinchZoom(true);
chart.setHighlightEnabled(true);
chart.setHighlightIndicatorEnabled(true);
chart.animateXY(3000, 3000);
return rootView;
}
示例14: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View V = inflater.inflate(R.layout.tide_fragment, container, false);
// Setup the tide chart
LineChart tideChart = (LineChart) V.findViewById(R.id.tide_chart);
tideChart.setDrawBorders(false);
tideChart.setDescription("");
tideChart.setPinchZoom(false);
tideChart.setDoubleTapToZoomEnabled(false);
tideChart.setDrawMarkerViews(false);
tideChart.setTouchEnabled(false);
tideChart.setViewPortOffsets(0f, 0f, 0f, 0f);
// X Axis
XAxis xAxis = tideChart.getXAxis();
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(false);
xAxis.setDrawLabels(false);
// Y Axis
YAxis leftYAxis = tideChart.getAxisLeft();
YAxis rightYAxis = tideChart.getAxisRight();
leftYAxis.setDrawGridLines(false);
rightYAxis.setDrawGridLines(false);
leftYAxis.setDrawAxisLine(false);
rightYAxis.setDrawAxisLine(false);
leftYAxis.setDrawLabels(false);
rightYAxis.setDrawLabels(false);
leftYAxis.setDrawZeroLine(false);
rightYAxis.setDrawZeroLine(false);
// Legend
tideChart.getLegend().setEnabled(false);
return V;
}
示例15: setupChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void setupChart(LineChart chart, LineData data, int color) {
((LineDataSet) data.getDataSetByIndex(0)).setCircleColorHole(color);
// no description text
chart.getDescription().setEnabled(false);
// mChart.setDrawHorizontalGrid(false);
//
// enable / disable grid background
chart.setDrawGridBackground(false);
// chart.getRenderer().getGridPaint().setGridColor(Color.WHITE & 0x70FFFFFF);
// enable touch gestures
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setBackgroundColor(color);
// set custom chart offsets (automatic offset calculation is hereby disabled)
chart.setViewPortOffsets(10, 0, 10, 0);
// add data
chart.setData(data);
// get the legend (only possible after setting data)
Legend l = chart.getLegend();
l.setEnabled(false);
chart.getAxisLeft().setEnabled(false);
chart.getAxisLeft().setSpaceTop(40);
chart.getAxisLeft().setSpaceBottom(40);
chart.getAxisRight().setEnabled(false);
chart.getXAxis().setEnabled(false);
// animate calls invalidate()...
chart.animateX(2500);
}