-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
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
BarChart draws additional horizontal grid lines when setting custom customAxisMax/labelCount #310
Comments
first of all, it's not a stacked bar chart, it's just normal bar chart. Anyway, you need to provide your ios-charts version and dataSets so we can try to reproduce. Again, it's not a stacked bar chart, you can check charts demo code to see how to draw multiple bars and stacked bars. |
Hi, it indeed is a stacked bart chart, but only shows a single value per bar. I've creates a new screenshot with multiple values to make this clearer. The image shows two versions of the chart: on the left, you see the chart without setting customAxisMin/customAxisMax/labelCount -- the grid lines are drawn correctly. On the right, the custom axis properties are set, resulting in additional horizontal grid lines. Again, the only difference between the two screenshots here is the use of customAxisMin/customAxisMax/labelCount! I'm using ios-charts version 2.1.3. Here is my Swift code (assumes that you have a member var barChartView of type BarChartView):
|
I tried your data in ChartsDemo, it draws normally, but it only has one dataSet. Again, you are having more than 1 dataSet, and it seems the issue starts from there? you should check your code and run some samples on demo chart code. - (void)setDataCount:(int)count range:(double)range
{
NSMutableArray *xVals = [[NSMutableArray alloc] init];
NSMutableArray *yVals1 = [[NSMutableArray alloc] init];
[yVals1 addObject:[[BarChartDataEntry alloc] initWithValues:@[@8, @12] xIndex:0]];
[yVals1 addObject:[[BarChartDataEntry alloc] initWithValues:@[@32, @0] xIndex:1]];
BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithYVals:yVals1 label:nil];
set1.colors = @[ChartColorTemplates.vordiplom[0], ChartColorTemplates.vordiplom[1], ChartColorTemplates.vordiplom[2]];
NSMutableArray *dataSets = [[NSMutableArray alloc] init];
[dataSets addObject:set1];
BarChartData *data = [[BarChartData alloc] initWithXVals:@[@"1",@"2"] dataSets:dataSets];
_chartView.data = data;
_chartView.leftAxis.startAtZeroEnabled = NO;
_chartView.leftAxis.customAxisMin = 0;
_chartView.leftAxis.customAxisMax = 40;
_chartView.leftAxis.labelCount = 4;
[_chartView notifyDataSetChanged];
} |
Problem solved! Thanks for you help! Regards, |
Can you show your code drbarto? how did you disable the right axis 'completely' |
chartView.rightAxisEnbled = false |
okay cool thanks. |
How to remove that vertical Line After Every Index |
@raghunath44 it's called grid line. just disable it |
This is My code..
How to remove the VerticalLine after every Index? |
xAxis.drawGridLineEnabled = NO |
How to Decrease the labelFont size in Piechart and BarChart?
// pieChartView.yAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]; } BarChartView:
|
@raghunath44 stop asking irrelevant questions in a closed thread. |
I want to show average of 30 days value by using horizontal line on the bar graph ..Is any idea? |
@rajesh-loudcell try
|
Hi,
I'm using ios-chart to display a stacked bar chart which shows labels on the left axis.
I want to avoid "odd" axis label values; they should be "regular", i.e. multiples of 10, 100, etc.
Using customAxisMin/customAxisMax/labelCount seems to be the way to achieve this behavior: So e.g. for a maximum bar value of 32, I calculate the next largest multiple of 10 which is 40, and use this value as customAxisMax; customAxisMin is alway set to 0; to get intervals of 10 on the axis labels, I set the labelCount to 4 to get labels at 10, 20, 30 and 40 (also, a label is drawn at 0, which is ok).
When setting the axis metrics like this, the chart is drawn with additinal horizontal grid lines (see screenshot): it shows lines at the axis label values (which is good), but in addition it also draws lines at the top value of each bar (which is bad).
This seems to be a bug, but maybe I'm just overlooking something.
Any help is appreciated. BTW -- thanks for the great lib!
Regards,
Martin
The text was updated successfully, but these errors were encountered: