AppPear / ChartView

ChartView made in SwiftUI
MIT License
5.25k stars 645 forks source link

labels not working on v2? #246

Open nimrodbens opened 1 year ago

nimrodbens commented 1 year ago

tried this code:

import SwiftUI
import SwiftUICharts

struct TestView: View {
    var body: some View {
        PieChart()
            .data([("Rent", 1300), ("Transport", 500)])
            .chartStyle(.init(backgroundColor: .greenRed, foregroundColor: [.redBlack, .orangeBright]))
    }
}

struct TestView_Previews: PreviewProvider {
    static var previews: some View {
        TestView()
    }
}

and no labels are shown. both in landscape and portrait mode.

results can be seen here: https://imgur.com/a/n1EDas0

app4g commented 1 year ago

Looking thru the code for V2, it really doesn't seems like it's implemented. you can see that the code will separate out the DataPoints and the Label Strings, but it only uses the DataPoints and the Label Strings are not used at all. (at least I can't locate where they are within the BarChart codes)

app4g commented 1 year ago

Check this --> https://github.com/AppPear/ChartView/issues/243#issue-1258260740

Managed to get it done