paragp / achartengine

AChartEngine is a charting library for Android applications. It currently supports the following chart types: line chart area chart scatter chart time chart bar chart pie chart bubble chart doughnut chart range (high-low) bar chart dial chart / gauge combined (any combination of line, cubic line, scatter, bar, range bar, bubble) chart cubic line chart All the above supported chart types can contain multiple series, can be displayed with the X axis horizontally (default) or vertically and support many other custom features. The charts can be built as a view that can be added to a view group or as an intent, such as it can be used to start an activity. The model and the graphing code is well optimized such as it can handle and display huge number of values. AChartEngine is currently at the 1.0.0 release. New chart types will be added in the following releases. Please keep sending your feedback such as we can continually improve this library. Find us on Facebook, too: http://www.facebook.com/achartengine Read a short introduction to AChartEngine here: http://www.javaadvent.com/2012/12/achartengine-charting-library-for.html Another good tutorial can be read here: http://jaxenter.com/effort-free-graphs-on-android-with-achartengine-46199.html
0 stars 1 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