Files
ChartView/Sources/SwiftUICharts/Base/Style/ChartStyle.swift
Dan WoodandDan Wood 51db5a067a Issue 99 documentation (#159)
* Starting on filling in documentation.

* First pass on most/all files

* more descriptions filled in

* Some documentation but TBH the author would be better suited to explain how this works!

* more basic stuff filled in

* Add a description and bunch of discussion text for most of the view `body` declarations

* more explanations

Co-authored-by: Dan Wood <danwood@users.noreply.github.com>
2020-08-24 16:30:30 +02:00

48 lines
1.8 KiB
Swift

import SwiftUI
/// Descripton of colors/styles for any kind of chart
public class ChartStyle: ObservableObject {
/// colors for background are of chart
public let backgroundColor: ColorGradient
/// colors for foreground fill of chart
public let foregroundColor: [ColorGradient]
/// Initialize with a single background color and an array of `ColorGradient` for the foreground
/// - Parameters:
/// - backgroundColor: a `Color`
/// - foregroundColor: array of `ColorGradient`
public init(backgroundColor: Color, foregroundColor: [ColorGradient]) {
self.backgroundColor = ColorGradient.init(backgroundColor)
self.foregroundColor = foregroundColor
}
/// Initialize with a single background color and a single `ColorGradient` for the foreground
/// - Parameters:
/// - backgroundColor: a `Color`
/// - foregroundColor: a `ColorGradient`
public init(backgroundColor: Color, foregroundColor: ColorGradient) {
self.backgroundColor = ColorGradient.init(backgroundColor)
self.foregroundColor = [foregroundColor]
}
/// Initialize with a single background `ColorGradient` and a single `ColorGradient` for the foreground
/// - Parameters:
/// - backgroundColor: a `ColorGradient`
/// - foregroundColor: a `ColorGradient`
public init(backgroundColor: ColorGradient, foregroundColor: ColorGradient) {
self.backgroundColor = backgroundColor
self.foregroundColor = [foregroundColor]
}
/// Initialize with a single background `ColorGradient` and an array of `ColorGradient` for the foreground
/// - Parameters:
/// - backgroundColor: a `ColorGradient`
/// - foregroundColor: array of `ColorGradient`
public init(backgroundColor: ColorGradient, foregroundColor: [ColorGradient]) {
self.backgroundColor = backgroundColor
self.foregroundColor = foregroundColor
}
}