ChartsOrg / ChartsOrg/Charts

How to organise scrolling with moveViewToAnimated with song duration?

Open
#3,834 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

## What did you do?

let plotOneData: [Double] = [1.0, 10, 20, 30, 22, 25, 28, 50, 60, 70, 100] // This data is mocked data. Actually the original data is huge. That's why I put the mocked one.

guard let duration = player?.currentItem?.asset.duration else { return }
let songDuration = Double(CMTimeGetSeconds(duration))
guard let min = plotOneData.min() else { return }
guard let max = plotOneData.max() else { return }
graphView.moveViewToAnimated(xValue: max, yValue: min, axis: graphView.rightAxis.axisDependency, duration: songDuration)

## What did you expect to happen?

I expect to see that the graphView will scroll with song duration and will end scrolling with song. I think there is something wrong with min and max values.

## What happened instead?

It's started to scroll very slowly and getting faster and as a result it finished the scrolling before ending the song.

## Charts Environment

**Charts version/Branch/Commit Number:** Latest version
**Xcode version:** Latest version
**Swift version:** 4
**Platform(s) running Charts:** iOS devices.
**macOS version running Xcode:** 10.14.2

Contributor guide

Open the contributing guide

Research direction

The relevant entry point is graphView.moveViewToAnimated(...), with duration derived from the AVPlayer item's asset and bounds from plotOneData. Compare how the method interprets xValue, yValue, duration, and the chart axis range against the observed animation timing. Done means the graph reaches its target at the end of the song.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
data-visualization, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.