This is a highly custom chart control for iOS and Mac apps, which build with the Echart(Echart2). It just encapsulate the conrol of the javascript. It provides a chainable way of describing your configurations for the echarts. It's convinient for foucing on the logic of the app and optimizing the code. It avoid diverting developers' mind on the interaction between javascript and Objective-C.
Tips: If you want to use even iOS8.0, I suggest you use WKEchartsView which is based on WKWebView. The interface of WKEchartsView is same as PYEchartsView, so if you are using PYEchartsView, you just change PYEchartsView into WKEchartsView.
If you like this control, please star it. It can make me pay more attention on it.
And also if you find a issue, please issue me.
Pull requests are warmly welcome as well.
There are two ways to use iOS-Echarts in you project:
Using cocoapods:pod iOS-Echarts
Manually:
First, copying all the files into you project
Second, Remove referencesthe directory named 'js'
Finnaly, add the directory named 'js' and 'theme' by create floder references
⚠️ *** Please Be Sure The Color Of js and theme Directory Is Blue. *** ⚠️
You should import one header file in your project:iOS-Echarts.h when you will use it.
Finally you just need to initialze the PYEchartsView and PYOption you need.
If you don't know how to set the right value for the option, you can check the documents in the EChart Website.
Usage
The common step like the under codes:
// Firstly, you should have a instance of PYEchartsView
@property (weak, nonatomic) IBOutlet PYEchartsView *echartsView;
...
PYOption *option = ... // Then, configure something about options
// Finally, load echarts view
[_echartsView setOption:option];
[_echartsView loadEcharts];
All properties setter are chainable, you can use [property-name]Equal
Many properties support add[Name] and add[Name]Arr methods, when you use properties which type is NSMutableArray, you should try add method first
option.addXAxis(//Something about PYAxis)
.addYAxis(//Something about PYAxis)
.addSeries(//Something about PYSeries or sub class of PYSeries)
When you use the instance which is subclass of PYSeries, you should assign value for the property of subclass, then assign value for PYSeries, like this:
The PYCartesianSeries is subclass of PYSeries, and stack, smooth, symbol, symbolSize and symbol are the properties of PYCartesianSeries. So you should assign them before the properies of PYSeries.
请发表评论