【问题标题】:Remove seperator lines on Android Plot Pie Chart删除 Android Plot Pie Chart 上的分隔线
【发布时间】:2014-06-30 22:08:55
【问题描述】:

我使用 android plot pie chart 在我的应用程序中绘制数据。我的问题是饼图中的分隔线(如下图所示)。无论我如何设置图表,我似乎都无法摆脱黑线。

我是这样设置的:

//Sets up the pie chart to display the user beer ratings figures visually
private void chartSetup(PieChart p){

    PieWidget pw = p.getPieWidget();

    pw.setPadding(0,0,0,0);

    SegmentFormatter sf1 = new SegmentFormatter();
    sf1.configure(getActivity(),R.xml.pie_segment_formatter1);

    sf1.getFillPaint();

    SegmentFormatter sf2 = new SegmentFormatter();

    sf2.configure(getActivity(), R.xml.pie_segment_formatter2);
    sf2.getFillPaint();

    Segment monthly = new Segment("", totalBeerCount);
    Segment total = new Segment("", monthlyBeerCount);

    p.setPlotMarginBottom(0);

    p.addSegment(monthly, sf1);
    p.addSegment(total, sf2);
    p.redraw();
    p.getBorderPaint().setColor(Color.TRANSPARENT);
    p.getBackgroundPaint().setColor(Color.TRANSPARENT);

    p.getRenderer(PieRenderer.class).setDonutSize(.90f, PieRenderer.DonutMode.PERCENT);
}

这是两个段格式化程序 xml 文件:

pie_segment_formatter1

<?xml version="1.0" encoding="utf-8"?>
<config
    fillPaint.color="@color/appRed"
    labelPaint.textSize="5dp"
    innerEdgePaint.color = "@color/appRed"
    outerEdgePaint.color = "@color/appRed"/>

pie_segment_formatter2

<?xml version="1.0" encoding="utf-8"?>
<config
    fillPaint.color="@color/lightGrey"
    labelPaint.textSize="5dp"
    innerEdgePaint.color = "@color/lightGrey"
    outerEdgePaint.color = "@color/lightGrey"/>

我已经尝试在配置文件中包含linePaint.strokeWidth="0dp",但这并没有任何区别。如果有人能在这方面帮助我,我将不胜感激。

【问题讨论】:

    标签: android charts pie-chart androidplot


    【解决方案1】:

    您正在寻找的是用于绘制径向边缘的油漆。将此行添加到您的每个格式化程序 xml cfgs:

    radialEdgePaint.color="#00000000"
    

    或在您的 Java 源代码中以编程方式:

    formatter.setRadialEdgePaint(null);
    

    【讨论】:

    • 优秀..当你知道怎么做时很容易!谢谢
    猜你喜欢
    • 2011-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-12
    • 2011-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多