在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Jawbone/JBChartView开源软件地址:https://github.com/Jawbone/JBChartView开源编程语言:Objective-C 99.8%开源软件介绍:JBChartViewIntroducing JBChartView - Jawbone's iOS-based charting library for both line and bar graphs. It is easy to set-up, and highly customizable. Features
Refer to the <a href="https://github.com/Jawbone/JBChartView/blob/master/CHANGELOG.md"">changelog for an overview of JBChartView's feature history. Requirements
Demo ProjectBuild and run the JBChartViewDemo project in Xcode. The demo demonstrates the use of both the line and bar charts. It also outlines how a chart's appearance can be customized. More Demos
InstallationCocoaPods is the recommended method of installing JBChartView. The Pod WaySimply add the following line to your
The Old School WayThe simplest way to use JBChartView with your application is to drag and drop the /Classes folder into you're Xcode 5 project. It's also recommended you rename the /Classes folder to something more descriptive (ie. "Jawbone - JBChartView"). UsageAll JBChartView implementations have a similiar data source and delgate pattern to UITableView. If you're familiar with using a UITableView or UITableViewController, using a JBChartView subclass should be a breeze! Swift ProjectsTo use JBCartView in a Swift project add the following to your bridging header (JBChartView-Bridging-Header.h):
For more information about adding bridging headers see Swift and Objective-C in the Same Project. JBBarChartViewTo initialize a JBBarChartView, you only need a few lines of code (see below). Bar charts can also be initialized via a nib or with a frame.
Just like you would for a
At a minimum, you need to inform the data source how many bars are in the chart:
Secondly, you need to inform the delegate the height of each bar (automatically normalized across the entire chart):
Lastly, ensure you have set the frame of your barChartView & call reloadData at least once:
Subsequent changes to the chart's frame will not invoke reloadData; it must be called directly afterwards for any changes to take effect. Animated ReloadBoth line and bar charts support animated reloads. The delta between the old data model and new data model is calculated and animated appropriately (ie. bars or lines will shrink, expand or morph in size). Due to techinical limitations in Apple's Quartz Core Framework, line fills (both solid and gradient) can not be animated - they will simply 'snap' into place while the rest of the chart continues to animate.
State changes during a reload will be ignored. As well, subsequent calls to reloadData: or reloadDataAnimated: before any previous reloads are complete, will also be ignored. Lastly, all touch events will be ignored until a reload has completed. You can always check on the state of the animation via the exposed read-only property:
By default, the animation will complete in approximately 0.25 seconds. The animation duration is independent from the data model size. Note: the above restrictions apply only to animated reloads, as non-animated reloads are synchronous. JBLineChartViewSimiliarily, to initialize a JBLineChartView, you only need a few lines of code (see below). Line charts can also be initialized via a nib or with a frame.
Just like you would for a
At a minimum, you need to inform the data source how many lines and vertical data points (for each line) are in the chart:
Secondly, you need to inform the delegate of the y-position of each point (automatically normalized across the entire chart) for each line in the chart:
Note: you can return NAN instead of CGFloat to indicate missing values. The chart's line will begin at the first non-NAN value and end at the last non-NAN value. The line will interopolate any NAN values in between (ie. the line will not be interrupted).
Lastly, ensure you have set the frame of your lineChartView & call reloadData at least once:
Note: subsequent changes to the chart's frame will not invoke reloadData; it must be called directly afterwards for any changes to take effect. CustomizationBoth the line and bar charts support a robust set of customization options. Read more about them here. Minimum & Maximum ValuesBy default, a chart's minimum and maximum values are equal to the min and max supplied by the dataSource. You can override either value via:
If value(s) are supplied, they must be >= 0, otherwise an assertion will be thrown. To reset the values back to their original defaults:
The min/max values are clamped to the ceiling and floor of the actual min/max values of the chart's data source; for example, if a maximumValue of 20 is supplied & the chart's actual max is 100, then 100 will be used. For min/max modifications to take effect, reloadData must be called. PerformanceThe nature of charting is to display all available information, unlike a UITableView, which can cache rows that are offscreen. JBChartView's performance will suffer if the number of data points exceed the resolution of the device. The same issue exists with MKMapView, when hundreds of pins are supplied within a certain geographic area. It's why Apple recommends clustering to avoid performance issues. As such, for large datasets, we recommend that your dataSource to supply a subset of points; clustering those that are close to one another. LicenseUsage is provided under the Apache License (v2.0). See LICENSE for full details. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论