How do I order the XY Chart Legend items?

I have a line XY chart with multiple lines but the legend for the chart is not getting displayed in a proper order. I tried modifying its JSON (using AIP assist) but that’s also not working-

Here the order should be [0-30], [31-90], [91-180], [181-300], [301-360], [>360]

Thanks for posting! My intuition here - and please share some further details if I’m off base - is that your data might not be quite the right shape for the visualization you’re looking to build.

What the XY Chart “expects”, if you’re looking to create this kind of visualization, is that you have a single object set that represents your data, with some date or timeseries property as the X axis and the value you want to plot as the Y Axis. Then to draw multiple lines (i.e. one line per “bucket”), you use the “Line Series” configuration to define how many buckets to create.

For example, I have some info on commercial aircraft flights that looks like:

departure | timestamp for takeoff
air_time | duration of the flight in minutes

And I can create a chart that looks like this (only looking across a few days worth of data)

Since Workshop is creating the buckets based on the chart configuration, it definitely knows about getting them ordered correctly. I’m not sure how you’re specifying your buckets or how you’ve shaped your data, so I can’t say how you might fix it, but it is possible to create a chart like this with the buckets correctly ordered.

Thanks for the reply. That helped and I’m past my blocker.

1 Like