SwiftUI Chart scale issue

Hey guys I'm playing around with swiftUI charts using data from Yahoo Finance public api. I'm getting a data set of charts data and trying to display it using SwiftUI charts.

My chart seems broken compared to what I'm seeing on the Yahoo webpage:

My code looks like this (tried to keep it super simple for the example):

    VStack {
      Chart {
        ForEach(viewmodel.chartData1) { chartData in
          LineMark(x: .value("date", chartData.date),
               y: .value("amount", "\(chartData.high)"))
          .interpolationMethod(.catmullRom)
           
           
        }
      }
    }
    .task { await viewmodel.getSymbols() }
  }

So I'm not sure what I'm doing wrong and why does my chart looks downward trending like that. Any help, any lead would help!

Replies

Is it because you typed "\(chartData.high)" instead of just chartData.high? You’re passing a String instead of a numeric value on the y-axis.