Mercurial > public > stock-charts
comparison Sources/StockCharts/LineChart/Helpers/ChartLabel.swift @ 108:f53d8b9ca92b
Custom style implemented
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 04 Jul 2021 16:40:24 +0100 |
parents | 0c0d38dca6d8 |
children | 5057c45046c1 |
comparison
equal
deleted
inserted
replaced
107:b0c81b2e624d | 108:f53d8b9ca92b |
---|---|
9 | 9 |
10 public struct ChartLabel: View { | 10 public struct ChartLabel: View { |
11 public var data: [Double] | 11 public var data: [Double] |
12 public var dates: [String]? | 12 public var dates: [String]? |
13 public var hours: [String]? | 13 public var hours: [String]? |
14 public var style: LineChartStyle | |
14 | 15 |
15 @Binding var indexPosition: Int // Data point position | 16 @Binding var indexPosition: Int // Data point position |
16 | 17 |
17 public var body: some View { | 18 public var body: some View { |
18 HStack { | 19 HStack { |
27 Text(hour) | 28 Text(hour) |
28 .opacity(0.5) | 29 .opacity(0.5) |
29 } | 30 } |
30 | 31 |
31 Text("\(data[indexPosition], specifier: "%.2f")") | 32 Text("\(data[indexPosition], specifier: "%.2f")") |
32 .foregroundColor(Color.blue) | 33 .foregroundColor(style.labelColor) |
33 | 34 |
34 } | 35 } |
35 .font(.caption) | 36 .font(.caption) |
36 } | 37 } |
37 } | 38 } |