在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:mruegenberg/ios-linechart开源软件地址:https://github.com/mruegenberg/ios-linechart开源编程语言:Objective-C 97.1%开源软件介绍:ios-linechartInteractive linecharts for the simplicity-loving iOS developer. You just want some linecharts, and Core Plot makes you think Search no more! ios-linechart is here! Features
InstallationCocoaPodsThe best way to get ios-linechart is to use CocoaPods. Without CocoaPodsIf, for some reason, you don't want that, copy the following files into your project:
Additionally, you will need to get some dependencies from the objc-utils project:
Just copy these into you project as well. ios-linechart uses Core Graphics, so you'll need to add Even if you don't use Cocoapods, it is recommended to use an official release, since the repository may be unstable in between releases. Just check out the newest tagged commit. UsageBasic usage can be seen in the demo app contained in the repository. First, import the main header: #import "LCLineChartView.h" Alternatively, you can import the abbreviation header, which provides names without the #import "LineChart.h" Each chart line is contained in a LCLineChartData *d = [LCLineChartData new];
d.xMin = 1;
d.xMax = 31;
d.title = @"The title for the legend";
d.color = [UIColor redColor];
d.itemCount = 10; Additionally, each NSMutableArray *vals = [NSMutableArray new];
for(NSUInteger i = 0; i < d.itemCount; ++i) {
[vals addObject:@((rand() / (float)RAND_MAX) * (31 - 1) + 1)];
}
[vals sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
return [obj1 compare:obj2];
}];
d.getData = ^(NSUInteger item) {
float x = [vals[item] floatValue];
float y = powf(2, x / 7);
NSString *label1 = [NSString stringWithFormat:@"%d", item];
NSString *label2 = [NSString stringWithFormat:@"%f", y];
return [LCLineChartDataItem dataItemWithX:x y:y xLabel:label1 dataLabel:label2];
}; The Note that, to get a coherent chart, the x values for the items should be sorted. This will be the case anyway for most real-world data. Finally, everything is packed up into a LCLineChartView *chartView = [[LCLineChartView alloc] initWithFrame:CGRectMake(20, 700, 500, 300)];
chartView.yMin = 0;
chartView.yMax = powf(2, 31 / 7) + 0.5;
chartView.ySteps = @[@"0.0",
[NSString stringWithFormat:@"%.02f", chartView.yMax / 2],
[NSString stringWithFormat:@"%.02f", chartView.yMax]];
chartView.data = @[d];
[self.view addSubview:chartView]; The ScreenshotsFAQ
ContactBug reports and pull requests are welcome! Contact me via e-mail or just by opening an issue on GitHub. License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论