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

why chatLinelayer is always draw in front of chatPointHighlightLayer ? #398

Open
woshahua opened this issue Oct 1, 2019 · 2 comments
Open

Comments

@woshahua
Copy link

woshahua commented Oct 1, 2019

in the example of multi-touch chart-tracking, the chatlinelayer is always draw in front of the chartPointHighlightlayer, even though I change the position in [layer].

I read the wiki, but dont understand in which order the layers are draw. can you please answer this.

@heumn
Copy link

heumn commented Oct 26, 2019

Following

@chulkov
Copy link

chulkov commented Sep 16, 2020

I fixed it by doing this:

creating Chart() as usual, except not adding LineLayer

 let chart = Chart(frame: chartFrame,
                          innerFrame: innerFrame,
                          settings: ChartSettings(),
                          layers: [
                            xAxisLayer,
                            yAxisLayer,
                            guidelinesLayer,
                            showCoordsLinesLayer,
                            //chartPointsLineLayer,
                            chartPointsCircleLayer,
                            touchLayer])

then create LineLayer and add as subview before adding chart

        let lineView = Chart(frame: chartFrame,
        innerFrame: innerFrame,
        settings: ChartSettings(),
        layers: [chartPointsLineLayer])

        self.chartView.addSubview(lineView.view)
    
        self.chartView.addSubview(chart.view)
        self.patientChart = chart

Thats it, now line is behind points.
Actually this solutions makes bug, when lineView duplicates on screen rotation. I solved this by doing this before "addSubview":

self.chartView.subviews.forEach({ $0.removeFromSuperview() })

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

3 participants