iosswiftswiftcharts

Is there a delegate in SwiftCharts that I can call when the user scrolls the bar graph?


I need to fetch more data (bars) as the user scrolls left in my bar graph. I see where I can get the position of each data point, but I can seem to find a delegate that is exposed that I an call when the user is scrolling the graph. I set the zoom initially so the user will have to scoll to see the rest of the bars

var chartSettings = ExamplesDefaults.chartSettingsWithPanZoom
chartSettings.zoomPan.minZoomX = 2

Is there a delegate that I can call so I can check to see if the datapoint is in the viewport before fetching more data?

https://github.com/i-schuetz/SwiftCharts


Solution

  • Check out func onPan in ChartDelegate.

    Delegate: https://github.com/i-schuetz/SwiftCharts/blob/ec538d027d6d4c64028d85f86d3d72fcda41c016/SwiftCharts/Chart.swift

    From example: https://github.com/i-schuetz/SwiftCharts/blob/d1f4c580eff3b815cf9a10739ecd7bfd7474c2de/Examples/Examples/AreasExample.swift