LineChart
public struct LineChart<ChartData> : View where ChartData : LineChartData
View for drawing a line chart.
Uses LineChartData
data model.
Declaration
LineChart(chartData: data)
View Modifiers
The order of the view modifiers is some what important as the modifiers are various types for stacks that wrap around the previous views.
.pointMarkers(chartData: data)
.touchOverlay(chartData: data, specifier: "%.0f")
.yAxisPOI(chartData: data,
markerName: "Something",
markerValue: 110,
labelPosition: .center(specifier: "%.0f"),
labelColour: Color.white,
labelBackground: Color.blue,
lineColour: Color.blue,
strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
.averageLine(chartData: data,
strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
.xAxisGrid(chartData: data)
.yAxisGrid(chartData: data)
.xAxisLabels(chartData: data)
.yAxisLabels(chartData: data)
.infoBox(chartData: data)
.floatingInfoBox(chartData: data)
.headerBox(chartData: data)
.legends(chartData: data, columns: [GridItem(.flexible()), GridItem(.flexible())])
-
Initialises a line chart view.
Declaration
Swift
public init(chartData: ChartData)
Parameters
chartData
Must be LineChartData model.
-
Declaration
Swift
public var body: some View { get }