comparison InteractiveCharts/LineChart/Helpers/ChartLabel.swift @ 8:959175ee5ebd

Implement interaction with ChartView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Mon, 26 Apr 2021 23:06:42 +0200
parents f828c7c408d4
children
comparison
equal deleted inserted replaced
7:a9690565726b 8:959175ee5ebd
24 if let hours = self.hours { 24 if let hours = self.hours {
25 let hour = hours[indexPosition] 25 let hour = hours[indexPosition]
26 Text(hour) 26 Text(hour)
27 } 27 }
28 Text("\(data[indexPosition], specifier: "%.2f")") 28 Text("\(data[indexPosition], specifier: "%.2f")")
29 // .foregroundColor(colour) 29 .foregroundColor(Color(.systemBlue))
30 } 30 }
31 .font(.subheadline) 31 .font(.headline)
32 } 32 }
33 } 33 }
34 34
35 /* 35 /*
36 Take string in format yy-MM-dd (2021-01-01) and transform it 36 Take string in format yy-MM-dd (2021-01-01) and transform it
46 let finalDate = dateFormatter.string(from: date!) 46 let finalDate = dateFormatter.string(from: date!)
47 47
48 return finalDate 48 return finalDate
49 } 49 }
50 } 50 }
51
52 struct Label_Previews: PreviewProvider {
53 static var previews: some View {
54 ChartLabel(data: [10.0, 11.1, 10.5, 10.0, 11.9, 11.7, 10.4, 10.9], indexPosition: .constant(0))
55 }
56 }