Questions tagged [swiftcharts]

A charting library for iOS, written in swift.

A charting library for iOS, written in swift.

References

Github repository

98 questions
2
votes
1 answer

Swift Charts - Is there a way query the y value of a LineMark at a specific x value?

So I have a chart displaying line data at equal x intervals, with varying y values - something like this: let ints = Array([0...10]) Chart { ForEach(ints) { int in let someRandomYValue = Int.random() LineMark(x: int, y:…
swiftyboi
  • 2,965
  • 4
  • 25
  • 52
2
votes
1 answer

Rotate axis label in Swift Charts

I'm using Swift Charts in a SwiftUI app to make a line chart. I would like to rotate the Y axis label such that it reads from bottom to top. I tried to rotate the text but the rotation causes the label to not render properly. Is there a way to…
wigging
  • 8,492
  • 12
  • 75
  • 117
2
votes
1 answer

How do I print out the data within this struct?

Is this the place to ask for clarification on previously written lines of code? I apologize if not. I'm trying to understand some Swift code for using LineCharts. Code was written for line charts using iOS16's Swift Charts. My understanding is…
mgianzero
  • 87
  • 5
2
votes
0 answers

import Charts conflicts with cocoa pod library's name

I am trying to use Apple's Swift Charts (iOS 16 only) but it can't compile, I presume because the import statement is interpreted as targeting this library: https://github.com/danielgindi/Charts (that I am using in other places in the App and…
mowafok764
  • 21
  • 2
2
votes
2 answers

Multiple Y axis in single Swift Charts?

I have two data sets and I want to show them in the same chart. Both data sets are time based (x axis) and with same time range. They have different units of measure and scaling (y axis). Is it possible to show both data sets in the same chart, but…
Nicolai Henriksen
  • 1,324
  • 1
  • 13
  • 37
2
votes
1 answer

Is there a way to include headers in Swift Package

I am trying to use a legacy framework as a Swift package. This framework has an umbrella header which imports UIKit via #import , so the swift source files do not explicitly import UIKit. Building via SPM fails with error messages…
pschwamb
  • 809
  • 6
  • 11
2
votes
1 answer

LineChart with optional Y parameter swift

Require a LineChart where in it allows y value as nil. As when no data for that particular day(x) is there the line should just go forward. Currently I have researched on SwiftChart & Charts but both doesn't provide that functionality. Please refer…
Anirudha Mahale
  • 2,526
  • 3
  • 37
  • 57
2
votes
3 answers

How to set multiple background colors in iOS Chart Graph Framework

I want to set multiple background colors in a chart view. A single color can be set in a background of the chart view but there is no way to set multiple colors. Percentage-wise wants to add background color 0% to 20% - Red color, 21% to 60% -…
RahulSalvikar
  • 658
  • 1
  • 10
  • 31
2
votes
1 answer

SwiftChart Library not working with Swift 3.0

I have used SwiftChart to implement Line and area chart like below image . It works fine with Xcode 7.3. Now am porting my code to iOS 10 so converting the code to Swift 3.0. I'm getting following error: U CGPathMoveToPoint(area, nil,…
Vinodh
  • 5,262
  • 4
  • 38
  • 68
2
votes
1 answer

How do I add legend to SwiftChart library

I am currently using SwiftChart library. I would like to add legend to a multi line chart. I cannot find if there is a way to do this. Can anyone help me here?
CrashOverride
  • 639
  • 1
  • 7
  • 19
2
votes
1 answer

Using map to generate a sequence of SwiftChart objects from coordinates

I am trying to iterate over an Array of coordinates to create an object from each coordinate. The coordinates are stored as tuples (x,y,z,label). private enum University { case Uni0,Uni1,Uni2, Uni3 } let models: [(x: CGFloat, y:CGFloat,…
mac389
  • 3,004
  • 5
  • 38
  • 62
1
vote
0 answers

Faint lines appear on Swift Charts heat map

I'm using Swift Charts to create a heat map as shown below and there are faint lines in the chart. In the screen shot, you can see the line in the Digital Color Meter window. I thought the lines were the grid lines of the chart but I made the X and…
wigging
  • 8,492
  • 12
  • 75
  • 117
1
vote
1 answer

How to make Text (or any View) ignore the edge of the parent view?

I am making a chart using Swift Charts. I have added pinch zoom and panning to the chart. The problem I have can be seen in this video I made. The annotations on the BarMarks collide with the edges of the chart's parent view, creating this "squeeze"…
MMise
  • 69
  • 6
1
vote
0 answers

Swift Charts ChartView + ForEach doesn't update on @Published change - rest of UI does

I am attempting to make a small app where you can log your emotion for the day and plot it on a chart. I am making this using Swift Playgrounds in an effort to challenge myself with the constraints of the app, and it has been extremely challenging.…
PaytonDEV
  • 63
  • 1
  • 6
1
vote
1 answer

Swift Charts: Why is this not charting the bars side by side?

enum SwiftChartEnergyType { case Burned case Consumed } struct SwiftChartEnergyObject: Identifiable { let id = UUID() let energy: Int let date: Date var swiftChartEnergyType: SwiftChartEnergyType } @available(iOS 16.0,…
GarySabo
  • 5,806
  • 5
  • 49
  • 124