iOS图表库:在折线图中,图例重叠

时间:2018-08-06 06:37:05

标签: ios swift mpandroidchart ios-charts

我正在我的应用程序中使用此图表库https://github.com/danielgindi/Charts。我从中实现了折线图,图例彼此重叠。我不确定这里出了什么问题,我确实玩过很多传说的不同属性,但最后并没有很好地工作。这是添加图例的代码。

    ledgendEntries = [LegendEntry]()

    let legendEntry1 = LegendEntry(label: "Legend 1 Title", form: Legend.Form.circle, formSize: CGFloat.nan, formLineWidth: CGFloat.nan, formLineDashPhase: 1.0, formLineDashLengths: nil, formColor: UIColor.orange)

    let legendEntry2 = LegendEntry(label: "Legend 2 Title", form: Legend.Form.circle, formSize: CGFloat.nan, formLineWidth: CGFloat.nan, formLineDashPhase: 1.0, formLineDashLengths: nil, formColor: UIColor.orange)

    let legendEntry3 = LegendEntry(label: "Legend 3 Title", form: Legend.Form.circle, formSize: CGFloat.nan, formLineWidth: CGFloat.nan, formLineDashPhase: 1.0, formLineDashLengths: nil, formColor: UIColor.orange)

    ledgendEntries.append(legendEntry1)
    ledgendEntries.append(legendEntry2)
    ledgendEntries.append(legendEntry3)

    lineChartView.legend.entries = ledgendEntries
    lineChartView.legend.enabled = true

enter image description here

0 个答案:

没有答案