5,605,373 Members 42,136 Now Online
XDA Developers Android and Mobile Development Forum

[Library][Fork] HoloGraphLibrary

Tip us?
 
Androguide.fr
Old
(Last edited by Androguide.fr; 25th July 2013 at 04:45 PM.)
#1  
Androguide.fr's Avatar
Recognized Contributor - OP
Thanks Meter 6650
Posts: 2,005
Join Date: Jul 2012
Location: Lyon, France

 
DONATE TO ME
Default [Library][Fork] HoloGraphLibrary

If you need to display graphs and/or charts in your application in a stylish, holo-compliant way, this is your go-to library.

I especially needed the BarGraph view for a project I am preparing for the Samsung Smart App Challenge 2013, but unfortunately, the base library by Daniel Nadeau was hardcoding the prepended $ unit, while my project requires several different other units to be displayed.

So I forked the library and added a couple features (I will be adding more over time), so I thought I would share:
  • Defining the unit programmatically, using BarGraph.setUnit(String unit)
    Code:
    // Example
    BarGraph bg = (BarGraph) findViewById(R.id.bargraph);
    bg.setUnit("m");
  • Appending or prepending the unit programmatically using #BarGraph.appendUnit(Boolean doAppend)
    Code:
    // Example
    BarGraph bg = (BarGraph) findViewById(R.id.bargraph);
    bg.appendUnit(true);
  • ==> The result would be :
     


Additionnally, I converted the library for proper compatibility with Gradle & Android Studio (IntelliJ).
You can find my fork on Github at the following url: https://github.com/Androguide/HoloGraphLibrary

If you haven't heard of this library before, it currently offers the following views:




You can use them in your project as follows:
  • LineGraph:
    XML
    Code:
    <com.echo.holographlibrary.LineGraph
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:id="@+id/graph" />
    Java
    Code:
    Line l = new Line();
    LinePoint p = new LinePoint();
    p.setX(0);
    p.setY(5);
    l.addPoint(p);
    p = new LinePoint();
    p.setX(8);
    p.setY(8);
    l.addPoint(p);
    p = new LinePoint();
    p.setX(10);
    p.setY(4);
    l.addPoint(p);
    l.setColor(Color.parseColor("#FFBB33"));
    
    LineGraph li = (LineGraph)findViewById(R.id.graph);
    li.addLine(l);
    li.setRangeY(0, 10);
    li.setLineToFill(0);
  • BarGraph:
    XML
    Code:
    <com.echo.holographlibrary.BarGraph
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:id="@+id/graph" />
    Java
    Code:
    ArrayList<Bar> points = new ArrayList<Bar>();
    Bar d = new Bar();
    d.setColor(Color.parseColor("#99CC00"));
    d.setName("Test1");
    d.setValue(10);
    Bar d2 = new Bar();
    d2.setColor(Color.parseColor("#FFBB33"));
    d2.setName("Test2");
    d2.setValue(20);
    points.add(d);
    points.add(d2);
    
    BarGraph g = (BarGraph)findViewById(R.id.graph);
    g.setBars(points);
    g.setUnit("$");
    g.appendUnit(true);
  • PieGraph:
    XML
    Code:
    <com.echo.holographlibrary.PieGraph
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:id="@+id/graph" />
    Java
    Code:
    PieGraph pg = (PieGraph)findViewById(R.id.graph);
    PieSlice slice = new PieSlice();
    slice.setColor(Color.parseColor("#99CC00"));
    slice.setValue(2);
    pg.addSlice(slice);
    slice = new PieSlice();
    slice.setColor(Color.parseColor("#FFBB33"));
    slice.setValue(3);
    pg.addSlice(slice);
    slice = new PieSlice();
    slice.setColor(Color.parseColor("#AA66CC"));
    slice.setValue(8);
    pg.addSlice(slice);

If you guys have ideas or feature requests, please share. Pull-requests are obviously welcome.

BTW, anyone else participating in the SSAC this year? The $800k prize-money is mindblowing.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2013-07-09-22-59-46.jpg
Views:	782
Size:	26.1 KB
ID:	2135237  

Quote:
My Contributions
(Apps, Librairies, Roms & Guides)
 

Pimp My Rom: Website / App / Thread

dSploit: Website / Github

Flash Gordon (Flash zips without a recovery): Thread

Universal init.d: App

PlayView/CardsUI Library: Portal / Github

HoloGraph Library: Portal / Github

Ubuntu Touch for i9300: Thread

Omni nightlies for Xperia Z1: Thread

Paranoid Android builds: Thread

Revive your bricked p68xx : Guide
Follow me on Github
The Following 11 Users Say Thank You to Androguide.fr For This Useful Post: [ Click to Expand ]
 
generalu
Old
#2  
Junior Member
Thanks Meter 1
Posts: 4
Join Date: Jun 2013
1st place is $200k. Considering the fact that it's Samsung, I would expect a higher prize, but I guess it's a specific contest with the Chord SDK. The venture capital pitch and marketing promotion are equally valuable imo.
The Following User Says Thank You to generalu For This Useful Post: [ Click to Expand ]
 
H3R3T1C
Old
#3  
H3R3T1C's Avatar
Senior Member
Thanks Meter 1522
Posts: 436
Join Date: Mar 2012

 
DONATE TO ME
This is very cool! Thank you for sharing!
 
mickru
Old
#4  
Junior Member
Thanks Meter 16
Posts: 16
Join Date: Nov 2011
Hi this is a cool library. As you asked for feature requests. How about stacked bar charts. So one is able to show a distribution of values in a group over time or categories?

Gesendet von meinem Nexus 7 mit Tapatalk 4 Beta
 
Androguide.fr
Old
(Last edited by Androguide.fr; 28th July 2013 at 01:40 AM.)
#5  
Androguide.fr's Avatar
Recognized Contributor - OP
Thanks Meter 6650
Posts: 2,005
Join Date: Jul 2012
Location: Lyon, France

 
DONATE TO ME
Quote:
Originally Posted by mickru View Post
Hi this is a cool library. As you asked for feature requests. How about stacked bar charts. So one is able to show a distribution of values in a group over time or categories?

Gesendet von meinem Nexus 7 mit Tapatalk 4 Beta
That's a very good idea, I'll try to implement it as soon as I have some time. Thanks.
I'll also soon add the possibility to add a dynamic line chart, updated every X milliseconds cleanly in a separate thread

Quote:
My Contributions
(Apps, Librairies, Roms & Guides)
 

Pimp My Rom: Website / App / Thread

dSploit: Website / Github

Flash Gordon (Flash zips without a recovery): Thread

Universal init.d: App

PlayView/CardsUI Library: Portal / Github

HoloGraph Library: Portal / Github

Ubuntu Touch for i9300: Thread

Omni nightlies for Xperia Z1: Thread

Paranoid Android builds: Thread

Revive your bricked p68xx : Guide
Follow me on Github
The Following User Says Thank You to Androguide.fr For This Useful Post: [ Click to Expand ]
 
H3R3T1C
Old
#6  
H3R3T1C's Avatar
Senior Member
Thanks Meter 1522
Posts: 436
Join Date: Mar 2012

 
DONATE TO ME
I've added this library to one of my apps that I'm working on. Here is a quick screenshot.
I've had to modify the LineGraph to be able to show the range lines between max and min.
The Following User Says Thank You to H3R3T1C For This Useful Post: [ Click to Expand ]
 
HAL2001ASO
Old
#7  
Junior Member
Thanks Meter 1
Posts: 3
Join Date: Jul 2013
I see a lot more apps and even infographics using the pie graph format. I personally think it looks more clean and easier to digest. I was looking at the challenge you're looking into, and it sounds interesting enough. It might be a perfect opportunity to enter, and just to learn about the whole process of bringing an app to market. We haven't integrated the Chord SDK, but I think it can be easily implemented since our game concept is related to live interactions. I'm more interested in the Venture Capital pitch with Samsung VC - that company has ridiculous amounts of money - it's ridiculous!

Great post!
The Following User Says Thank You to HAL2001ASO For This Useful Post: [ Click to Expand ]
 
Androguide.fr
Old
#8  
Androguide.fr's Avatar
Recognized Contributor - OP
Thanks Meter 6650
Posts: 2,005
Join Date: Jul 2012
Location: Lyon, France

 
DONATE TO ME
Quote:
Originally Posted by H3R3T1C View Post
I've added this library to one of my apps that I'm working on. Here is a quick screenshot.
I've had to modify the LineGraph to be able to show the range lines between max and min.
Nice, very clean UI.
If you feel like submitting a pull-request for your LIneGraph modifications please do so.

Quote:
My Contributions
(Apps, Librairies, Roms & Guides)
 

Pimp My Rom: Website / App / Thread

dSploit: Website / Github

Flash Gordon (Flash zips without a recovery): Thread

Universal init.d: App

PlayView/CardsUI Library: Portal / Github

HoloGraph Library: Portal / Github

Ubuntu Touch for i9300: Thread

Omni nightlies for Xperia Z1: Thread

Paranoid Android builds: Thread

Revive your bricked p68xx : Guide
Follow me on Github
 
H3R3T1C
Old
(Last edited by H3R3T1C; 30th July 2013 at 02:49 AM.)
#9  
H3R3T1C's Avatar
Senior Member
Thanks Meter 1522
Posts: 436
Join Date: Mar 2012

 
DONATE TO ME
Quote:
Originally Posted by Androguide.fr View Post
Nice, very clean UI.
If you feel like submitting a pull-request for your LIneGraph modifications please do so.
I plan on sharing my code for the graph as soon as I clean up the code and add some more stuff !

Edit: pull request sent!
The Following User Says Thank You to H3R3T1C For This Useful Post: [ Click to Expand ]
 
fyska
Old
#10  
fyska's Avatar
Junior Member
Thanks Meter 4
Posts: 22
Join Date: Dec 2010
This looks great - don't have the need for it at the moment but have favourited it for future use! Thanks!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes