How to set colors in MPAndroidChart?

后端 未结 2 1151
挽巷
挽巷 2021-02-20 10:13

I\'m using MPChartlib for a basic \"Barchart\" (3 bars and values between 0 and 100).

the background of the app is dark so I\'d like to put the text in white but when I

2条回答
  •  长情又很酷
    2021-02-20 11:10

    You are passing the resource id to the library, not the actual color.

    Use this to get the color:

        int color = ContextCompat.getColor(context, R.color.chart_color);
    
        LineDataSet dataSet = ...;
        dataSet.setColor(color);
    

    You can also find this in the documentation.

提交回复
热议问题