Repository Public MIT
1{2 "accessibility" : [3 "Every mark has an accessibility label (series and position) and value (formatted number and unit), so the chart can be explored element by element and with the system's audio graph.",4 "A sentence per series states the number of values, the first and last positions, the minimum, the maximum and the trend. It is visible under the plot, or kept as an accessibility-only element when `showsSummary` is `false`.",5 "Series never rely on colour alone: the legend names them and line charts add a distinct symbol per series.",6 "Numbers and dates are formatted with `FormatStyle` in the environment's locale and time zone."7 ],8 "category" : "data",9 "changelog" : [10 {11 "changes" : [12 "Initial release."13 ],14 "date" : "2026-12-02",15 "version" : "1.0.0"16 }17 ],18 "dependencies" : [19 {20 "id" : "glass-data-support",21 "version" : "1.0.0"22 },23 {24 "id" : "glass-foundation",25 "version" : "1.0.0"26 }27 ],28 "description" : "Swift Charts line, bar and area charts with axes, units and accessible descriptions.",29 "examples" : [30 {31 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassChartExample: GlassExample {\n public static let componentID = \"glass-chart\"\n\n // Fictitious data: energy produced by two imaginary sites.\n private static let months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"]\n private static let north: [Double] = [42, 48, 55, 61, 58, 70]\n private static let south: [Double] = [65, 60, 57, 52, 49, 44]\n\n private static let production: [GlassChartPoint] =\n zip(months, north).map { GlassChartPoint(label: $0, value: $1, series: \"North\") }\n + zip(months, south).map { GlassChartPoint(label: $0, value: $1, series: \"South\") }\n\n private static let visits: [GlassChartPoint] = {\n let start = Date(timeIntervalSince1970: 1_780_272_000)\n let values: [Double] = [120, 135, 128, 160, 190, 240, 210]\n return values.enumerated().map { GlassChartPoint(date: start.addingTimeInterval(Double($0.offset) * 86_400), value: $0.element) }\n }()\n\n @State private var kind = GlassChartKind.line\n @State private var series = \"All\"\n\n public init() {}\n\n private var visibleProduction: [GlassChartPoint] {\n series == \"All\" ? Self.production : Self.production.filter { $0.series == series }\n }\n\n public var body: some View {\n ScrollView {\n VStack(spacing: 16) {\n Picker(\"Mark\", selection: $kind) {\n Text(\"Line\").tag(GlassChartKind.line)\n Text(\"Bar\").tag(GlassChartKind.bar)\n Text(\"Area\").tag(GlassChartKind.area)\n }\n .pickerStyle(.segmented)\n\n GlassChart(\"Energy produced\", points: visibleProduction, kind: kind, xAxisTitle: \"Month\", yAxisTitle: \"Energy\", unit: \"MWh\") {\n Picker(\"Series\", selection: $series) {\n Text(\"All\").tag(\"All\")\n ForEach(GlassChartLogic.seriesNames(Self.production), id: \\.self) { Text(verbatim: $0).tag($0) }\n }\n .pickerStyle(.menu)\n }\n\n GlassChart(\"Daily visits\", points: Self.visits, kind: .area, xAxisTitle: \"Day\", yAxisTitle: \"Visits\")\n\n GlassChart(\"Nothing measured yet\", points: [])\n }\n .padding()\n }\n }\n}\n\n#Preview(\"GlassChart\") { GlassChartExample().glassTheme(.ocean) }\n",32 "title" : "GlassChart example"33 }34 ],35 "files" : [36 {37 "bytes" : 9208,38 "path" : "Data/Data/GlassChart.swift",39 "sha256" : "5156754cb70aa4dcc366283e7451fc7b1b7d873c07e879274b133d4d7f070087"40 },41 {42 "bytes" : 9512,43 "path" : "Data/Data/GlassChartModel.swift",44 "sha256" : "5b292d3c19381dc18716642ed0cff3a806b23b2dd7760fcc18a4603195db0c69"45 }46 ],47 "frameworks" : [48 "Charts"49 ],50 "id" : "glass-chart",51 "kind" : "content-component",52 "license" : "MIT",53 "minimumOS" : {54 "iOS" : "26.0",55 "iPadOS" : "26.0",56 "macOS" : "26.0"57 },58 "name" : "GlassChart",59 "platforms" : [60 "iOS",61 "iPadOS",62 "macOS"63 ],64 "schemaVersion" : 1,65 "sha256" : "b96ab720cf3b10edab3963bc4f7d9c07daa8aa76258093d71aa4c7669d824930",66 "symbols" : [67 "GlassChart",68 "GlassChartKind",69 "GlassChartX",70 "GlassChartPoint",71 "GlassChartSummary",72 "GlassChartLogic"73 ],74 "version" : "1.0.0"75}76