# Sorting Marks By Chronological Date

**URL:** <https://talk.observablehq.com/t/sorting-marks-by-chronological-date/8550>\
**Category:** Help\
**Created:** [November 28, 2023, 6:49pm UTC](https://talk.observablehq.com/t/sorting-marks-by-chronological-date/8550 "2023-11-28T18:49:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarrgent](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Sarrgent](https://talk.observablehq.com/u/Sarrgent)\
**Post date:** [November 28, 2023, 6:49pm UTC](https://talk.observablehq.com/t/sorting-marks-by-chronological-date/8550/1 "2023-11-28T18:49:32Z")

</div>

I am having issues sorting this [chart](https://observablehq.com/d/665ed9b284aa3d04) by date on the y-axis. I am not sure if I am missing a sort transform somewhere or if I am just missing something obvious. It seems like it wants to sort the dates by month rather than in chronological order as I would like.

```auto
Plot.plot({
  width: 1000,
  height: 2000,
  marginLeft: 55,
  x: { axis: "top", tickFormat: "%" },
  y: { axis: "left", label: null },
  color: {
    scheme: "Spectral",
    legend: "ramp",
    width: 1300,
    label: "Well:"
  },
  marks: [
    Plot.barX(tidy, {
      x: "flows",
      y: "month",
      channels: { month: "month" },
      fill: "well",
      offset: "normalize",
      sort: { y: "-x" },
      tip: true
    }),
    Plot.ruleX([0])
  ]
})

```

---

<div class="post-metadata">

**Author:** ![Cobus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/cobus/32/9670_2.png) [@Cobus](https://talk.observablehq.com/u/Cobus)\
**Post date:** [November 28, 2023, 8:59pm UTC](https://talk.observablehq.com/t/sorting-marks-by-chronological-date/8550/2 "2023-11-28T20:59:45Z")

</div>

You will need to create a date field in your dataset and then sort by that date (not the strings in the ‘name’ field).

Here is a fork with dates:

> **[Untitled](https://observablehq.com/@cobus/graph-sorted-by-dates)**
>
> The following cells transform the dataset from a “wide” format—where the observations for all age groups are attached to a single row for each State—to a “tidy” format having one observation per row.
