MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Changing the color of the x-axis label text

Open MasonDarcy opened this issue 6 years ago • 3 comments

I have tried the following in Kotlin, with multiple different colors.

  1. chart.xAxis.textColor = R.color.white

The text changes color very slightly, but never to the correct color. It becomes a purplish blue, has anyone else had this problem? I recreated a small test app just with the graph to test it again, it's just a fragment with the single graph view.

private fun setupGraph() { var entry = Entry(1F, 1F) entries.add(entry) graph_bac.xAxis.textColor = R.color.white graph_bac.data = LineData(LineDataSet(entries, "test")) var xAxis = graph_bac.xAxis xAxis.axisMinimum = 0F xAxis.axisMaximum = 10F xAxis.granularity = 1F xAxis.position = XAxis.XAxisPosition.BOTTOM graph_bac.notifyDataSetChanged() graph_bac.invalidate() }

MasonDarcy avatar Jul 26 '20 14:07 MasonDarcy

Use Context.getResource.getColor(...)

daniel098962 avatar Aug 07 '20 03:08 daniel098962

Thank-you that worked

MasonDarcy avatar Aug 07 '20 18:08 MasonDarcy

Thank You mate

vickypathak123 avatar Jul 12 '21 07:07 vickypathak123