常見設定
// 是否啟用網格背景
mChart.setDrawGridBackground(false);
// 是否繪製 Y 軸標籤
mChart.setDrawYLabels(false);
// 網格垂直線是否顯示
mChart.setDrawVerticalGrid(false);
// Y 軸是否從 0 開始
mChart.setStartAtZero(false);
// 是否在 Y 軸顯示數據值
mChart.setDrawYValues(true);
// 設定邊框
mChart.setDrawBorder(false);
mChart.setBorderPositions(new BarLineChartBase.BorderPosition[]{
BarLineChartBase.BorderPosition.BOTTOM
});
// 設定單位
mChart.setUnit("°C");
// 設定透明度
mChart.setAlpha(0.8f);
X 軸與 Y 軸標籤
XLabels xl = mChart.getXLabels();
xl.setPosition(XLabels.XLabelPosition.BOTTOM);
xl.setTextSize(10f);
xl.setSpaceBetweenLabels(3);
YLabels yl = mChart.getYLabels();
yl.setTextSize(10f);
yl.setLabelCount(5);
動畫與圖例
mChart.animateX(2000);
mChart.animateY(2000);
Legend l = mChart.getLegend();
l.setForm(Legend.LegendForm.LINE);
l.setTextSize(15);
l.setTextColor(Color.rgb(104, 241, 175));
