Giter Site home page Giter Site logo

androguide / holographlibrary Goto Github PK

View Code? Open in Web Editor NEW
534.0 37.0 184.0 424 KB

Fork of the HoloGraphLibrary by Daniel Nadeau with additionnal features

Home Page: https://bitbucket.org/danielnadeau/holographlibrary

License: Apache License 2.0

Java 100.00%

holographlibrary's Introduction

HoloGraphLibrary

Fork of the HoloGraphLibrary by Daniel Nadeau, with additionnal features

Welcome

This is a library written to allow beautiful graphs and charts to be easily incorporated into your Android application. Included are:

  • LineGraph view
  • BarGraph view
  • PieGraph view
  • MultiSeriesDonutGraph view

LineGraph BarGraph PieGraph MultiSeriesDonutGraph

Usage

LineGraph View

<com.echo.holographlibrary.LineGraph
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/graph"/>
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 View

<com.echo.holographlibrary.BarGraph
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/graph"/>
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("$");

PieGraph View

<com.echo.holographlibrary.PieGraph
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/graph"/>
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);

#MultiSeriesDonutGraph View

<com.echo.holographlibrary.MultiSeriesDonutGraph
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/graph"/>
MultiSeriesDonutGraph mg = (MultiSeriesDonutGraph) v.findViewById(R.id.multiseriesdonutgraph);

MultiSeriesDonutSlice slice = new MultiSeriesDonutSlice();
slice.setColor(Color.parseColor("#99CC00"));
slice.setValue(2);
mg.addSlice(0, slice);
slice = new MultiSeriesDonutSlice();
slice.setColor(Color.parseColor("#FFBB33"));
slice.setValue(3);
mg.addSlice(0, slice);
slice = new MultiSeriesDonutSlice();
slice.setColor(Color.parseColor("#AA66CC"));
slice.setValue(8);
mg.addSlice(0, slice);

slice = new MultiSeriesDonutSlice();
slice.setColor(Color.parseColor("#99CC00"));
slice.setValue(8);
mg.addSlice(1, slice);
slice = new MultiSeriesDonutSlice();
slice.setColor(Color.parseColor("#FFBB33"));
slice.setValue(5);
mg.addSlice(1, slice);
slice = new MultiSeriesDonutSlice();
slice.setColor(Color.parseColor("#AA66CC"));
slice.setValue(3);
mg.addSlice(1, slice);

Have fun!

holographlibrary's People

Contributors

androguide avatar bryant1410 avatar firewood avatar h3r3t1c avatar iamyjx avatar jporsay avatar jsmssu avatar pedronveloso avatar stephenjust avatar tpage-alfresco avatar xarnze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

holographlibrary's Issues

Linegraph on smaller screen resolutions

Hi,
I am using the sample code provided with the line graph, but I am encountering issues when I show the linegraph on devices with smaller screen resolutions ( <= 4'').
Basically the lines and the points look thicker than they should be.
On bigger screens this doesn't happen.
Any ideas?
Thanks.

Graphical issue when there is only one PieSlice

Hello,

When you have only one PieSlice displayed in your PieChart, it displayed a blank area at the top right. To avoid this graphical issue, edit your PieChart.java file at line 50 and change

float padding = 2

to

float padding = slices.size() > 1 ? 2 : 0;

Bar height will become very small when set many bars

since the calculation of max value is the sum of total bars, thus cause bar height become very small when have many bars in the graph.

for (Bar p : points) {
    maxValue += p.getValue();
}
usableHeight * (p.getValue() / maxValue)

What Features?

You claim to have additional features in your fork of the repo, but they are unclear. Please mention them in README.MD, or the Wiki, so we know what extras you have added to the Library.

Question on PieChart slices

Hi,

I would like to display a pie chart with two slices based on the users usage per month.

For example: if usage of the user is 0.92 (and monthly limit is 2)

then two slices have to be represented in the pie chart:

Slice 1: 0.92 in green color
Slice 2: 2 - 0.92 (monthly limit - users usage) in gray color

When I am using percentage for representing it.. It is not displaying correctly. Please help me how to achieve this. Thanks in advance.

Point values.

Hi, can you option to show points values(Y) and set values on X axis?

PieGraph not appearing like in example screenshot

In the example screenshot for the PieGraph, the slices are shown as being equally thick throughout. When I use the PieGraph as shown in the example, I get a chart that has slices with the proper arc lengths, but with the shaded portion simply being a straight line connecting the endpoints of the arc.

Weird PieGraph
vs.
Expected PieGraph

Additionally, is it possible to have the slices actually be slices (i.e., go all the way into the middle) instead of thick line segments? How would that be accomplished?

Publish to Maven Central

Please consider submitting this library to the Maven Central repository. This would make integrating this lib so much easier and hassle free.

The argument of OnBarClickedLister.onClick is wrong.

The argument of OnBarClickedLister.onClick was wrong, when I clicked BarGraph on HoloGraphLibrarySample.

if I click Test1 Graph, index value is '0'.
if I click Test2 Graph, index value is '-1'.
if I click Test3 Graph, index value is '-1'.

I think pattern of Test2 and Test3 Graph is wrong.
if I click Test2 Graph, index value should be '1'.
if I click Test3 Graph, index value should be '2'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.