Questions tagged [swiftui-charts]

Questions related to the Charts framework added to SwiftUI 4 (iOS 16+, macOS 13+)

For more information see the documentation for Charts

51 questions
0
votes
1 answer

SwiftUI Charts - Cannot compile View

I have a view where I display data inside a chart with the Charts package in SwiftUI. When I only use LineMark to display my data everything works fine. But when I want to add a PointMark to this chart I get the error, that Xcode cannot compile that…
BeneKunz
  • 43
  • 6
0
votes
1 answer

Swiftui Charts Multiple Color LineMark

I’m using Swiftui Charts and I’m trying to achieve the same effect in the image taken from Apple Health app. What I really want to do is have part of a LineMark in the chart with one color and another part with a different color. The problem is that…
Ahmad N.
  • 33
  • 1
  • 2
0
votes
0 answers

SwiftUI Chart with many data slows down view

I wanted to create a heatmap with the chart framework in my swiftui app for the Mac. I used a Chart with the RectangleMark for that and displayed my grid data which has 111x71 datapoints. But I have noticed that interacting with the whole view and…
BeneKunz
  • 43
  • 6
0
votes
0 answers

SwiftUI: How to Toggle Gestures Between TabView and Charts

anyone know how to toggle gestures between subviews? I have a TabView that is made up of 3 pages. Swiping on the page navigates me to another page. In one of the pages, I used Apple's Chart API, that contains a Drag Gesture. Idea is to longPress on…
Kenny Ho
  • 409
  • 3
  • 16
0
votes
0 answers

SwiftUI Chart x-axis labels do not align properly when using dates

I have a datasource that counts the number of occurrences of location data within certain bins of time. What I want to do is display a chart that shows the count of locations recorded in each of my "bins". The bin size can be 1 hour, 1 day, 1 month,…
Aleksandr
  • 533
  • 1
  • 4
  • 12
0
votes
2 answers

Using SwiftUI Charts in macOS Foundation App

I have a Foundation macOS App written in Swift. I'm trying to use SwiftUI Chart View in NSViewcontroller (tutorial here) but it's seems import Charts doesn't recognized and I obtain the error Cannot find 'Chart' in scope and Cannot find 'LineMark'…
Fry
  • 6,235
  • 8
  • 54
  • 93
0
votes
1 answer

Extra Line in Swift Chart

I am trying to get the new Swift Charts to work, but there is a funny line running from the first to last point in the chart which I cannot resolve. Here is the code: var ChartView: some View { HStack { //Anx_6 …
WPD2050
  • 3
  • 2
0
votes
0 answers

SwiftUI Charts: How to center the Y-axis labels on each horizontal bar in a bar chart?

I'm using the new SwiftUI Charts framework to display data in a vertical bar chart, but I'm having trouble centering the Y-axis date labels on each bar: struct ChartEntry: Identifiable { var id = UUID() let labelDate: Date let…
Dan Flict
  • 117
  • 8
0
votes
1 answer

Swift UI charts & dates

I'm trying to implement a chart in Swift UI based on specific dates for an expenses app. I can get the total amount per month & display each, but I'm stuck on showing payments for a specific month (.i.e last month, current month) split by weeks. I'm…
H121
  • 1
  • 1
0
votes
1 answer

SwiftUICharts not changing color on bar chart

I am trying to build a watchOS app that has charting and I can't use Swifts built in charts because I need to support down to version 7 and swift charts are only available for watchOS 9+. So instead I am using a library I found…
Neglected Sanity
  • 1,770
  • 6
  • 23
  • 46
0
votes
1 answer

I'm getting a CoreGraphics API Error while making an interactive chart with SwiftUI Charts Framework

I'm using SwiftUI Charts to make a LineMark chart. Everything seems to work, except I'm getting this error in the console for every data point that the chart tries to plot. "Error: this application, or a library it uses, has passed an invalid…
SkimoBen
  • 19
  • 3
0
votes
1 answer

How do I display dates along X axis using Charts in SwiftUI?

I am having some trouble using the Charts framework in SwiftUI. Everything plots as expected, however the x axis does not show the dates for each point. The Y axis is working and shows the weight values along the Y axis. dateCompleted is of type…
Rachel
  • 51
  • 1
  • 7
0
votes
1 answer

SwiftUI - How do I write a fetch request to return the largest value on each date?

I am creating a workout tracking app and trying to plot the largest weight value on a day over time for a given exercise. The entity "ExerciseSet" contains attributes dateCompleted and weight. There are multiple ExerciseSets saved on the same date,…
Rachel
  • 51
  • 1
  • 7
0
votes
1 answer

SwiftUI Charts - How to put an annotation at the top of a chart and have a line coming out of going downward until it intersects the line?

I have a chart with a line: let ints = Array([0...10]) Chart { ForEach(ints) { int in let someRandomYValue = Int.random() LineMark(x: int, y: someRandomYValue) } } At the halfway point across the chart, I need an annotation…
swiftyboi
  • 2,965
  • 4
  • 25
  • 52
0
votes
0 answers

Adding a case inside switch of SwiftUI struct causes long compilation time

Wanted to play a bit with SwiftUI and Charts as some learning project. and encountered the issue with compiling time. I have a SwiftUI struct conforming to ChartContent protocol in my code. To generate the content I use a switch statement. When I…
matrejek
  • 400
  • 1
  • 4
  • 15