1234567891011121314151617181920212223242526272829303132 |
- //
- // XYMarkerView.swift
- // ChartsDemo
- // Copyright © 2016 dcg. All rights reserved.
- //
- import Foundation
- import Charts
- #if canImport(UIKit)
- import UIKit
- #endif
- open class XYMarkerView: BalloonMarker
- {
- @objc open var xAxisValueFormatter: AxisValueFormatter?
- fileprivate var yFormatter = NumberFormatter()
-
- @objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets,
- xAxisValueFormatter: AxisValueFormatter)
- {
- super.init(color: color, font: font, textColor: textColor, insets: insets)
- self.xAxisValueFormatter = xAxisValueFormatter
- yFormatter.minimumFractionDigits = 1
- yFormatter.maximumFractionDigits = 1
- }
-
- open override func refreshContent(entry: ChartDataEntry, highlight: Highlight)
- {
- setLabel("x: " + xAxisValueFormatter!.stringForValue(entry.x, axis: nil) + ", y: " + yFormatter.string(from: NSNumber(floatLiteral: entry.y))!)
- }
-
- }
|