SwiftUICharts
SwiftUICharts copied to clipboard
Tap delegate is there?
Hi @willdale , Is there any delegate or call back methods available so that i can get value whenever user touches any point on graph? I want that whole data object corresponding to that touch. Highly appreciated your help.
@AakashGeidea you can take advantage of ChartData's touchedDataPointPublisher
data.touchedDataPointPublisher
.sink {
print($0)
}
.store(in: &cancellables)
Outputs:
LineChartDataPoint(id: 15FC802F-B374-40F1-B0A3-AED4C34AA9B9, value: 13000.0, xAxisLabel: Optional("T"), description: Optional("Tuesday"), date: nil, pointColour: nil, ignoreMe: false, legendTag: "Test One")
LineChartDataPoint(id: 15FC802F-B374-40F1-B0A3-AED4C34AA9B9, value: 13000.0, xAxisLabel: Optional("T"), description: Optional("Tuesday"), date: nil, pointColour: nil, ignoreMe: false, legendTag: "Test One")
LineChartDataPoint(id: D9902CBC-1FFC-4FC3-80FB-B26A4FE312BE, value: 8000.0, xAxisLabel: Optional("W"), description: Optional("Wednesday"), date: nil, pointColour: nil, ignoreMe: false, legendTag: "Test One")
LineChartDataPoint(id: D9902CBC-1FFC-4FC3-80FB-B26A4FE312BE, value: 8000.0, xAxisLabel: Optional("W"), description: Optional("Wednesday"), date: nil, pointColour: nil, ignoreMe: false, legendTag: "Test One")