gpt4 book ai didi

Android MPchart饼图图例设置自定义错误

转载 作者:行者123 更新时间:2023-11-29 01:11:15 25 4
gpt4 key购买 nike

我正在使用 MPchart 饼图。当我设置自定义图例数组时,它不接受该数组。

我的代码...

Legend l = chart.getLegend();
l.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "aaaaa", "bbbbb", "ccccc"});

错误...

Cannot resolve method 'setCustom(int[],java.lang.String[])'

我的 MPchart 版本:v3.0.0

我该如何解决这个问题?

最佳答案

这对我设置自定义图例很有帮助:

 // Use Legend Entry

LegendEntry l1=new LegendEntry("Bank", Legend.LegendForm.DEFAULT,10f,2f,null, Color.RED);
LegendEntry l2=new LegendEntry("Chitfund", Legend.LegendForm.CIRCLE,10f,2f,null, Color.GREEN);
LegendEntry l3=new LegendEntry("Mobile", Legend.LegendForm.LINE,10f,1f,null,Color.BLACK);
LegendEntry l4=new LegendEntry("Internet", Legend.LegendForm.DEFAULT,10f,2f,null, Color.BLUE);
LegendEntry l5=new LegendEntry("ATM", Legend.LegendForm.DEFAULT,10f,2f,null, Color.DKGRAY);
LegendEntry l6=new LegendEntry("Check", Legend.LegendForm.SQUARE,10f,1f,null,Color.CYAN);

Legend l=piechart.getLegend();
l.setCustom(new LegendEntry[]{l1,l2,l3,l4,l5,l6});

//For set the same color to chart
piedataSet.setColors(new int[]{Color.RED, Color.GREEN, Color.BLACK, Color.BLUE, Color.DKGRAY, Color.CYAN});//Color is set based on your Legend entry color

图例入口参数说明:

 LegendEntry l1=new LegendEntry("Bank", Legend.LegendForm.DEFAULT,10f,2f,null, Color.RED);

Parameter Example
--------------------------------------------------------

legend label - "Bank"
legend form - Legend.LegendForm.DEFAULT[ (DEFAULT Shape is Square) Default instead of any (like Square, circle, line)]
formsize - 10f,2f [height of the width]
dashboard effect - null
color - Color.RED

关于Android MPchart饼图图例设置自定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42802952/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com