Hello, I am hoping you can help with a problem we are currently having using the FacetChart. In particular we are working on implementing a sort function to our UI that will allow the user to sort the chart contents based upon the displayed value series as well as the sorting by the category axis in alphabetical order as well as toggle the ascending/descending direction of the sort.
The chart is being loaded with preloaded data, and I have been able to leverage the sortField function to allow the value series sorting. We track the preloaded data and when the user changes the sort field in the UI, the chart sorting is updated with a call to updateSettings() with the new sort field (and direction) and the saved preloaded data (as described in a forum post: https://forum.zoomcharts.com/t/sortfield-function-sorting-the-old-data-after-update-setting/503).
The problem we are having is when we want to sort the chart based on its category/x-axis in alphabetical order. In order to do this, we null out the sortField and hook a custom sort function that then returns the proper sorting result based upon the item names provided to the function. The sorting itself works and when first selected, the chart updates itself as expected. When the user changes to go back to a value axis sort, the sort function is removed (set to null) and the proper sort field value is specified and the chart is updated with updateSettings. Switching back to a value series from the categorical sort works fine and the chart updates itself properly.
When the user then attempts to change the directionality of the sort in the x-axis category mode, the UI sets some internal variables that the custom sort function can use to adjust the sort result appropriately. However with the custom sort function applied, a call to updateSettings() with the preloaded data does not trigger the chart to re-sort it's contents; the sort field itself does not change. I have also tried to invoke replaceSettings() as well as invoking a complete replaceData(). Forcing the chart to redraw itself also does not cause a sort update either (appears to just re-paint the screen).
I did come across this post: https://forum.zoomcharts.com/t/facetchart-feature-ascending-sort-order/269 for a feature request doing something similar. In the post it describes using "category, -value" as a possible improvement for the sort field's value specification, but it does not seem
to be support yet.
Is there a way to force the chart to re-sort its contents so we can change the sort direction of the chart on the fly?