1

I am using Swift Charts to practice plotting some stock price data. Stocks only trade on weekdays, so every 5 days there is a gap of 2 days worth of data missing in any type of time-series stock data.

I have a fully functional LineMark plot of around 1 month worth of data, incremented by every 30 minutes. However, between each gap of trading during the weekend, there is still dates shown on the x-axis, which accordingly causes a noticeable line between the data points before and after the weekend. I tried adjusting the "unit" for the graph without any success.

notice the gaps during the weekends

This is the code I have for the chart.

  LineMark(x: .value("Date", myData.date, unit: Calendar.Component.day), y: .value("Price",myData.close ?? 0.0))
Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52
apod
  • 145
  • 1
  • 6

0 Answers0