1

I've tried to make a colored bar Chart. The Color depends on the Y-Value.

mSeriesBarGraph.setValueDependentColor(new ValueDependentColor<DataPoint>()
{
    @Override
    public int get(DataPoint data)
    {
        maxVAL = 65535;
        int n = (int)(data.getY()*100/maxVAL);
        int max_value = 100;

        int r = (255 * (max_value-n))/max_value;
        int g = (255 * n)/max_value;
        int b = 0;
        float[] hsv = new float[3];
        Color.RGBToHSV(g,r,b,hsv);

        return Color.HSVToColor(hsv);
    }
});

I'm transforming the RGB Color to a HSV Color, but the return is RGB again, I'm right? What I want is a Color range from green to red in HSV not RGB (HSV: 0...120°).

The one at the bottom

reference

Community
  • 1
  • 1

0 Answers0