<!--
{
  "availability" : [
    "iOS: 16.4.0 -",
    "iPadOS: 16.4.0 -",
    "macCatalyst: 16.4.0 -",
    "macOS: 13.3.0 -",
    "tvOS: 16.4.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/ChartProxy/foregroundStyle(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift Charts",
      "Charts"
    ],
    "preciseIdentifier" : "s:6Charts10ChartProxyV15foregroundStyle3for7SwiftUI08AnyShapeE0VSgx_tAA9PlottableRzlF"
  },
  "title" : "foregroundStyle(for:)"
}
-->

# foregroundStyle(for:)

Returns the foreground style for the given data value.
Returns `nil` if the foreground style scale is unavailable,
or the value is invalid.

```
func foregroundStyle<P>(for value: P) -> AnyShapeStyle? where P : Plottable
```

## Parameters

`value`

The data value.

## Return Value

The foreground style corresponding to the data value,
or `nil` if the data value is incompatible with the chart.

---

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)