Coreplot designation with heading, country label and below this line in quick

How to display the kernel kernel legend like this?

country flag, country name under this line (similar to the chart)

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
}
+4
source share
1 answer

If you can draw flags using emoji, do it. Insert a newline character ( \n) in the title text to place the text under the flag.

, delegate -legend:shouldDrawSwatchAtIndex:forPlot:inRect:inContext: . swatch NO, , .

, .

0

Source: https://habr.com/ru/post/1683432/


All Articles