RMMSecurity / achartengine

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

[patch] Width of line in legend does not match width in chart #433

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a line chart
2. use setLineWidth() to change the line width

What is the expected output? What do you see instead?
Would expect the line drawn in the legend to also use the value from 
setLineWidth() but it does not.

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

The following patch fixes the issue for me:

Index: src/org/achartengine/chart/LineChart.java
===================================================================
--- src/org/achartengine/chart/LineChart.java   (revision 567)
+++ src/org/achartengine/chart/LineChart.java   (working copy)
@@ -226,7 +226,10 @@
    */
   public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y,
       int seriesIndex, Paint paint) {
+    float oldWidth = paint.getStrokeWidth();
+    paint.setStrokeWidth(((XYSeriesRenderer)renderer).getLineWidth());
     canvas.drawLine(x, y, x + SHAPE_WIDTH, y, paint);
+    paint.setStrokeWidth(oldWidth);
     if (isRenderPoints(renderer)) {
       pointsChart.drawLegendShape(canvas, renderer, x + 5, y, seriesIndex, paint);
     }

Original issue reported on code.google.com by william....@gmail.com on 9 Sep 2014 at 10:49

GoogleCodeExporter commented 9 years ago
Thanks.

Original comment by dandrome...@gmail.com on 16 Sep 2014 at 7:12