本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.setHighlightPerDragEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setHighlightPerDragEnabled方法的具体用法?Java LineChart.setHighlightPerDragEnabled怎么用?Java LineChart.setHighlightPerDragEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.setHighlightPerDragEnabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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);
}
示例4: 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);
}
示例5: initTemperatureChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initTemperatureChart(LineChart mChart) {
// mChart.setOnChartValueSelectedListener(this);
mChart.setDescription("Skin Temperature");
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.blue_light_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);
}
示例6: 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);
}
示例7: 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_time);
tvX = (TextView) findViewById(R.id.tvXMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setProgress(100);
tvX.setText("100");
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
// no description text
mChart.getDescription().setEnabled(false);
// enable touch gestures
mChart.setTouchEnabled(true);
mChart.setDragDecelerationFrictionCoef(0.9f);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setDrawGridBackground(false);
mChart.setHighlightPerDragEnabled(true);
// set an alternative background color
mChart.setBackgroundColor(Color.WHITE);
mChart.setViewPortOffsets(0f, 0f, 0f, 0f);
// add data
setData(100, 30);
mChart.invalidate();
// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
l.setEnabled(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.TOP_INSIDE);
xAxis.setTypeface(mTfLight);
xAxis.setTextSize(10f);
xAxis.setTextColor(Color.WHITE);
xAxis.setDrawAxisLine(false);
xAxis.setDrawGridLines(true);
xAxis.setTextColor(Color.rgb(255, 192, 56));
xAxis.setCenterAxisLabels(true);
xAxis.setGranularity(1f); // one hour
xAxis.setValueFormatter(new IAxisValueFormatter() {
private SimpleDateFormat mFormat = new SimpleDateFormat("dd MMM HH:mm");
@Override
public String getFormattedValue(float value, AxisBase axis) {
long millis = TimeUnit.HOURS.toMillis((long) value);
return mFormat.format(new Date(millis));
}
});
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
leftAxis.setTypeface(mTfLight);
leftAxis.setTextColor(ColorTemplate.getHoloBlue());
leftAxis.setDrawGridLines(true);
leftAxis.setGranularityEnabled(true);
leftAxis.setAxisMinimum(0f);
leftAxis.setAxisMaximum(170f);
leftAxis.setYOffset(-9f);
leftAxis.setTextColor(Color.rgb(255, 192, 56));
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
}