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

Markers not appearing as expected #4645

Closed
1 task done
orolhawion opened this issue May 21, 2021 · 6 comments
Closed
1 task done

Markers not appearing as expected #4645

orolhawion opened this issue May 21, 2021 · 6 comments

Comments

@orolhawion
Copy link

orolhawion commented May 21, 2021

What did you do?

In my project I updated Charts with Swift Package Manager from 3.6.0 to 4.0.1 and found that markers on line charts and bar charts are not appearing reliably.

What did you expect to happen?

When I tap an entry in a bar chart or line chart, the marker appears reliably in v3.6.0 but not in v4.0.1. However I could not find this issue with pie charts, this seems to be working as before.

What happened instead?

Nothing, no errors in the log

Charts Environment

Charts version/Branch/Commit Number:
4.0.1

Xcode version:
12.5 (12E262)

Swift version:
5

Platform(s) running Charts:
iOS 14.5+

macOS version running Xcode:
Big Sur 11.3.1

Demo Project

Since I did not change any charts related code in my project, I expect this to be reproducible with any project that you guys have that use markers.

This might be related to #4641 (comment)

@Lee-Waire-Health
Copy link

Lee-Waire-Health commented May 24, 2021

    var entries: [ChartDataEntry] = []
    
    
    var i = 0
    while i < 38 {
        entries.append(ChartDataEntry(x: Double(round(1621858800.0+(Double(i)*60.0))), y: Double(Float.random(in: 70...73))))
        i+=1
    }
    
    let set = ChartDataSet(entries: entries)
    
    let res = set.entriesForXValue(Double(1621860300))
    
    let test1 = entries.partitioningIndex { $0.x == Double(1621860300) }
    let test2 = entries.partition { $0.x >= Double(1621860300) }

^ ^ simplest for of replication think it points to bad use or partitioningIndex, use comments suggest this generally should only be run on a partitioned set.

@astarsoftware
Copy link

I also ran into this bug when updating to 4.0.1.

@samdogg7
Copy link

samdogg7 commented Aug 23, 2021

I ran into this same bug as well on 4.0.0 using SPM to install the dependency

@drewster99
Copy link

I have this issue also on 4.0.1. None of the markers appear correctly when tapped. Either they don't appear at all or they appear int he wrong place entirely (or perhaps it's a different marker that appears). Updated from 3.6.0 to 4.0.1.

@samdogg7
Copy link

samdogg7 commented Oct 5, 2021

@drewster99 I ended up downgrading to 3.6.0 on SPM as a workaround. Still no word on a fix.

drewster99 pushed a commit to drewster99/Charts that referenced this issue Oct 6, 2021
…ng xValue when it should" (ChartsOrg#4668).

Resolves Issue 4645 "Markers not appearing as expected" (ChartsOrg#4645).

The entriesForXValue function was incorrectly partiioning on ==, and also sometimes incorrectly returning an array of values that don't match at all.
The entryIndex function's switch statement assumes that the closest X value had already been found, which would often not be the case, since we are partitioning on >=.
@pmairoldi
Copy link
Collaborator

Closed by #4721

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

6 participants