ChartView icon indicating copy to clipboard operation
ChartView copied to clipboard

BarChart can not work with NavigationLink

Open Jaschenn opened this issue 6 years ago • 0 comments

Thanks a lot for your work!, I found that BarChart can't work with NavigationLink, My code are as follows:

NavigationView{
    ...
   VStack(alignment: .leading) {
                     NavigationLink(destination: ReviewToday()){
                        BarChartView(
                            data: ChartData(points: [110,23,54,32,12,37,7,23,43]),
                            title: "最近7日",
                            form: ChartForm.large
                        ).padding()
                    }

                }
}

when I click this chart, I can't get my destination view (ReviewToday())

AND, pieChart can show the correct View when I click.

the pieChart codes are as follows:

 NavigationLink(destination: ReviewToday()){
                    PieChartView(
                        data: [Double(todayCompletedTasks.count),Double(todayRemainTasks.count)],
                        title: "今日 \(todayRemainTasks.count)/\(todayCompletedTasks.count)",
                        form: ChartForm.medium
                    ).padding()
                }

UPDATE: I found by accident that when I long press BarChart, it works ! 23333, I guess that the NavigationLink tap gesture Conflict with BarChart's gesture.

is there any way to avoid this bug-seem thing happen?

Jaschenn avatar Mar 20 '20 05:03 Jaschenn