ChartsOrg / ChartsOrg/Charts

How to archive annotation like SwiftUIChart

Open
#5,212 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

* [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).

## 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

## What happened instead?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.