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

multiple datasets with different x-values in chart #807

Closed
rlimberger opened this issue Mar 7, 2016 · 3 comments
Closed

multiple datasets with different x-values in chart #807

rlimberger opened this issue Mar 7, 2016 · 3 comments

Comments

@rlimberger
Copy link

Thanks for an awesome library! We are just starting to integrate it into a few projects and came across an issue we have with multiple lines in 1 chart. We may just be missing the obvious solution, but looking at the demo projects, it seems a limitation.

We have multiple datasets we want to show as lines in 1 chart. Each dataset has different xValues. Some of the xValues are shared, but some are unique to each set.

When looking at the demo, we see:

LineChartData *data = [[LineChartData alloc] initWithXVals:xVals dataSets:dataSets];

which seems to assume that all xValues need to be the same for all datasets.

Is there a way to work around this limitation?

Thanks!

@liuxuan30
Copy link
Member

liuxuan30 commented Mar 8, 2016

yeah currently, they share the same xVals, and x axis is index based, so technically they share the same xIndex.
you may want to think from the index way, to see if you can merge the different xValues.
you can ignore adding an entry for a specific xIndex, so it will jump to next, which means the line will ignore this xIndex and connect to the next available dot
Releated feature: line breaking #280 and Making X-Values Properly Scaled (Not Equidistant) #194

@rlimberger
Copy link
Author

Is this possible with the v3 branch?

@liuxuan30
Copy link
Member

if you are not talking about showing two x axis at same position, I think it's possible. v3 branch is using a different way to calculate x axis (like y axis), so different x values can share the same x axis.

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