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

Is there anyway to plot two vertical values for one horizontal index in the bar chart? #172

Closed
dppeak opened this issue Jun 1, 2015 · 4 comments

Comments

@dppeak
Copy link

dppeak commented Jun 1, 2015

I want to be able to plot two vertical values for a particular day when using JBBarChartView. Am I missing something already present, or can this be added? Thanks!

@terryworona
Copy link
Collaborator

Currently, this is not possible (within the same line).

I'm not sure what style your chart is, but this may be a solution if you're doing scatterplots:

Supply two lines:

- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView
{
    return 2;
}

Then return two separate values for the same day:

- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:  (NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex
{
    // first line, Monday
    if (lineIndex == 0 && horizontalIndex == 0) 
        return 10

    // second line, Monday
    else if (lineIndex == 1 && horizontalIndex == 0)
        return 20

}

Hope this helps

@dppeak
Copy link
Author

dppeak commented Jun 1, 2015

I'm using barChart View.

Here's an example of what I'm looking to do.

example

@terryworona
Copy link
Collaborator

Oh, bar chart. Sorry, I misunderstood.

You can supply custom UIView's for each bar via

- (UIView *)barChartView:(JBBarChartView *)barChartView barViewAtIndex:(NSUInteger)index

Just break each custom view into 2 sections (using subviews, sublayers, etc). The math and size of each colored section are left up to you.

@dppeak
Copy link
Author

dppeak commented Jun 1, 2015

I was thinking along those lines, but wasn't sure about the setting of the selection color for the "subview". May just have to an alpha for the subview and let the darkening of the main color be enough. Thanks for the help.

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