Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b2b0b83b4b | |||
| 94a98ee2c7 | |||
| da015797dd | |||
| 617297cbcd | |||
| 3909818a3f | |||
| df24b3d1c2 | |||
| 07a16d5548 |
Generated
BIN
Binary file not shown.
@@ -69,6 +69,20 @@ Customizable:
|
||||
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", style: chartStyle)
|
||||
```
|
||||
|
||||
You can access built-in styles:
|
||||
```swift
|
||||
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", style: Styles.barChartMidnightGreen)
|
||||
```
|
||||
#### All styles available as a preset:
|
||||
* barChartStyleOrangeLight
|
||||
* barChartStyleOrangeDark
|
||||
* barChartStyleNeonBlueLight
|
||||
* barChartStyleNeonBlueDark
|
||||
* barChartMidnightGreenLight
|
||||
* barChartMidnightGreenDark
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public struct BarChartView : View {
|
||||
var isFullWidth:Bool {
|
||||
return self.style.chartFormSize == Form.large
|
||||
}
|
||||
public init(data: [Int], title: String, legend: String? = nil, style: ChartStyle = Styles.barChartStyleOne ){
|
||||
public init(data: [Int], title: String, legend: String? = nil, style: ChartStyle = Styles.barChartStyleOrangeLight ){
|
||||
self.data = data
|
||||
self.title = title
|
||||
self.legend = legend
|
||||
|
||||
@@ -40,7 +40,7 @@ public struct Styles {
|
||||
textColor: Color.black,
|
||||
legendTextColor: Color.gray)
|
||||
|
||||
public static let barChartStyleOne = ChartStyle(
|
||||
public static let barChartStyleOrangeLight = ChartStyle(
|
||||
backgroundColor: Color.white,
|
||||
accentColor: Colors.OrangeStart,
|
||||
secondGradientColor: Colors.OrangeEnd,
|
||||
@@ -48,7 +48,15 @@ public struct Styles {
|
||||
textColor: Color.black,
|
||||
legendTextColor: Color.gray)
|
||||
|
||||
public static let barChartStyleTwo = ChartStyle(
|
||||
public static let barChartStyleOrangeDark = ChartStyle(
|
||||
backgroundColor: Color.black,
|
||||
accentColor: Colors.OrangeStart,
|
||||
secondGradientColor: Colors.OrangeEnd,
|
||||
chartFormSize: Form.medium,
|
||||
textColor: Color.white,
|
||||
legendTextColor: Color.gray)
|
||||
|
||||
public static let barChartStyleNeonBlueLight = ChartStyle(
|
||||
backgroundColor: Color.white,
|
||||
accentColor: Colors.GradientNeonBlue,
|
||||
secondGradientColor: Colors.GradientPurple,
|
||||
@@ -56,7 +64,7 @@ public struct Styles {
|
||||
textColor: Color.black,
|
||||
legendTextColor: Color.gray)
|
||||
|
||||
public static let barChartStyleThree = ChartStyle(
|
||||
public static let barChartStyleNeonBlueDark = ChartStyle(
|
||||
backgroundColor: Color.black,
|
||||
accentColor: Colors.GradientNeonBlue,
|
||||
secondGradientColor: Colors.GradientPurple,
|
||||
@@ -64,8 +72,8 @@ public struct Styles {
|
||||
textColor: Color.white,
|
||||
legendTextColor: Color.gray)
|
||||
|
||||
public static let barChartMidnightGreen = ChartStyle(
|
||||
backgroundColor: Color(hexString: "#3B5147"), //3B5147, 313D34
|
||||
public static let barChartMidnightGreenDark = ChartStyle(
|
||||
backgroundColor: Color(hexString: "#36534D"), //3B5147, 313D34
|
||||
accentColor: Color(hexString: "#FFD603"),
|
||||
secondGradientColor: Color(hexString: "#FFCA04"),
|
||||
chartFormSize: Form.medium,
|
||||
|
||||
@@ -33,7 +33,7 @@ public struct LineChartView: View {
|
||||
self.style = style
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
public var body: some View {
|
||||
ZStack(alignment: .center){
|
||||
RoundedRectangle(cornerRadius: 20).fill(self.style.backgroundColor).frame(width: frame.width, height: 240, alignment: .center).shadow(radius: 8)
|
||||
VStack(alignment: .leading){
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 222 KiB |
Reference in New Issue
Block a user