Re-sorting XY chart if query parameters update

Hello everyone!

I have an XY chart component I modified into a downtime pareto chart for our production team to use on a dashboard. By default, the graph shows the downtime root causes in descending order of duration across all manufacturing shifts:

I got some feedback from the production team that they would like to have the ability to filter by shift (see only results from 1st shift, 2nd shift, etc.), so I added in a dropdown selector and updated the named query to take in the shift as an argument. When I test this solution in the Named Query section of the Designer software, it works exactly as intended.

However, I am having issues when I use the dropdown in a Perspective session. The data itself updates, but the X axis still uses the sorting order from the original query and it looks like a mess:

I tried using the .refreshBinding() method when the dropdown selection changes, and also tried changing the dataSource binding from a property binding to a query binding that polls every 5 seconds. Neither option worked, and I need to roll out similar changes to other graphs so I would like to find the "best practice" way of doing this...

What is the best way to "refresh" the X axis sort order?

Thanks in advance!

Can you post the chart JSON and the alternate datasets for us to experiment with? (You might need to remove the binding so that we don't just get a binding rather than the dataset.) Format it correctly using the </> button and, if you want to be cool, select it all and use the gear icon | Hide Details to make them collapsible.

Resolved, documenting for others who may see a similar issue.

I had a second datasource that I was using to generate the 80% line (the dashed red line in the screenshots). That particular datasource was overriding the X-axis columns; I updated the named query for that datasource to match the one generating the bar graph and it immediately fixed the issue.

1 Like