本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.animateY方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.animateY方法的具体用法?Java LineChart.animateY怎么用?Java LineChart.animateY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.animateY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
Bundle extras = this.getIntent().getExtras();
if (extras != null && extras.getBoolean("stop", true)) {
this.finish();
}
gsonstringobject();
// Inflate the layout that we're using for the watch face
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myLayout = inflater.inflate(R.layout.wear_drip_watchface_layout, null);
LineChart lineChart = (LineChart) myLayout.findViewById(R.id.chart);
lineChart.setDescription("");
lineChart.setNoDataTextDescription("You need to provide data for the chart.");
ArrayList<Entry> entries = new ArrayList<>();
entries.add(new Entry(4f, 0));
entries.add(new Entry(8f, 1));
entries.add(new Entry(6f, 2));
entries.add(new Entry(2f, 3));
entries.add(new Entry(18f, 4));
entries.add(new Entry(9f, 5));
LineDataSet dataset = new LineDataSet(entries, "# of Calls");
ArrayList<String> labels = new ArrayList<String>();
labels.add("January");
labels.add("February");
labels.add("March");
labels.add("April");
labels.add("May");
labels.add("June");
LineData data = new LineData(labels, dataset);
//dataset.setColors(ColorTemplate.COLORFUL_COLORS);
//dataset.setColors(ColorTemplate.VORDIPLOM_COLORS);
//dataset.setColors(ColorTemplate.JOYFUL_COLORS);
dataset.setColors(ColorTemplate.LIBERTY_COLORS);
//dataset.setColors(ColorTemplate.PASTEL_COLORS);
dataset.setDrawCubic(true);
dataset.setDrawFilled(true);
dataset.setDrawCircles(false);
dataset.setDrawValues(false);
lineChart.setPinchZoom(false);
lineChart.setDragEnabled(false);
lineChart.setScaleEnabled(false);
lineChart.setDrawGridBackground(false);
lineChart.setTouchEnabled(false);
lineChart.setData(data);
lineChart.animateY(5000);
// get the legend (only possible after setting data)
Legend l = lineChart.getLegend();
l.setEnabled(false);
XAxis xl = lineChart.getXAxis();
xl.setDrawGridLines(true);
xl.setEnabled(false);
YAxis leftAxis = lineChart.getAxisLeft();
leftAxis.setDrawGridLines(false);
YAxis rightAxis = lineChart.getAxisRight();
rightAxis.setEnabled(false);
}