<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/PlottableValue",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts14PlottableValueV"
  },
  "title" : "PlottableValue"
}
-->

# PlottableValue

Labeled data that you plot in a chart using marks.

```
struct PlottableValue<Value> where Value : Plottable
```

## Overview

Provide a `PlottableValue` to a `Mark` property (e.g., x, y, foregroundStyle)
to plot data values with the mark property.

> Important: The data type must conform to ``doc://com.apple.Charts/documentation/Charts/Plottable``. This is
> a numeric value like a
> <doc://com.apple.documentation/documentation/Swift/Double> or
> <doc://com.apple.documentation/documentation/Swift/Int16>
> for quantitative data,
> <doc://com.apple.documentation/documentation/Foundation/Date>
> for temporal data, or
> <doc://com.apple.documentation/documentation/Swift/String>
> for categorical data.

You can use the `.value("Category", \.category)` shorthand to create a `PlottableValue`.
The example below plots category, value, and group with the bar mark’s x, y,
and foregroundStyle.

```swift
struct Bar {
    let category: String
    let value: Double
    let group: String
}

let data: [Bar] = [
    Bar(category: "A", value: 20, group: "Group 1"),
    Bar(category: "A", value: 30, group: "Group 2"),
    Bar(category: "A", value: 10, group: "Group 3"),
    Bar(category: "B", value: 40, group: "Group 1"),
    Bar(category: "B", value: 20, group: "Group 2"),
    Bar(category: "B", value: 10, group: "Group 3"),
    //...
]

var body: some View {
    Chart(data) {
        BarMark(
            x: .value("Category", $0.category),
            y: .value("Quantity", $0.value)
        )
        .foregroundStyle(.value("Group", $0.group))
    }
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)