高度自定義圖表庫HLChartView
chart gif GitHub地址HLChartView
cocoa pods 使用
pod 'HLChartView'
1.折線圖或曲線圖 HLLineChartView
/** y軸值,必傳 */
@property(nonatomic,strong) NSArray*yValueLabels;
/** x軸座標,必傳 */
@property(nonatomic,strong) NSArray*xLabels
如何使用
HLLineChartView *lineChartView = [[HLLineChartView alloc]initWithFrame:CGRectMake(0, 100, kScreen_Width, 300)];
NSArray *arr1 = @[@"3",@"4.3",@"10.2",@"5",@"15",@"3",@"4.3",@"10.2",@"5",@"1"];
NSArray *arr2 = @[@"2",@"6.3",@"6.2",@"15",@"10",@"2",@"14.3",@"5.2",@"11",@"4"];
HLLineChartData *data1 = [HLLineChartData lineChartDataWithValuesArray:arr1 lineColor:[UIColor redColor]];
data1.yValuesColor = [UIColor greenColor];
data1.lineWidth = 3.0f;
data1.circleSize = 5;
data1.circleType = HLLineDataCircleTypeCircle;
HLLineChartData *data2 = [HLLineChartData lineChartDataWithValuesArray:arr2 lineColor:[UIColor blueColor]];
lineChartView.yValueLabels = @[data1,data2];
lineChartView.xLabels = @[@"中通快遞123",@"圓通快遞1",@"順豐快遞1222222222222222222222222",@"郵政快遞2111",@"韻達快遞22222",@"中通快遞11111",@"圓通快遞",@"順豐快遞",@"郵政快遞",@"韻達快遞"];
[self.view addSubview:lineChartView];
lineChartView.yLablesColor = [UIColor greenColor];
lineChartView.xLabelsColor = [UIColor blueColor];
// lineChartView.lineChartType = HLLineChartTypeBrokenLine;
lineChartView.ySepLabelCount = 10;
// lineChartView.xLabelsWidth = 30;
// lineChartView.xLabelsHeight = 20;
// lineChartView.lineColor = [UIColor brownColor];
// lineChartView.isHideYLabels = YES;
// lineChartView.isHideXLables = YES;
lineChartView.isShowGradientColor = NO;
// lineChartView.isShowXSepratorLine = NO;
// lineChartView.isShowYSepratorLine = NO;
// lineChartView.isAnimatedDisplay = NO;
[lineChartView strokeStart];
2.餅圖HLPieChartView
如何使用
HLPieChartData *data1 = [HLPieChartData pieDataWithValue:@"20" pieChartColor:[UIColor redColor] detailText:@"中通快遞"];
HLPieChartData *data2 = [HLPieChartData pieDataWithValue:@"10.2" pieChartColor:[UIColor blueColor] detailText:@"韻達快遞"];
HLPieChartData *data3 = [HLPieChartData pieDataWithValue:@"30.33" pieChartColor:[UIColor purpleColor] detailText:@"圓通快遞"];
HLPieChartData *data4 = [HLPieChartData pieDataWithValue:@"5" pieChartColor:[UIColor greenColor] detailText:@"順豐快遞"];
HLPieChartData *data5 = [HLPieChartData pieDataWithValue:@"8" pieChartColor:[UIColor cyanColor] detailText:@"郵政快遞"];
HLPieChartView *pieChart = [[HLPieChartView alloc]initWithFrame:CGRectMake(0, 64, kScreen_Width, kScreen_Width)];
pieChart.pieDatas = @[data1,data2,data3,data4,data5];
pieChart.outerCircleRadius = 120;
pieChart.interCircleRadius = 40;
// pieChart.isAnimatedDisplay = NO;
pieChart.lengendPosition = HLPieLengendPositionBottom;
// pieChart.pieDetailTextType = HLPieDetailTextTypeValue;
// pieChart.showLengendView = NO;
pieChart.titleText = @"這是今天收到的快遞";
[pieChart strokeStart];
[self.view addSubview:pieChart];
3.可自定義單級多級柱狀圖
如何使用
HLHistogramData *data1 = [HLHistogramData histogramDataWithValue:@"100" histogramColor:[UIColor redColor]];
HLHistogramData *data2 = [HLHistogramData histogramDataWithValue:@"30" histogramColor:[UIColor blueColor]];
HLHistogramData *data3 = [HLHistogramData histogramDataWithValue:@"50" histogramColor:[UIColor greenColor]];
HLHistogramData *data4 = [HLHistogramData histogramDataWithValue:@"120" histogramColor:[UIColor purpleColor]];
HLHistogramData *data11 = [HLHistogramData histogramDataWithValue:@"80" histogramColor:[UIColor redColor]];
HLHistogramData *data22 = [HLHistogramData histogramDataWithValue:@"20" histogramColor:[UIColor blueColor]];
HLHistogramData *data33 = [HLHistogramData histogramDataWithValue:@"165" histogramColor:[UIColor greenColor]];
HLHistogramData *data44 = [HLHistogramData histogramDataWithValue:@"60" histogramColor:[UIColor purpleColor]];
HLHistogramView *histogramView = [[HLHistogramView alloc]initWithFrame:CGRectMake(0, 100, kScreen_Width, 300)];
histogramView.yValueLabels = @[@[data1,data2,data3],@[data1,data2,data3,data4],@[data11,data22],@[data33,data44],@[data11,data22,data33,data44],@[data1,data2,data33,data44]];
histogramView.xLabels = @[@"1月底層、架構、音視訊、逆向",@"2月底視訊逆向",@"3月底層、音視訊、逆向",@"4月底層、音視訊、逆向",@"5月底層、架構、音視訊、逆向",@"6月底層"];
histogramView.xHistogramMinGap = 0;
// histogramView.xHistogramMaxGap = 40;
// histogramView.histogramWidth = 30;
// histogramView.ySepLabelCount = 6;
// histogramView.yLabelWidth = 50;
[histogramView strokeStart];
[self.view addSubview:histogramView];
使用問題,請賜教,萬分感謝
相關文章
- 高度自定義的STDPickerViewView
- iOS 自定義tableView Cell、高度自適應iOSView
- (Android自定義控制元件)Android自定義狀態提示圖表Android控制元件
- SVG 菜鳥的 Recharts 自定義圖表實戰SVGEcharts
- c#WinFrom自定義圖表儀表控制元件-頻譜C#控制元件
- 自定義儀表盤
- 自定義圖示列表
- Datazen自定義地圖地圖
- VBA中用自定義函式在工作表中新增動態圖表函式
- 自定義 Cocoapods 庫
- Flink 自定義維表
- elementUI table 自定義表頭UI
- 自定義SAP功能表
- Laravel 自定義表單驗證-自定義驗證規則Laravel
- 自定義餅狀圖(二)
- 自定義餅狀圖(一)
- 自定義條柱圖(二)
- 自定義條柱圖(一)
- 建立自定義標籤庫
- elementUI 2.0.11自定義表頭UI
- Layui 自定義表單驗證UI
- PHPCMS自定義表單樣式PHP
- 織夢 自定義表單HTML:HTML
- wordpress 自定義登入表單
- Android圖解建立外部lib庫及自定義ViewAndroid圖解View
- Android 自定義本地圖片載入庫,仿微信相簿Android地圖
- dcat-admin如何自定義donut圖表的formatter閉包ORM
- Vue富文字帶圖片修改圖片大小自定義選擇項自定義字型Vue自定義字型
- 自定義上傳圖片拼圖遊戲遊戲
- 6.自定義圖片剪下
- Win10如何自定義硬碟圖示_win10自定義硬碟圖示的教程Win10硬碟
- Android 通知欄顯示自定義通知時設定更高的高度Android
- 關於自定義標籤庫
- 有關自定義標籤庫
- 小程式自定義表單校驗
- java 自定義表單設計方案Java
- bootstrap中使用wtform,自定義表單bootORM
- openfire使用自定義使用者表