如何在 Android 的 GraphView 中更改 X 和 Y 轴数字的颜色?
How to change X and Y axis numbers' colour in GraphView for Android?
我在我的应用程序中使用 GraphView 来显示来自磁场传感器值的实时图表。
初始化GraphView对象如下:
GraphView graph = findViewById(R.id.graph);
...
并使用以下设置数据系列和网格颜色:
...
graph.addSeries(series);
...
graph.getGridLabelRenderer().setGridColor(Color.RED);
结果我得到了这个。
Graph with numbers I want to change highlited
现在我想把上图中绿色箭头标示的X轴和Y轴数值数字去掉,请问怎么办?如果无法删除它们,我该如何更改它们的字体颜色?我会让它与背景相匹配。
刚刚找到我要找的东西,要禁用沿轴的 X 和 Y 数字,请使用:
graph.getGridLabelRenderer().setVerticalLabelsVisible(false);
graph.getGridLabelRenderer().setHorizontalLabelsVisible(false);
我在我的应用程序中使用 GraphView 来显示来自磁场传感器值的实时图表。
初始化GraphView对象如下:
GraphView graph = findViewById(R.id.graph);
...
并使用以下设置数据系列和网格颜色:
...
graph.addSeries(series);
...
graph.getGridLabelRenderer().setGridColor(Color.RED);
结果我得到了这个。
Graph with numbers I want to change highlited
现在我想把上图中绿色箭头标示的X轴和Y轴数值数字去掉,请问怎么办?如果无法删除它们,我该如何更改它们的字体颜色?我会让它与背景相匹配。
刚刚找到我要找的东西,要禁用沿轴的 X 和 Y 数字,请使用:
graph.getGridLabelRenderer().setVerticalLabelsVisible(false);
graph.getGridLabelRenderer().setHorizontalLabelsVisible(false);