data-visualization/DSLineChart

DSLineChart

data-visualization
since v2.0

Animated line chart with a gradient fill, interactive tooltip on long-press, and configurable axes.

iOS 17+macOS 14+

Purpose

Trend visualisation in analytics dashboards.

Props

PropTypeDefaultDescription
datareq[DSChartDataPoint]โ€”Array of (label, value) pairs.
tintColorDSColor.primaryLine and gradient colour.
showGridBooltrueShows horizontal grid lines.
showTooltipBooltrueEnables long-press tooltip.
heightCGFloat200Chart height.

Examples

Revenue trend

7-day revenue line chart.

swift
DSLineChart(
    data: [
        DSChartDataPoint(label: "Mon", value: 42000),
        DSChartDataPoint(label: "Tue", value: 51000),
        DSChartDataPoint(label: "Wed", value: 47000),
        DSChartDataPoint(label: "Thu", value: 63000),
        DSChartDataPoint(label: "Fri", value: 58000),
        DSChartDataPoint(label: "Sat", value: 71000),
        DSChartDataPoint(label: "Sun", value: 82000),
    ],
    tint: DSColor.primary,
    height: 220
)

Related Components