data-visualization/DSBarChartWidget

DSBarChartWidget

data-visualization
since 0.1.0

Card with a title and a set of labeled vertical bars.

iOS 17+macOS 14+watchOS 10+tvOS 17+visionOS 1+

Purpose

Compare values across a small number of categories, such as sales per weekday or tickets per team.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

Props

PropTypeDefaultDescription
titlereqString—Card title.
subtitleString?nilSecondary line under the title.
barsreq[DSBarChartWidget.Bar]—Bars to draw. Each Bar has a label, value and color (default DSColor.primary).
showValuesBooltruePrints each value above its bar.

Examples

Sales per weekday

Highlight the best day with a different color.

swift
DSBarChartWidget(
    title: "Sales",
    subtitle: "This week",
    bars: [
        .init(label: "Mon", value: 12),
        .init(label: "Tue", value: 18),
        .init(label: "Wed", value: 25, color: DSColor.success),
        .init(label: "Thu", value: 16),
        .init(label: "Fri", value: 21),
    ]
)

Related Components