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

how to draw a graph having x value but no values in y #467

Closed
milanhap opened this issue Oct 13, 2015 · 1 comment
Closed

how to draw a graph having x value but no values in y #467

milanhap opened this issue Oct 13, 2015 · 1 comment

Comments

@milanhap
Copy link

i entry all data in yVals no data with having xIndex.
for example
Suppose: xIndexes ["Apples", "Oranges", "Strawberries"] and just set: yVals [].
i got erorr in below line
let entryFrom = dataSet.entryForXIndex(_minX)! // nil while unwrapping an Optional value
any solutation to draw graph in above condition

@milanhap milanhap changed the title i entry all data in yVals no data with having xIndex i entry all data in yVals no data with having xIndex. for example Suppose: xIndexes ["Apples", "Oranges", "Strawberries"] and just set: yVals []. and i got erorr in let entryFrom = dataSet.entryForXIndex(_minX)! // nil while unwrapping an Optional value let entryTo = dataSet.entryForXIndex(_maxX)! any solutation to draw graph in above condition Oct 13, 2015
@milanhap milanhap changed the title i entry all data in yVals no data with having xIndex. for example Suppose: xIndexes ["Apples", "Oranges", "Strawberries"] and just set: yVals []. and i got erorr in let entryFrom = dataSet.entryForXIndex(_minX)! // nil while unwrapping an Optional value let entryTo = dataSet.entryForXIndex(_maxX)! any solutation to draw graph in above condition i entry all data in yVals no data with having xIndex. for example Suppose: xIndexes ["Apples", "Oranges", "Strawberries"] and just set: yVals []. i got erorr in below line let entryFrom = dataSet.entryForXIndex(_minX)! // nil while unwrapping an Optional value any solutation to draw graph in above condition Oct 13, 2015
@milanhap milanhap changed the title i entry all data in yVals no data with having xIndex. for example Suppose: xIndexes ["Apples", "Oranges", "Strawberries"] and just set: yVals []. i got erorr in below line let entryFrom = dataSet.entryForXIndex(_minX)! // nil while unwrapping an Optional value any solutation to draw graph in above condition how to draw a graph having x value but no values in y Oct 13, 2015
@liuxuan30
Copy link
Member

I have no problem drawing such charts with charts demo.
try like below:

    NSMutableArray *xVals = [[NSMutableArray alloc] init];

    for (int i = 0; i < count; i++)
    {
        [xVals addObject:months[i % 12]];
    }
    BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithYVals:@[] label:@"DataSet"];
    set1.barSpace = 0.35;

    NSMutableArray *dataSets = [[NSMutableArray alloc] init];
    [dataSets addObject:set1];

    BarChartData *data = [[BarChartData alloc] initWithXVals:xVals dataSets:dataSets];
    [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]];

    _chartView.data = data;

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

2 participants