Mercurial > public > stock-charts
comparison Sources/StockCharts/LineChart/Helpers/LineView.swift @ 106:0c0d38dca6d8
Change colours to native swiftUI
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 28 Jun 2021 13:48:03 +0200 |
parents | 766a1169564b |
children | f53d8b9ca92b |
comparison
equal
deleted
inserted
replaced
105:facd63329f23 | 106:0c0d38dca6d8 |
---|---|
56 | 56 |
57 /* | 57 /* |
58 Color path depending on data. | 58 Color path depending on data. |
59 */ | 59 */ |
60 public func colorLine() -> Color { | 60 public func colorLine() -> Color { |
61 #if os(iOS) | 61 var color = Color.green |
62 let blue = Color(.systemBlue) | |
63 let teal = Color(.systemTeal) | |
64 let red = Color(.systemRed) | |
65 | |
66 var color = Color(.systemGreen) | |
67 #elseif os(watchOS) | |
68 let blue = Color(.blue) | |
69 let teal = Color(.blue) | |
70 let red = Color(.red) | |
71 | |
72 var color = Color(.green) | |
73 #endif | |
74 | 62 |
75 if showingIndicators { | 63 if showingIndicators { |
76 color = blue | 64 color = Color.blue |
77 } else if data.first! > data.last! { | 65 } else if data.first! > data.last! { |
78 color = red | 66 color = Color.red |
79 } else if data.first! == data.last! { | 67 } else if data.first! == data.last! { |
80 color = teal | 68 color = Color.blue |
81 } | 69 } |
82 | 70 |
83 return color | 71 return color |
84 } | 72 } |
85 | 73 |