---
title: "position(by:axis:span:)"
framework: charts
role: symbol
role_heading: Instance Method
path: "charts/chartcontent/position(by:axis:span:)"
---

# position(by:axis:span:)

Represents data using position.

## Declaration

```swift
nonisolated func position<P>(by value: PlottableValue<P>, axis: Axis? = nil, span: MarkDimension = .automatic) -> some ChartContent where P : Plottable

```

## Parameters

- `value`: The data used for positioning marks.
- `axis`: The axis to position marks along. Set this to nil to use a default configuration.
- `span`: The span of the positioned marks. Use this to control the total amount space available to the marks.

## Discussion

Discussion The code below creates a grouped bar chart that positions marks with the same “product” along the horizontal axis by their “type”. Chart(cars) {     BarMark(         x: .value("product", $0.product),         y: .value("price", $0.price)     )     .position(by: .value("type", $0.type), axis: .horizontal) }

## See Also

### Encoding data into mark characteristics

- [foregroundStyle(by:)](charts/chartcontent/foregroundstyle(by:).md)
- [lineStyle(by:)](charts/chartcontent/linestyle(by:).md)
- [symbol(by:)](charts/chartcontent/symbol(by:).md)
- [symbolSize(by:)](charts/chartcontent/symbolsize(by:).md)
