0

I did managed to draw the graph that i wanted but some how I'm getting rounded end caps at the end of the graph lines.

I wrote my code using the GraphView lib for a series of data using this :

GraphViewSeries line1Series = new GraphViewSeries("LINE ONE", new GraphViewSeriesStyle(Color.BLUE, 100), exampleSeries2); 

How can I change the end cap from rounded to a straight end cap like this one:
https://cloud.githubusercontent.com/assets/7545176/4953542/227d9380-6682-11e4-88fd-4ad1f4a5ac14.png

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
WoW
  • 151
  • 2
  • 10

1 Answers1

0

The easiest thing is probably to clone the project from github and alter the onDraw() method in GraphView.java (line 154 as of now) from:

paint.setStrokeCap(Paint.Cap.ROUND);

to

paint.setStrokeCap(Paint.Cap.BUTT);
th65
  • 188
  • 2
  • 11
  • No im not drawing data points... The rounded cap is caused by the Thickness that is set to 100 as you can see from the code line that i posted...it seems like it's some bug when you set the line thickness to be higher. – WoW Nov 15 '14 at 11:59
  • @WoW Apologies - I see what you mean. Check my edited answer. – th65 Nov 15 '14 at 14:22
  • Thanks for the answer. I did imported the project to eclipse changed the line 154 but how do i add this as a jar file into my current project to check if it's working ? – WoW Nov 15 '14 at 14:36
  • @WoW [This page](http://developer.android.com/tools/projects/projects-eclipse.html) explains how to make your new project into a library project (check the part starting _You can also convert an existing application project into a library_). Further down that page it tells you how to reference that library project in your current project. – th65 Nov 15 '14 at 14:46
  • I added the project as a library to my project but im getting errors like it doesnt recognize : import com.jjoe64.graphview.BarGraphView; – WoW Nov 15 '14 at 15:03
  • Finally it's working without rounded caps ! Thanks alot for the help :) – WoW Nov 15 '14 at 15:23