Skip to content
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

can't set the XVals #1964

Closed
fonglaaaam opened this issue Dec 16, 2016 · 1 comment
Closed

can't set the XVals #1964

fonglaaaam opened this issue Dec 16, 2016 · 1 comment

Comments

@fonglaaaam
Copy link

int xVals_count = 12;//X轴上要显示多少条数据
double maxYVal = 100;//Y轴的最大值
//X轴上面需要显示的数据
NSMutableArray *xVals = [[NSMutableArray alloc] init];
for (int i = 0; i < xVals_count; i++) {
[xVals addObject:[NSString stringWithFormat:@"%dmonth", i+1]];
}
.........
BarChartData *data = [[BarChartData alloc] initWithXVals:xVals dataSets:dataSets];

this is old way toast xvals,
but now i can't find de method to set the xvals.
(
the method above replaced by :
BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets];
)

@fonglaaaam
Copy link
Author

figure out

NSArray *xVals = @[@"asd",@"qwe",@"zxc",@"wsad"];
{
self.LineChartView.xAxis.valueFormatter = self;//x轴代理 (delegate)
}

#pragma mark valueFormatte delegate

  • (NSString *)stringForValue:(double)value axis:(ChartAxisBase *)axis{
    return xVals[(int)value % xVals.count];
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant