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
Areas, lines, circles (interactive) example - how to clear popup #53
Comments
You can add a transparent overlay view that covers the chart when the user taps on the circle. There's a utility class HandlingView which you could use for this - you can pass a In order for the circles to continue being interactive while the overlay is open you'd have to make that the overlay is added behind the circles (in this case the overlay can be added permanently, no need to do it only when user taps). I'd create a |
P.S. Here also code to make clearer what I mean, with let overlayGenerator = {(chartPointModel: ChartPointLayerModel, layer: ChartPointsLayer, chart: Chart) -> UIView? in
let view = HandlingView(frame: chart.frame)
view.touchHandler = {
// code to hide current popup
}
return view
}
let dummyChartPoint = ChartPoint(0, 0) // coordinates are not important here since we don't use them
let overlayLayer = ChartPointsViewsLayer(xAxis: xAxis, yAxis: yAxis, innerFrame: innerFrame, chartPoints: dummyChartPoint, viewGenerator: overlayGenerator)
...
let chart = Chart(
frame: chartFrame,
layers: [
...
overlayLayer,
circlesLayer,
...
]
) let me know if it works out for you or you face any other issues! |
Didn't seem to work, the touchHandler was never entered. Would it be possible to provide an updated running example? Thanks so much for your quick response. |
This is an exact copy of the areas example, you can find the overlay part enclosed in ////////////. https://gist.github.com/i-schuetz/a7801eba798e2d04d1c5 |
Thank you. This is what I observed now, if I click on any of the green space, then the pop up is clear. However, if I click on some of the white space, then sometimes the popup is not clear. For example, click 6,290, then click on the first top box (i.e. 350-300,0-2), then it is not clear. |
Ah, you have to pass |
In the Areas line, circles (interactive) example, the popup is shown and previous popup is clear whenever I clicked on a circle. How can I clear the popup if I click on any place on the graph that is not the circle (e.g. the white space). Thanks...
The text was updated successfully, but these errors were encountered: