小编noo*_*oob的帖子

MPAndroidChart - 网格线和限制线在后台不断闪烁

我正在尝试使用 MPAndroidChart 库绘制实时图表。虽然我成功地绘制了图形,但在绘制图形时网格线和限制线不断闪烁。

LineData data = myGraph.getData();

if (data != null) {
    LineDataSet set = data.getDataSetByIndex(0);

    if (set == null) {
        set = createSet();
        data.addDataSet(set);
    }
    // add a new x-value first
    DecimalFormat df = new DecimalFormat("#.0");
    String xVal = df.format(theRunningTime);
    data.addXValue(xVal+"s");
    data.addEntry(new Entry( yValue, set.getEntryCount()), 0);

    // let the chart know it's data has changed
    audioGraph.notifyDataSetChanged();
    audioGraph.invalidate();
}
Run Code Online (Sandbox Code Playgroud)

下面的代码介绍了图中的限制线

YAxis yl = myGraph.getAxisLeft();
yl.setTextColor(Color.WHITE);
yl.setTextSize(8f);
yl.setAxisMinValue(0);
yl.setDrawGridLines(false);
yl.setDrawAxisLine(true);
yl.setValueFormatter(new MyValueFormatter());     
yl.setStartAtZero(true);
//Remove any previous limit lines
yl.removeAllLimitLines();

LimitLine ll …
Run Code Online (Sandbox Code Playgroud)

android mpandroidchart

5
推荐指数
0
解决办法
1941
查看次数

标签 统计

android ×1

mpandroidchart ×1