我想生成带有双y轴的条形图。我尝试过这样

-(void)loadGraph
      {
_barColors                      = @[[UIColor cyanColor]];
_currentBarColor                = 0;

//  CGRect chartFrame               = CGRectMake(0.0,
//                                               0.0,
//                                               300,
//                                               300.0);

CGRect chartFrame               = CGRectMake(60,128-20,self.view.frame.size.width-40-40,180);//728//1024
_chart                          = [[SimpleBarChart alloc] initWithFrame:chartFrame];
//_chart.center                 = CGPointMake(self.view.frame.size.width / 2.0, self.view.frame.size.height / 2.0);
_chart.delegate                 = self;
_chart.dataSource               = self;
_chart.barShadowOffset          = CGSizeMake(2.0, 1.0);
_chart.animationDuration        = 1.0;
_chart.barShadowColor           = [UIColor clearColor];
_chart.barShadowAlpha           = 0.5;
_chart.barShadowRadius          = 1.0;
_chart.barWidth                 = 30.0;
_chart.xLabelType               = SimpleBarChartXLabelTypeHorizontal;//SimpleBarChartXLabelTypeVerticle;
_chart.incrementValue           = 10;
_chart.barTextType              = SimpleBarChartBarTextTypeTop;
_chart.barTextColor             = [UIColor blackColor];
//
_chart.gridColor                = [UIColor clearColor];
//

[scroll addSubview:_chart];


[_chart reloadData];


我只得到一个没有y轴值的单轴。有人可以帮忙吗?我想绘制带有值的双y轴的条形图。

提前致谢。

最佳答案

如果您的值是负数,请尝试此图,它将显示双y轴。
https://github.com/chasseurmic/TWRCharts

关于ios - objective-c 中具有双y轴的多个条形图,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38656908/

10-13 04:00