We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In a group bar, barSpace does not work, two bars overlap.
This is my MultipleBarChart:
This is how my MultipleBarChart set up:
self.detailValuationBarChart.delegate = self;
self.detailValuationBarChart.descriptionText = @""; self.detailValuationBarChart.drawValueAboveBarEnabled = YES; self.detailValuationBarChart.rightAxis.enabled = NO; self.detailValuationBarChart.leftAxis.enabled = NO; self.detailValuationBarChart.legend.enabled = NO; self.detailValuationBarChart.gridBackgroundColor = [UIColor whiteColor]; self.detailValuationBarChart.userInteractionEnabled = NO; ChartYAxis *yAxis = self.detailValuationBarChart.leftAxis; yAxis.labelTextColor = UIColor.whiteColor; yAxis.labelPosition = YAxisLabelPositionInsideChart; yAxis.drawGridLinesEnabled = NO; yAxis.axisLineColor = UIColor.whiteColor; yAxis.axisMinimum = 0; ChartXAxis *xAxis = self.detailValuationBarChart.xAxis; xAxis.labelPosition = XAxisLabelPositionBottom; xAxis.labelFont = [UIFont systemFontOfSize:10]; xAxis.drawLabelsEnabled = YES; xAxis.drawAxisLineEnabled = NO; xAxis.drawGridLinesEnabled = NO; xAxis.valueFormatter = self; xAxis.labelCount = 3; [self setBarChartData:self.detailValuationModel];
This is how my MultipleBarChart data set:
NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init]; pFormatter.numberStyle = NSNumberFormatterPercentStyle; pFormatter.maximumFractionDigits = 1; pFormatter.multiplier = @1.f; pFormatter.percentSymbol = @"万"; float barSpace = 0.06; float barWidth = 0.25; float groupSpace = 1 - (2 * barWidth) - (2 * barSpace); NSMutableArray *yValA = [[NSMutableArray alloc] init]; NSMutableArray *yValB = [[NSMutableArray alloc] init]; for (NSInteger i = 0; i < model.condgradeBValueModel.vBuyResidualValueArr.count; i++) { [yValA addObject:[[BarChartDataEntry alloc] initWithX:i y:[model.condgradeBValueModel.vBuyResidualValueArr[i] floatValue]]]; } for (NSInteger i = 0; i < model.condgradeBValueModel.vSellResidualValueArr.count; i++) { [yValB addObject:[[BarChartDataEntry alloc] initWithX:i y:[model.condgradeBValueModel.vSellResidualValueArr[i] floatValue]]]; } BarChartDataSet *set1 = nil, *set2 = nil; if (self.detailValuationBarChart.data.dataSetCount > 0) { set1 = (BarChartDataSet *)self.detailValuationBarChart.data.dataSets[0]; set2 = (BarChartDataSet *)self.detailValuationBarChart.data.dataSets[1]; set1.values = yValA; set2.values = yValB; BarChartData *data = self.detailValuationBarChart.barData; [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]]; [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]]; [self.detailValuationBarChart.data notifyDataChanged]; [self.detailValuationBarChart notifyDataSetChanged]; } else { set1 = [[BarChartDataSet alloc] initWithValues:yValA label:@"Company A"]; [set1 setColor:COLOR_RGB(254, 183, 192)]; set2 = [[BarChartDataSet alloc] initWithValues:yValB label:@"Company B"]; [set2 setColor:COLOR_RGB(182, 215, 253)]; NSMutableArray *dataSets = [[NSMutableArray alloc] init]; [dataSets addObject:set1]; [dataSets addObject:set2]; BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets]; [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:12.f]]; [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]]; data.barWidth = barWidth; [data groupWidthWithGroupSpace:groupSpace barSpace:barSpace]; self.detailValuationBarChart.data = data; }
The text was updated successfully, but these errors were encountered:
I can't see screenshot. check #1801, could solve your issue. Also check out multiple bar chart in ChartsDemo.
Sorry, something went wrong.
@liuxuan30 #1081 is different from my question,my question is two bar overlap, the barSpace does not work. This is my screenshot:
as I said, I can't see your screenshot. It's broken. Have you checked ChartsDemo and play around?
No branches or pull requests
In a group bar, barSpace does not work, two bars overlap.
This is my MultipleBarChart:
This is how my MultipleBarChart set up:
self.detailValuationBarChart.delegate = self;
This is how my MultipleBarChart data set:
The text was updated successfully, but these errors were encountered: