本文讲述了Android MPAndroidChart开源库图表之折线图的实例代码。分享给大家供大家参考,具体如下:
承接上一篇文章,请参考Android HelloChart开源库图表之折线图的实例代码
1。将mpandroidchartlibrary-2-0-8。jar包复制到项目的库中,
2。定义xml文件。
包com.example.mpandroidlinechart;
进口java.util.ArrayList;
进口com.github.mikephil.charting.charts.LineChart;
进口com.github.mikephil.charting.components.Legend;
进口com.github.mikephil.charting.components.Legend.LegendForm;
进口com.github.mikephil.charting.data.Entry;
进口com.github.mikephil.charting.data.LineData;
进口com.github.mikephil.charting.data.LineDataSet;
进口android.support.v7.app.ActionBarActivity;
进口android.graphics.Color;
进口android.os.Bundle;
公开课MainActivity延伸ActionBarActivity {
私人LineChart mLineChart;//私人字体mTf;
@Override
保护无效alt=" Android MPAndroidChart开源库图表之折线图的实例代码”>
折线图还有另外一种表现形式,就是折线平滑,然后折线与X轴之间可以任意填充自己想要的颜色,其实就是一些属性设置的问题,代码如下:
在上面的getLineData()函数中添加自己的设置: