Swiftpack.co - ybubnov/PlotUI as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ybubnov.
ybubnov/PlotUI 0.5.0
Integrate beautiful minimalistic plots into your app.
⭐️ 33
🕓 1 year ago
iOS macOS watchOS
.package(url: "https://github.com/ybubnov/PlotUI.git", from: "0.5.0")

PlotUI · Tests

Integrate beautiful minimalistic plots into your app.

Installation

You can use PlotUI as package dependency to your app using Xcode:

github.com/ybubnov/PlotUI

Documentation

The PlotUI Documentation contains additional details on how to get started with PlotUI.

Usage

Define your plot using the PlotView structure, and populate it with concrete data representation, like BarView, to render data in your app's user interface.

The following example creates a bar chart with 3 data points, where horizontal ticks are labeled with week days instead of numbers:

PlotView {
    BarView(
        x: [3, 4, 5],
        y: [2000, 2100, 2300]
    )
} horizontal: {
    HAxis(
        ticks: [1, 2, 3, 4, 5],
        labels: ["Sun", "Mon", "Tue", "Wed", "Thu"]
    )
} vertical: {
    VAxis(ticks: [1000, 2000, 3000])
}
.contentDisposition(minX: 1, maxX: 5, minY: 0, maxY: 3000)
.frame(width: 500, height: 300)

You can use LineView to define a line chart:

PlotView{
    LineView(
        x: [0, 1, 2, 3, 4, 5],
        y: [10, 20, 0, 45, 30, 50]
    )
}
.tickInsets(bottom: 20, trailing: 20)
.contentDisposition(minX: -5, maxX: 15, minY: 0)
.frame(width: 600, height: 300)

License

PlotUI is MIT licensed.

GitHub

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

Release Notes

0.5.0
1 year ago

What's Changed

Full Changelog: https://github.com/ybubnov/PlotUI/compare/0.4.0...0.5.0

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