简介: Pluto-Y 对百度ECharts进行的封装iOS-Echarts
一、官网地址:http://echarts.baidu.com/echarts2/index.html,官网上有实例及文档说明
二、折线图双Y轴实现效果图:
三、折线图双Y轴核心代码
+ (PYOption*)standardLineOption {
return [PYOption initPYOptionWithBlock:^(PYOption *option) {
option.titleEqual([PYTitle initPYTitleWithBlock:^(PYTitle *title) {
title.textEqual(@"")
.subtextEqual(@"");
}])
.tooltipEqual([PYTooltip initPYTooltipWithBlock:^(PYTooltip *tooltip) {
tooltip.triggerEqual(PYTooltipTriggerAxis);
}])
.gridEqual([PYGrid initPYGridWithBlock:^(PYGrid *grid) {
grid.xEqual(@40).x2Equal(@50);
}])
.legendEqual([PYLegend initPYLegendWithBlock:^(PYLegend *legend) {
legend.dataEqual(@[@"ns_csiqcs",@"ns_lbi",@"ns_cap",@"ns_spider"]);
}])
.addXAxis([PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
axis.typeEqual(PYAxisTypeCategory)
.axisLabelEqual([PYAxisLabel initPYAxisLabelWithBlock:^(PYAxisLabel *axisLabel) {
axisLabel.rotateEqual(@(45));
}])
.boundaryGapEqual(@NO)
.addDataArr(@[@"2017082812",@"2017082813",@"2017082814",@"2017082814",@"2017082814",@"2017082814",@"2017082814"]);
}])
.addYAxisArr(@[[PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
axis.typeEqual(PYAxisTypeValue);
axis.nameEqual(@"GB/日");
}],
[PYAxis initPYAxisWithBlock:^(PYAxis *axis) {
axis.typeEqual(PYAxisTypeValue);
axis.nameEqual(@"GB/日");
}]])
.addSeriesArr(@[[PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
series.nameEqual(@"ns_csiqcs");
series.yAxisIndexEqual(@(1))
.typeEqual(PYSeriesTypeLine)
.dataEqual(@[@(11),@(11),@(15),@(13),@(12),@(13),@(10)]);
}],[PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
series.nameEqual(@"ns_lbi")
.typeEqual(PYSeriesTypeLine)
.dataEqual(@[@(1),@(-2),@(2),@(5),@(3),@(2),@(0)]);
}],[PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
series.nameEqual(@"ns_cap")
.typeEqual(PYSeriesTypeLine)
.dataEqual(@[@(11),@(11),@(15),@(13),@(12),@(13),@(10)]);
}],[PYCartesianSeries initPYCartesianSeriesWithBlock:^(PYCartesianSeries *series) {
series.nameEqual(@"ns_spider")
.typeEqual(PYSeriesTypeLine)
.dataEqual(@[@(7),@(4),@(10),@(-3),@(9),@(15),@(13)]);
}]]);
}];
}