1234567891011121314151617181920212223242526272829303132333435 |
- //
- // XYMarkerView.swift
- // ChartsDemo-iOS
- //
- // Created by Jacob Christie on 2017-07-09.
- // Copyright © 2017 jc. All rights reserved.
- //
- import Foundation
- import Charts
- #if canImport(UIKit)
- import UIKit
- #endif
- public class XYMarkerView: BalloonMarker {
- public var xAxisValueFormatter: AxisValueFormatter
- fileprivate var yFormatter = NumberFormatter()
-
- public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets,
- xAxisValueFormatter: AxisValueFormatter) {
- self.xAxisValueFormatter = xAxisValueFormatter
- yFormatter.minimumFractionDigits = 1
- yFormatter.maximumFractionDigits = 1
- super.init(color: color, font: font, textColor: textColor, insets: insets)
- }
-
- public override func refreshContent(entry: ChartDataEntry, highlight: Highlight) {
- let string = "x: "
- + xAxisValueFormatter.stringForValue(entry.x, axis: XAxis())
- + ", y: "
- + yFormatter.string(from: NSNumber(floatLiteral: entry.y))!
- setLabel(string)
- }
-
- }
|