Shaik Tamim
Shaik Tamim

Reputation: 95

multiple bar charts with dual y axis in objective c

I want to generate bar chart with dual y axis. I tried like this

-(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];

I'm getting only one single axis without y axis values. Can any one help? I want to draw bar graph with dual y axis with values.

Thanks in advance.

Upvotes: 0

Views: 345

Answers (1)

Bhushan Vaidya
Bhushan Vaidya

Reputation: 722

Try this graph if your value is negative it will show you dual y axis. https://github.com/chasseurmic/TWRCharts

Upvotes: 3

Related Questions