GithubHelp home page GithubHelp logo

khikmat / hellocharts-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lecho/hellocharts-android

0.0 1.0 0.0 4.6 MB

Charts/graphs library for Android compatible with API 8+, few chart types with animations

License: Apache License 2.0

hellocharts-android's Introduction

#HelloCharts for Android

Charting library for Android compatible with API 8+(Android 2.2). Works best when hardware acceleration is available, so API 14+(Android 4.0) is recommended. Apache License 2.0.

##Features

  • Line chart(cubic lines, filled lines, scattered points)
  • Column chart(grouped, stacked, negative values)
  • Pie chart
  • Bubble chart
  • Combo chart(columns/lines)
  • Preview charts(for column chart and line chart)
  • Zoom(pinch to zoom, double tap zoom), scroll and fling
  • Custom and auto-generated axes(top, bottom, left, right, inside)
  • Animations

##Screens and Demos

  • Code of a demo application is in hellocharts-samples directory.
  • The demo app is also ready for download on Google Play.
  • Short video is available on YouTube.

##Download and Import

###Eclipse/ADT

  • download hellocharts-library-.jar from releases page and copy it into the libs folder of your application project.

or

  • download/clone repository and import hellocharts-library project into your workspace: File -> Import -> Android -> Existing Android Code and select hellocharts-library directory. Right click on application project Properties -> Android -> Add and select hellocharts library project.

###Android Studio/Gradle

  • download/clone repository and import hellocharts-library as module: File -> Import Module and select hellocharts-library directory. Add dependency:
    compile project(':hellocharts-library')

or

  • download/clone repository and publish library artifact into your local or remote repository. Go to hellocharts-library directory and execute gradle clean build publishToMavenLocal to publish to maven local repository. Go to hellocharts-library directory and execute gradle clean build publish to publish to other repository configured in build.gradle(you need to modify repository url and credentials in build.gradle file). Add dependency:
    compile 'lecho.lib.hellocharts:hellocharts-library:1.0@aar'
    compile 'com.android.support:support-v4:20+'

##Usage

Every chart view can be defined in layout xml file:

   <lecho.lib.hellocharts.view.LineChartView
       android:id="@+id/chart"
       android:layout_width="match_parent"
       android:layout_height="match_parent" />

or created in code and added to layout later:

   LineChartView chart = new LineChartView(context);
   layout.addView(chart);

Use methods from *Chart classes to define chart behaviour, example methods:

   Chart.setInteractive(boolean isInteractive);
   Chart.setZoomType(ZoomType zoomType);
   Chart.setContainerScrollEnabled(boolean isEnabled, ContainerScrollType type);

Use methods from data models to define how chart looks like, example methods:

   ChartData.setAxisXBottom(Axis axisX);
   ColumnChartData.setStacked(boolean isStacked);
   Line.setStrokeWidth(int strokeWidthDp);

Every chart has its own method to set chart data and its own data model, example for line chart:

   List<PointValue> values = new ArrayList<PointValue>();
   values.add(new PointValue(0, 2));
   values.add(new PointValue(1, 4));
   values.add(new PointValue(2, 3));
   values.add(new PointValue(3, 4));

   //In most cased you can call data model methods in builder-pattern-like manner.
   Line line = new Line(values).setColor(Color.Blue).setCubic(true);
   List<Line> lines = new ArrayList<Line>();
   lines.add(line);

   LineChartData data = new LineChartData();
   data.setLines(lines);

   LineChartView chart = new LineChartView(context);
   chart.setLineChartData(data);

After the chart data has been set you can still modify its attributes but right after that you should call set*ChartData() method again to let chart recalculate and redraw data. There is also an option to use copy constructor for deep copy of chart data. You can safely modify copy in other threads and pass it to set*ChartData() method later.

#License

HelloCharts	
Copyright 2014 Leszek Wach

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

 HelloCharts library uses code from InteractiveChart sample available 
 on Android Developers page:
 
   http://developer.android.com/training/gestures/scale.html

hellocharts-android's People

Contributors

lecho avatar

Watchers

 avatar

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.