在MPAndroid Chart(条形图)中更改XAxis上特定值的颜色

时间:2016-04-12 12:41:09

标签: android graph charts mpandroidchart

我想在MPAndroid图表(条形图)中更改所选XAxis的颜色

以下是我的代码。

 XAxis xl = mChart.getXAxis();
 xl.setTypeface(tf);
 xl.setPosition(XAxis.XAxisPosition.BOTTOM);

 s = new String[]{"S", "M", "T", "W", "T", "F", "St"};

 ArrayList<String> xVals = new ArrayList<String>();
        for (int i = 0; i < s.length; i++) {
            xVals.add(s[i]);
        }

选择XAxis的方法

 @Override
    public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {

        Log.i("X val", "Selected X Valu: " + s[h.getXIndex()]);
        if (e == null)
            return;

        RectF bounds = mChart.getBarBounds((BarEntry) e);
        PointF position = mChart.getPosition(e, YAxis.AxisDependency.LEFT);   
    }

选择后,我想更改s[h.getXIndex()]

的颜色

0 个答案:

没有答案