本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.animateXY方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.animateXY方法的具体用法?Java LineChart.animateXY怎么用?Java LineChart.animateXY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.animateXY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例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);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setViewPortOffsets(0, 0, 0, 0);
mChart.setBackgroundColor(Color.rgb(104, 241, 175));
// 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.setDrawGridBackground(false);
mChart.setMaxHighlightDistance(300);
XAxis x = mChart.getXAxis();
x.setEnabled(false);
YAxis y = mChart.getAxisLeft();
y.setTypeface(mTfLight);
y.setLabelCount(6, false);
y.setTextColor(Color.WHITE);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);
mChart.getAxisRight().setEnabled(false);
// add data
setData(45, 100);
mChart.getLegend().setEnabled(false);
mChart.animateXY(2000, 2000);
// dont forget to refresh the drawing
mChart.invalidate();
}
示例4: 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);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setViewPortOffsets(0, 20, 0, 0);
mChart.setBackgroundColor(Color.rgb(104, 241, 175));
// no description text
mChart.setDescription("");
// 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.setDrawGridBackground(false);
tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
XAxis x = mChart.getXAxis();
x.setEnabled(false);
YAxis y = mChart.getAxisLeft();
y.setTypeface(tf);
y.setLabelCount(6, false);
y.setTextColor(Color.WHITE);
y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
y.setDrawGridLines(false);
y.setAxisLineColor(Color.WHITE);
mChart.getAxisRight().setEnabled(false);
// add data
setData(45, 100);
mChart.getLegend().setEnabled(false);
mChart.animateXY(2000, 2000);
// dont forget to refresh the drawing
mChart.invalidate();
}