Display class label on X-axis instead of ID (relational tables)

Hello,

I’m working on a Directus dashboard and I want to display:

  • X-axis: the class label (name)
  • Y-axis: the number of students

However, my data comes from multiple relational tables, and by default Directus displays IDs instead of readable labels.


:pushpin: Data model

Tables involved:

  • absence_day_students
    • id, student_id, absence_day_id
  • absence_day
    • id, class_id
  • classes
    • id, class_name

Relations:

  • absence_day_students.absence_day_idabsence_day.id
  • absence_day.class_idclasses.id

:cross_mark: Issue

  • The chart X-axis shows class IDs
  • Calculated fields do not support chained relations (relation → relation)
  • Therefore, it’s not possible to use something like:
absence_day_id.class_id.class_name

thanks in advance
1 Like

Try your luck with this Insights for Relational Values
I faced the same issue, so I used the mentioned extension, but unfortunately was using a system table, so I had no luck.
Give it a try and let me know if it works as you expected.

Thanks for your suggestion!

I’ve already looked into “Insights for Relational Values”, however in my case the issue is slightly different.

I’m not trying to display relational values on a Chart Map, but on a Bar / Column chart (Insights → Bar Chart).
Unfortunately, this extension seems to mainly target map-based charts and doesn’t resolve the limitation for bar charts where:

  • the X-axis still expects a flat field
  • calculated fields don’t support chained relations
  • relational values are still rendered as IDs in standard bar charts

Because of this, I ended up using a SQL view to flatten the relations and expose readable fields (class label + count), which works reliably for bar charts.

If you’ve managed to get relational labels working on a bar chart using this extension (not maps), I’d be very interested to know how you configured it.

Thanks again for sharing your experience :folded_hands:

1 Like

Seems like this is sort of coming very soon, but only for x-axis on bar charts.

2 Likes