# Text mark for binned lines

**URL:** <https://talk.observablehq.com/t/text-mark-for-binned-lines/8572>\
**Category:** Help\
**Created:** [December 6, 2023, 6:21pm UTC](https://talk.observablehq.com/t/text-mark-for-binned-lines/8572 "2023-12-06T18:21:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rusosnith](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/rusosnith/32/6367_2.png) [@rusosnith](https://talk.observablehq.com/u/rusosnith)\
**Post date:** [December 6, 2023, 6:21pm UTC](https://talk.observablehq.com/t/text-mark-for-binned-lines/8572/1 "2023-12-06T18:21:35Z")

</div>

So, I have the usual multiline Plot graph with labels placed at the end of the lines using the Text Mark and SelectLast. It works if the data comes already summarized but If I have to bin the data with plot.binX I cannot make it work.

¿What am I doing wrong?

```
Plot.text(
  delitos,
  Plot.selectLast(
    Plot.binX(
      { y: "sum", interval: d3.utcMonth, text: (d) => d.subtipo },
      {
        x: "fecha",
        y: "cantidad",
        z: "subtipo",
        textAnchor: "start",
        dx: 3,
        fill: "black"
      }
    )
  )
)

```

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [December 7, 2023, 11:38am UTC](https://talk.observablehq.com/t/text-mark-for-binned-lines/8572/2 "2023-12-07T11:38:47Z")

</div>

the reducer for text receives the bin data as input, so maybe do

`text: (d) => d[0].subtipo`
