Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to archive annotation like SwiftUIChart #5212

Open
1 task done
Ramprasathselvam opened this issue Nov 29, 2024 · 0 comments
Open
1 task done

How to archive annotation like SwiftUIChart #5212

Ramprasathselvam opened this issue Nov 29, 2024 · 0 comments

Comments

@Ramprasathselvam
Copy link

Ramprasathselvam commented Nov 29, 2024

What did you do?

I'm try to archive annotation marker like swiftui charts RuleMark with annotation,
I tried with custom MarkerView with xib.

open class HistoryMarker: MarkerView {
    
    @IBOutlet weak var dateLable: UILabel!
    @IBOutlet weak var valueLabel: UILabel!
    
    var currentMonth: String = ""
    
    override open func awakeFromNib() {
        self.offset.x = -self.frame.size.width / 2.0
        self.offset.y = -self.frame.size.height - 7.0
    }
    open override func refreshContent(entry: ChartDataEntry, highlight: Highlight) {
        dateLable?.text = "\(Int(entry.x)) \(currentMonth)"
        valueLabel?.text = String.init(format: "%.1f", entry.y)
        layoutIfNeeded()
    }
}

let historyMarker: HistoryMarker = (HistoryMarker.viewFromXib() as? HistoryMarker)!
historyMarker.currentMonth = "Nov"
historyMarker.chartView = self
self.marker = historyMarker

What did you expect to happen?

This is what done in swuftUIchart

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-11-29.at.16.59.08.mp4

What happened instead?

reference.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant