Swiftpack.co - theo-brlle/chart-ui as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by theo-brlle.
theo-brlle/chart-ui 0.5.1
📈 A SwiftUI chart library
⭐️ 0
🕓 1 year ago
iOS
.package(url: "https://github.com/theo-brlle/chart-ui.git", from: "0.5.1")

ChartUI

A SwiftUI chart library.

Installation

ChartUI is compatible with SPM.

SPM

Just add this repo as a dependency of your project. Here is the repo URL: https://github.com/theo-brlle/chart-ui.git

Sample usage

Line chart (with one line)

First, import the library to your file.

import ChartUI

Then, create the data you want to display in the chart and create the LineChartView. Don't forget to give it a height with .frame(height:).

struct ContentView: View {
    let data = [
        LineChartSimplePlotData(key: "Jan 1st, 2022", value: FormattedChartValue(value: CGFloat(990), formatted: "990 €")),
        LineChartSimplePlotData(key: "Jan 2nd, 2022", value: FormattedChartValue(value: CGFloat(1300), formatted: "1 300 €")),
        LineChartSimplePlotData(key: "Jan 3rd, 2022", value: FormattedChartValue(value: CGFloat(1200), formatted: "1 200 €")),
        LineChartSimplePlotData(key: "Jan 4th, 2022", value: FormattedChartValue(value: CGFloat(600), formatted: "600 €")),
        LineChartSimplePlotData(key: "Jan 5th, 2022", value: FormattedChartValue(value: CGFloat(500), formatted: "500 €")),
        LineChartSimplePlotData(key: "Jan 6th, 2022", value: FormattedChartValue(value: CGFloat(600), formatted: "600 €")),
        LineChartSimplePlotData(key: "Jan 7th, 2022", value: FormattedChartValue(value: CGFloat(1100), formatted: "1 100 €"))
    ]

    var body: some View {
        LineChartView(type: .oneLine(data: oneLineData, detailsViewLabel: "PRICE"))
            .frame(height: 250)
            .padding()
    }
}

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.5.1
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics