# Bring your own shape (Unit example)

> WestCoast Charts 1.1.5, release, public Core release, on npm. HTML: https://westcoast-charts.com/gallery/unit/bring-your-own-shape/ · Index for agents: https://westcoast-charts.com/llms.txt

A mountain outline drawn from plain coordinates with shapeFrom().

- Chart type: `unit` (Unit)
- Collection: Unit · Unit & pictogram
- Raw configuration: https://westcoast-charts.com/gallery-src/unit/bring-your-own-shape.js
- Standalone example: https://westcoast-charts.com/embed/samples/wcc/gallery/unit/bring-your-own-shape.html

## Setup

```js
import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'

WestCoastCharts.use(types)
```

## Options

```js
const options = {
  chart: {
    height: 380,
    fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
    type: "unit",
    toolbar: {
      show: false
    }
  },
  series: [140, 90, 60],
  labels: ["Summited", "Base camp", "Turned back"],
  colors: ["#0f766e", "#14b8a6", "#cbd5e1"],
  plotOptions: {
    unit: {
      positions: {
        name: "ridge",
        category: "custom",
        kind: "silhouette",
        rings: [
          [
            [0, 1],
            [0.21428571428571427, 0.4],
            [0.32142857142857145, 0.6],
            [0.5, 0],
            [0.6785714285714286, 0.5],
            [0.7857142857142857, 0.35],
            [1, 1]
          ]
        ],
        source: "user",
        minUnits: 1,
        aspect: 1.4,
        order: "rowsUp",
        shape: {
          name: "ridge",
          category: "custom",
          kind: "silhouette",
          minUnits: 1,
          order: "rowsUp",
          source: "user"
        },
        with: e=>St({...t,...e||{}}),
        outlined: function outlined(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.16;const n=t.rings.map(t=>{const n=t.reduce((t,e)=>t+e[0],0)/t.length,a=t.reduce((t,e)=>t+e[1],0)/t.length;return t.map(t=>{let o=b(t,2);return[n+(o[0]-n)*(1-e),a+(o[1]-a)*(1-e)]})});return St({...t,name:t.name+"-outlined",kind:"stroke",rings:t.rings.concat(n)})},
        fill: (t,n)=>wt(e,t,n),
        isUnitShape: true
      }
    }
  },
  title: {
    text: "Expedition outcomes (290 climbers)"
  },
  theme: {
    mode: "light",
    preset: "coastal"
  }
}

const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render()
```

## Verify

- Text check (Library 1.1.5): load `west-coast-charts/agent/describe` and call `chart.describe({ format: "json" })` for the actual drawn state. The live reader is on this example’s HTML page.
- Command line (Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm, https://westcoast-charts.com/docs/cli/index.md): `wcc chart export unit-bring-your-own-shape.json --out unit-bring-your-own-shape.svg --with-table` (save the options above as JSON first)
