Coreplot legend with title, country label and under that line in swift

Viewed 192

How to display the coreplot legend like this?

country flag,country name under that line(resembled in the graph)

enter image description here func configureLegend() { guard let graph = hostView.hostedGraph else { return }

    let legend = CPTLegend(graph: graph)
    graph.legend = legend
    graph.legendAnchor = .topLeft
    graph.legendDisplacement = CGPoint(x: 50.0, y: -2.0)
    legend.fill = CPTFill(color: CPTColor.clear())
    legend.swatchSize = CGSize(width: 10.0, height: 10.0)
    legend.numberOfRows = 1
    legend.entryPaddingBottom = 12
    let titleStyle = CPTMutableTextStyle()
    titleStyle.color = CPTColor.black()
    titleStyle.fontSize = 6.0
    titleStyle.fontName = Font.NissanPro_Bold
    legend.textStyle = titleStyle
    legend.delegate = self
}
public func legend(_ legend: CPTLegend, shouldDrawSwatchAt idx: UInt, for plot: CPTPlot, in rect: CGRect, in context: CGContext) -> Bool{
    return false
}
1 Answers
Related