galaxylang / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

BarChart-Gradient: Wrong Rendering if yValue < GradientStart #422

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a BarChart with values between 5 and 15
2. Enable the Gradient
3. Set GradientStart to 10 and color YELLOW
4. Set GradientStop to 13 and color BLUE

What is the expected output? 
All bars should be displayed with their correct value.
Value <= 10       -> Color is YELLOW
Value >= 13       -> Color is BLUE
Between 10 and 13 -> Color Gradient YELLOW-BLUE

What do you see instead?
If the value of a bar is lower to the GradientStart value (10), it will be 
displayed with value 10 (GradientStart) instead of its own value.

What version of the product binary library are you using?
Revision 567 of the trunk.

Original issue reported on code.google.com by sauberma...@gmail.com on 19 Jul 2014 at 10:37

Attachments:

GoogleCodeExporter commented 9 years ago
I fixed the issue in drawBar in BarChart.java

My fix seems to work. I used "Math.round(Math.max(yMin, maxY)" instead of 
"Math.round(gradientMaxY)"

Line 202ff would be: 
if (yMax > maxY) {
    paint.setColor(gradientMaxColor);
    canvas.drawRect(Math.round(xMin), Math.round(Math.max(yMin, maxY), Math.round(xMax),
       Math.round(yMax), paint);
      }

Original comment by sauberma...@gmail.com on 19 Jul 2014 at 11:03