CTChartData
public protocol CTChartData : ObservableObject, Identifiable
Main protocol for passing data around library.
All Chart Data models ultimately conform to this.
-
A type representing a data set. –
CTDataSetProtocol
Declaration
Swift
associatedtype SetType : CTDataSetProtocol
-
A type representing a data set. –
CTDataSetProtocol
Declaration
Swift
associatedtype SetPoint : CTDataSetProtocol
-
A type representing a data point. –
CTChartDataPoint
Declaration
Swift
associatedtype DataPoint : CTDataPointBaseProtocol
-
A type representing the chart style. –
CTChartStyle
Declaration
Swift
associatedtype CTStyle : CTChartStyle
-
A type representing a view for the results of the touch interaction.
Declaration
Swift
associatedtype Touch : View
-
Undocumented
Declaration
Swift
var id: ID { get }
-
Data model containing datapoints and styling information.
Declaration
Swift
var dataSets: SetType { get set }
-
Data model containing the charts Title, Subtitle and the Title for Legend.
Declaration
Swift
var metadata: ChartMetadata { get set }
-
Array of
LegendData
to populate the charts legend.This is populated automatically from within each view.
Declaration
Swift
var legends: [LegendData] { get set }
-
Data model pass data from
TouchOverlay
ViewModifier toHeaderBox
orInfoBox
for display.Declaration
Swift
var infoView: InfoViewData<DataPoint> { get set }
-
Data model conatining the style data for the chart.
Declaration
Swift
var chartStyle: CTStyle { get set }
-
Customisable
Text
to display when where is not enough data to draw the chart.Declaration
Swift
var noDataText: Text { get set }
-
Holds data about the charts type.
Allows for internal logic based on the type of chart.
Declaration
Swift
var chartType: (chartType: ChartType, dataSetType: DataSetType) { get }
-
Undocumented
Declaration
Swift
var disableAnimation: Bool { get set }
-
Returns whether there are two or more data points.
Declaration
Swift
func isGreaterThanTwo() -> Bool
-
setTouchInteraction(touchLocation:
Default implementationchartSize: ) Takes in the required data to set up all the touch interactions.
Output via
getTouchInteraction(touchLocation: CGPoint, chartSize: CGRect) -> Touch
- touchLocation: Current location of the touch
- chartSize: The size of the chart view as the parent view.
Default Implementation
Declaration
Swift
func setTouchInteraction(touchLocation: CGPoint, chartSize: CGRect)
-
Takes touch location and return a view based on the chart type and configuration.
Inputs from
setTouchInteraction(touchLocation: CGPoint, chartSize: CGRect)
- touchLocation: Current location of the touch
- chartSize: The size of the chart view as the parent view.
Declaration
Swift
func getTouchInteraction(touchLocation: CGPoint, chartSize: CGRect) -> Touch
Return Value
The relevent view for the chart type and options.
-
Gets the nearest data points to the touch location.
- touchLocation: Current location of the touch.
- chartSize: The size of the chart view as the parent view.
Declaration
Swift
func getDataPoint(touchLocation: CGPoint, chartSize: CGRect)
Return Value
Array of data points.
-
Gets the location of the data point in the view.
- dataSet: Data set to work with.
- touchLocation: Current location of the touch.
- chartSize: The size of the chart view as the parent view.
Declaration
Swift
func getPointLocation(dataSet: SetPoint, touchLocation: CGPoint, chartSize: CGRect) -> CGPoint?
Return Value
Array of points with the location on screen of data points.
-
infoValueUnit(info:
Extension method) Displays the data points value with the unit.
Declaration
Swift
public func infoValueUnit(info: DataPoint) -> some View
Parameters
info
A data point
Return Value
Text View with the value with relevent info.
-
infoValue(info:
Extension method) Displays the data points value without the unit.
Declaration
Swift
public func infoValue(info: DataPoint) -> some View
Parameters
info
A data point
Return Value
Text View with the value with relevent info.
-
infoUnit()
Extension methodDisplays the unit.
Declaration
Swift
public func infoUnit() -> some View
Parameters
info
A data point
Return Value
Text View of the unit.
-
infoDescription(info:
Extension method) Displays the data points description.
Declaration
Swift
public func infoDescription(info: DataPoint) -> some View
Parameters
info
A data point
Return Value
Text View with the points description.
-
infoLegend(info:
Extension method) Displays the relevent Legend for the data point.
Declaration
Swift
@ViewBuilder public func infoLegend(info: DataPoint) -> some View
Parameters
info
A data point
Return Value
A View of a Legend.