data-visualization/DSLineChartWidget

DSLineChartWidget

data-visualization
since 0.1.0

Card with a title and one or more line series drawn over shared x-axis labels.

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

Purpose

Show how one or more values change over time, such as revenue per month or daily active users.

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.
xLabelsreq[String]—Labels along the x-axis, one per data point.
seriesreq[DSLineChartWidget.Series]—Lines to draw. Each Series has a label, values and color.

Examples

Revenue vs. costs

Two series over six months.

swift
DSLineChartWidget(
    title: "Revenue",
    subtitle: "Last 6 months",
    xLabels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    series: [
        .init(label: "Revenue", values: [12, 18, 15, 22, 28, 31], color: DSColor.primary),
        .init(label: "Costs", values: [8, 9, 11, 10, 12, 13], color: DSColor.error),
    ]
)

Related Components