Sorting Chart By Different Field Than The One Displayed
I have a column chart that is currently displaying events on the x-axis (through an "eventCode field), and they are appearing automatically in descending order by the "total competitors" (displayed on the y-axis). I would like to sort and display the events on the x-axis instead by an "eventKey" field that is also in the Data Model. Is it possible to sort chart axis labels by a different field? Basically, I want to be able to replicate the custom sort configuration (see attachment) that is offered on the Sisense website in compose sdk.
Hi ewoytowitz
I noticed your question was about sorting in Compose SDK, so offering an alternative solution.
It should be possible by first running the query, then after results are returned, choosing which columns in the result to map to the chart (e.g. not all of them).
There's an example of useExecuteQuery with sorting here https://www.sisense.com/platform/compose-sdk/playground/?example=queries%2Fuse-execute-query-sorting
It's sorted by Year, then by revenue.You could imagine your eventCode as the year column in the example, with the sorting applied, and you only use the other columns in the chart mapping.
Example of mapping query results to a chart (instead of a table) here https://www.sisense.com/platform/compose-sdk/playground/?example=queries%2Fuse-execute-query
We will try to produce a more targeted example for this use case in future, thanks for the inspiration!
Steve