[Library][Fork] HoloGraphLibrary

Search This thread

Androguide.fr

Senior Member
Jul 21, 2012
2,056
7,229
Lyon, France
androguide.fr
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 :
    zzr.png


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:

13+-+1
13+-+3
13+-+5



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.
 

Attachments

  • Screenshot_2013-07-09-22-59-46.jpg
    Screenshot_2013-07-09-22-59-46.jpg
    26.1 KB · Views: 1,247
Last edited:

generalu

New member
Jun 30, 2013
4
1
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.
 
  • Like
Reactions: Androguide.fr

mickru

Member
Nov 18, 2011
19
16
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

Senior Member
Jul 21, 2012
2,056
7,229
Lyon, France
androguide.fr
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
 
Last edited:
  • Like
Reactions: mickru

H3R3T1C

Senior Member
Mar 8, 2012
465
1,757
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.
eyz5Fc3l.png
 
  • Like
Reactions: Androguide.fr

HAL2001ASO

New member
Jul 4, 2013
3
1
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!:good:
 
  • Like
Reactions: Androguide.fr

gravis502

Senior Member
Nov 27, 2012
166
18
Istanbul
I there anyone figured out how to add bars to barGraph in a loop ? I click on a item from a listview in left slidingmenu, then retrieve data by this dateItem from database and put values in to arrays. than in a loop, I add bar data to points, and eventually setting this points as bars. But graph doesn't changes. anyone got idea ?
 
Last edited:

Nagash.be

New member
Oct 6, 2011
2
0
Wow, I have been using this lib and I had to do what you have done for showing some other units.
But this lib has a strange behavior in some devices, it's like it doesn't get the screen sizes or layout sizes correctly and shows out of scale characters and wierd shapes on pie charts sometimes (I'm talking about the original HoloGraph lib).

Someone has an a idea of why this happens?
 

ms_b

New member
Nov 29, 2010
1
0
Help using your lib

Hi,

I downloaded your library and sample project from Github but when I'm not able to see the jar file under the library folder. Can you please tell me how to use your library?

Thanks
 

yogi.306

Senior Member
Mar 16, 2013
1,141
559
36
Mumbai
www.yogeshdama.com
is there is any onclick listner or event trigrring on click

Hi,

This is realy looking very clean and nice UI graph presentation, i am going to use it in my next project, but before that want ot confirm that,
does it supports events, i mean i want to give an option like drill down for detail reports.
so like on home page, just bar or pie chart with data, and on click of any of the bar, i can open the other activity with Detail information on the selected bar. is it possible to do that using this Lib ???

anyway i will be trying by myself in some time and post my findings.
 

zen kun

Senior Member
Jan 23, 2010
1,874
387
Mexico City
forum.xda-developers.com
Hi,

This is realy looking very clean and nice UI graph presentation, i am going to use it in my next project, but before that want ot confirm that,
does it supports events, i mean i want to give an option like drill down for detail reports.
so like on home page, just bar or pie chart with data, and on click of any of the bar, i can open the other activity with Detail information on the selected bar. is it possible to do that using this Lib ???

anyway i will be trying by myself in some time and post my findings.

Amazing library, anyone knows how many "lines" its the max to draw? im using LineGraph, but seems dont draw all the lines i need, so what should i do? Thanks
 

lockzackary

Senior Member
Jan 24, 2011
147
10
San Pedro
Hi, can I ask if its possible to add a feature where you can click on the individual bars on a Bar Graph? A simple click listener for the bars will do, I just need to display more detail per point in the bar.
Thanks a lot for your library.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    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 :
      zzr.png


    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:

    13+-+1
    13+-+3
    13+-+5



    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.
    1
    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.
    1
    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
    1
    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.
    eyz5Fc3l.png
    1
    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!:good:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone