1.拖入项目Echart
屏幕快照 2017-09-15 下午5.31.55.png
2.在需要的地方新建xib 拖进去一个view 继承与PYZoomEchartsView
WechatIMG4.jpeg
3加载数据
[_chartView setOption:[PYLineDemoOptions basicAreaOption:numArr DateArr:dateArr]];
[_chartView loadEcharts];
+ (PYOption *)basicAreaOption:(NSArray*)dataArr DateArr:(NSArray*)dateArr{
return [PYOption initPYOptionWithBlock:^(PYOption *option) {
option
// .titleEqual([PYTitle initPYTitleWithBlock:^(PYTitle *title) {
// title.textEqual(@"").subtextEqual(@"数据由合金宝提供");
// }])
.gridEqual([PYGrid initPYGridWithBlock:^(PYGrid *grid) {
grid.xEqual(@45).x2Equal(@20);
grid.yEqual(@20).y2Equal(@30);
}])
.tooltipEqual([PYTooltip initPYTooltipWithBlock:^(PYTooltip *tooltip) {
tooltip.triggerEqual(PYTooltipTriggerAxis);
}])
.calculableEqual(YES)
.addXAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
axis.typeEqual(PYAxisTypeCategory).boundaryGapEqual(@NO).addDataArr(dateArr);
}])
.addYAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
axis.typeEqual(PYAxisTypeValue);
axis.minEqual(@(5000));
axis.maxEqual(@(9000));
axis.splitNumberEqual(@(5));
}])
.addSeries([PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
series.smoothEqual(YES)
.symbolSizeEqual(@(0))
.nameEqual(@"价格")
.typeEqual(PYSeriesTypeLine)
.itemStyleEqual([PYItemStyle initPYItemStyleWithBlock:^(PYItemStyle *itemStyle) {
itemStyle.normalEqual([PYItemStyleProp initPYItemStylePropWithBlock:^(PYItemStyleProp *normal) {
normal.areaStyleEqual([PYAreaStyle initPYAreaStyleWithBlock:^(PYAreaStyle *areaStyle) {
areaStyle.typeEqual(PYAreaStyleTypeDefault);
}]);
}]);
}])
.dataEqual(dataArr);
}]);
}];
}
_chartView就是拖进xib的View
还有很多类型的图表
网友评论