Coder Social home page Coder Social logo

cbdgit / smallchart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from colorchenvip/smallchart

0.0 1.0 0.0 1.42 MB

开源的Android图表库,拥有折线图、曲线图(可填充)、柱状图、扇形图、雷达图,共5种图表类型。并且可以组合图表。

License: Apache License 2.0

Java 100.00%

smallchart's Introduction

SmallChart


Introduction

    SmallChart是一个开源的Android图表库,折线图、曲线图(可填充)、柱状图、扇形图、雷达图,共5种图表类型。特色的组合图表可以任意组合折线图、曲线图、柱状图。可以通过输入的数据以及可设置的颜色、画笔大小等属性方便的创建图表。

Version

SdkVersion >= 19

Chart types

  • Curve Chart(fill)

curve

  • bar Chart

bar

  • Line Chart

line

  • Combine Chart

combine

  • PieChart

pie

  • RadarChart

radar

Features

  • 折线图、曲线图(可填充)、柱状图、扇形图、雷达图,共5种图表类型。
  • 组合图表类型,可任意组合折线图、曲线图、柱状图。
  • 折线图、曲线图(可填充)、柱状图、扇形图都拥有绘制动画。
  • 扇形图提供了触控交互效果。

Usage

Gradle

  • Step 1. Add the JitPack repository to your build file
    allprojects {
		repositories {
			...
			maven { url "https://jitpack.io" }
		}
	}
  • Step 2. Add SmallChart
    dependencies {
	        compile 'com.github.Idtk:SmallChart:v0.1.1'
	}

Maven

  • Step 1. Add the JitPack repository to your build file
    <repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
  • Step 2. Add SmallChart
    <dependency>
	    <groupId>com.github.Idtk</groupId>
	    <artifactId>SmallChart</artifactId>
	    <version>v0.1.1</version>
	</dependency>

以组合图表为例

XML

<com.idtk.smallchart.chart.CombineChart
    android:id="@+id/combineChart"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Java

CombineChart combineChart = (CombineChart)view.findViewById(R.id.combineChart);
combineChart.isAnimated = false;
combineChart.setDataList(mDataList);

Data

private CurveData mCurveData = new CurveData();
private ArrayList<PointF> mPointArrayList1 = new ArrayList<>();

private LineData mLineData = new LineData();
private ArrayList<PointF> mPointArrayList2 = new ArrayList<>();

private BarData mBarData = new BarData();
private ArrayList<PointF> mPointArrayList3 = new ArrayList<>();

private ArrayList<IBarLineCurveData> mDataList = new ArrayList<>();
mBarData.setValue(mPointArrayList3);
mBarData.setColor(Color.CYAN);
mBarData.setPaintWidth(pxTodp(5));
mBarData.setTextSize(pxTodp(10));
mDataList.add(mBarData);

mLineData.setValue(mPointArrayList2);
mLineData.setColor(Color.MAGENTA);
mLineData.setPaintWidth(pxTodp(3));
mLineData.setTextSize(pxTodp(10));
mDataList.add(mLineData);

mCurveData.setValue(mPointArrayList1);
mCurveData.setColor(Color.YELLOW);
mCurveData.setPaintWidth(pxTodp(3));
mCurveData.setTextSize(pxTodp(10));
mDataList.add(mCurveData);

其他图表示例请查看Example

License

Copyright (C) 2016 Idtk

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.

About Me

  博客: www.idtkm.com
  GitHub: https://github.com/Idtk
  微博: http://weibo.com/Idtk
  邮箱: [email protected]

smallchart's People

Contributors

idtk 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.