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

Tap delegate is there? #235

Open
AakashGeidea opened this issue May 7, 2023 · 1 comment
Open

Tap delegate is there? #235

AakashGeidea opened this issue May 7, 2023 · 1 comment

Comments

@AakashGeidea
Copy link

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.

@iAugux
Copy link

iAugux commented Jul 13, 2023

@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")

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

2 participants