Git Product home page Git Product logo

dvlinechart's Introduction

DVLineChart

A Simple LineChartView For Simple data statistics

img

简单描述

这是一个使用时比较简单的一个图表,可以自定义多个属性,可以滚动显示图表,并且支持“点”和“点处文字”的点击事件,两个点击时间调用同一个方法(主要是点比较小,难以选中,所以将“点处文字”添加了上去,使其可以点击),双击缩小,变大,缩放。字体、颜色、间隙这些属性就不给大家介绍了,介绍些其他属性的作用,若有疑问,可以参照Demo

####x轴数据<DVLineChartView.h>

/**
 *  x轴的文字集合
 */
@property (strong, nonatomic) NSArray *xAxisTitleArray;


  • x轴的数据就是从上面的数组属性中取出的

####y轴数据<DVLineChartView.h>

/**
 *  y轴的最大值
 */
@property (assign, nonatomic) CGFloat yAxisMaxValue;
/**
 *  y轴分为几段(默认5)
 */
@property (assign, nonatomic) int numberOfYAxisElements;


  • y轴的数据是由y轴的一个最大值和y轴需要分为几段来确定的

####坐标点数据<DVPlot.h>

/**
 *  坐标点数组
 */
@property (strong, nonatomic) NSArray *pointArray;
/**
 *  是否将颜色充满图表
 */
@property (assign, nonatomic, getter=isChartViewFill) BOOL chartViewFill;


  • 坐标点是通过上面这个数组中的数据来画出来的
  • 下面的BOOL值代表的是“是否要给图表下面填充颜色”

####设置图表背景颜色


/**
 *  视图的背景颜色
 */
@property (strong, nonatomic) UIColor *backColor;


####横向分割线是否显示(横向分割线颜色)<DVLineChartView.h>

/**
 *  是否显示横向分割线
 */
@property (assign, nonatomic, getter=isShowSeparate) BOOL showSeparate;

/**
 *  横向分割线的颜色
 */
@property (strong, nonatomic) UIColor *separateColor;

####是否显示坐标点处的文字


/**
 *  是否显示点Label
 */
@property (assign, nonatomic, getter=isShowPointLabel) BOOL showPointLabel;

####y轴和屏幕左侧的距离


/**
 *  y轴与左侧的间距
 */
@property (assign, nonatomic) CGFloat yAxisViewWidth;

####如果数值是百分比数值

/**
 *  y轴数值是否添加百分号(if the number you need to show is percentage value, you can through this property to control it. default is NO)
 */
@property (assign, nonatomic, getter=isPercent) BOOL percent;
  • 当传入的数值是百分比数值时,通过这个属性来添加百分号 ####坐标点是否添加点击事件

/**
 *  点是否允许点击
 */
@property (assign, nonatomic, getter=isPointUserInteractionEnabled) BOOL pointUserInteractionEnabled;


@property (weak, nonatomic) id<DVLineChartViewDelegate> delegate;


@protocol DVLineChartViewDelegate <NSObject>

@optional
- (void)lineChartView:(DVLineChartView *)lineChartView DidClickPointAtIndex:(NSInteger)index;

@end

####这个图表框架可以支持多条线 img


/**
 *  存放plot的数组
 */
@property (strong, nonatomic) NSMutableArray *plots;

- (void)addPlot:(DVPlot *)plot;
  • 通过上面的方法和属性可以画出多条线出来

####我们可以通过一个索引值来对图表进行定位

/**
 *  定位时的索引值
 */
@property (assign, nonatomic) NSInteger index;
  • 当 index<0 时,无法进行定位

dvlinechart's People

Contributors

firemou avatar

Watchers

James Cloos avatar AFlyLi 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.