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

Animates only first line after .addLine() invoked #48

Closed
yablodev opened this issue Apr 17, 2018 · 0 comments
Closed

Animates only first line after .addLine() invoked #48

yablodev opened this issue Apr 17, 2018 · 0 comments

Comments

@yablodev
Copy link

Hello!
When I first time invoke addLine function it works great (line appears with animation), but when I try add second line by invoking the same addLine function, first line appears with animation but second line and other appear without animation.
`@IBAction func addLine(_ sender: UIButton) {

    let data2: [CGFloat] = [1, 3, 5, 13, 17, 20]
    lineChart.colors.append(UIColor.cyan)
    lineChart.addLine(data2) // add second line
    
}
override func viewDidLoad() {
    super.viewDidLoad()
    
    
    label.text = "..."
    label.translatesAutoresizingMaskIntoConstraints = false
    label.textAlignment = NSTextAlignment.center
    self.view.addSubview(label)
    
    // simple arrays
    let data: [CGFloat] = [3, 4, 2, 11, 13, 15]
    
    
    // simple line with custom x axis labels
    let xLabels: [String] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
    
    //lineChart = LineChart()
    lineChart.animation.enabled = true
    lineChart.area = true
    lineChart.x.labels.visible = true
    lineChart.x.grid.count = 10
    lineChart.y.grid.count = 10
    lineChart.x.labels.values = xLabels
    lineChart.y.labels.visible = true
    lineChart.addLine(data) //add first line
    
    lineChart.dots.outerRadius = 6
    lineChart.dots.innerRadius = 4
    
    lineChart.colors = [UIColor.black]
    
    lineChart.translatesAutoresizingMaskIntoConstraints = false
    lineChart.delegate = self
    // Do any additional setup after loading the view, typically from a nib.
}`
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

1 participant