You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Xcode 8.3.1 force us to use swift 3.x. So I pull in Charts with 3.x version. I have a swift class that uses old ChartMarker after apple's wizard of convert swift version. It seems there is no longer ChartMarker in Swift 3.x. What is the equivalent of that, and could someone help me fix these piece of codes? Thank you in advance!
import Foundation
import UIKit;
import Charts;
open class BalloonMarker: ChartMarker
{
open var bounds = CGRect()
open var dates = NSArray()
open var values = NSArray()
fileprivate var referenceVal = Double()
fileprivate var _size: CGSize = CGSize()
fileprivate var tooltipView: TooltipView
open override func draw(context: CGContext, point: CGPoint)
{
var rect = CGRect(origin: point, size: self.tooltipView.bounds.size)
let midY = (self.bounds.origin.y + (self.bounds.size.height / 2))
let midX = (self.bounds.origin.x + (self.bounds.size.width / 2))
if (point.y > midY) {
rect.origin.y -= rect.size.height
}
if (point.x > midX) {
rect.origin.x -= rect.size.width
}
self.tooltipView.frame = rect
}
open override func refreshContent(entry: ChartDataEntry, highlight: ChartHighlight)
{
let date = self.dates[entry.xIndex] as! NSString
let value = self.values[entry.xIndex] as! Double
self.tooltipView.setItemWithDate(date as String, withValue: value, withReferenceValue: self.referenceVal)
}
}
The text was updated successfully, but these errors were encountered:
Xcode 8.3.1 force us to use swift 3.x. So I pull in Charts with 3.x version. I have a swift class that uses old ChartMarker after apple's wizard of convert swift version. It seems there is no longer ChartMarker in Swift 3.x. What is the equivalent of that, and could someone help me fix these piece of codes? Thank you in advance!
import Foundation
import UIKit;
import Charts;
open class BalloonMarker: ChartMarker
{
open var bounds = CGRect()
open var dates = NSArray()
open var values = NSArray()
fileprivate var referenceVal = Double()
fileprivate var _size: CGSize = CGSize()
fileprivate var tooltipView: TooltipView
public init(dates: NSArray, values: NSArray, bounds: CGRect, tooltipView: TooltipView)
{
self.tooltipView = tooltipView
_size = tooltipView.frame.size
super.init()
}
open override var size: CGSize { return _size; }
open override func draw(context: CGContext, point: CGPoint)
{
var rect = CGRect(origin: point, size: self.tooltipView.bounds.size)
let midY = (self.bounds.origin.y + (self.bounds.size.height / 2))
let midX = (self.bounds.origin.x + (self.bounds.size.width / 2))
if (point.y > midY) {
rect.origin.y -= rect.size.height
}
}
open override func refreshContent(entry: ChartDataEntry, highlight: ChartHighlight)
{
let date = self.dates[entry.xIndex] as! NSString
let value = self.values[entry.xIndex] as! Double
self.tooltipView.setItemWithDate(date as String, withValue: value, withReferenceValue: self.referenceVal)
}
}
The text was updated successfully, but these errors were encountered: