|
|
@@ -16,18 +16,6 @@ final class OverrideFillFormatter: IFillFormatter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-final class CarbFillFormatter: IFillFormatter {
|
|
|
- func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat {
|
|
|
- return 315
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-final class BolusFillFormatter: IFillFormatter {
|
|
|
- func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat {
|
|
|
- return 345
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
final class basalFillFormatter: IFillFormatter {
|
|
|
func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat {
|
|
|
return 0
|
|
|
@@ -83,52 +71,6 @@ final class ChartYMMOLValueFormatter: IAxisValueFormatter {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-class ChartMarker: MarkerView {
|
|
|
- private var text = String()
|
|
|
-
|
|
|
- private let drawAttributes: [NSAttributedString.Key: Any] = [
|
|
|
- .font: UIFont.systemFont(ofSize: 15),
|
|
|
- //.foregroundColor: UIColor.white,
|
|
|
- //.backgroundColor: UIColor.darkGray
|
|
|
- .foregroundColor: UIColor.label,
|
|
|
- .backgroundColor: UIColor.secondarySystemBackground
|
|
|
- ]
|
|
|
-
|
|
|
- override func refreshContent(entry: ChartDataEntry, highlight: Highlight) {
|
|
|
- if entry.data != nil {
|
|
|
- text = entry.data as? String ?? ""
|
|
|
- } else {
|
|
|
- text = String(entry.y)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- override func draw(context: CGContext, point: CGPoint) {
|
|
|
- super.draw(context: context, point: point)
|
|
|
-
|
|
|
- let sizeForDrawing = text.size(withAttributes: drawAttributes)
|
|
|
- bounds.size = sizeForDrawing
|
|
|
- offset = CGPoint(x: -sizeForDrawing.width / 2, y: -sizeForDrawing.height - 4)
|
|
|
-
|
|
|
- let offset = offsetForDrawing(atPoint: point)
|
|
|
- let originPoint = CGPoint(x: point.x + offset.x, y: point.y + offset.y)
|
|
|
- let rectForText = CGRect(origin: originPoint, size: sizeForDrawing)
|
|
|
- drawText(text: text, rect: rectForText, withAttributes: drawAttributes)
|
|
|
- }
|
|
|
-
|
|
|
- private func drawText(text: String, rect: CGRect, withAttributes attributes: [NSAttributedString.Key: Any]? = nil) {
|
|
|
- let size = bounds.size
|
|
|
- let centeredRect = CGRect(
|
|
|
- x: rect.origin.x + (rect.size.width - size.width) / 2,
|
|
|
- y: rect.origin.y + (rect.size.height - size.height) / 2,
|
|
|
- width: size.width,
|
|
|
- height: size.height
|
|
|
- )
|
|
|
- text.draw(in: centeredRect, withAttributes: attributes)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
class PillMarker: MarkerImage {
|
|
|
|
|
|
private (set) var color: UIColor
|