Forum Discussion
FICO
6 years agoCommunity Manager
How to sort vdl-chart sort x-axis by entity values?
VDL v7 added the nice set-sorter, but seems to have made the default sorting a bit inconsistent. VDL-table sorts by entity values by default, but VDL-chart seems to do a random sort (at first thought it was sorting the labels, but that isn't the case). This is a problem for me, and I don't see a way to even access the entity values in a set-sorter. Any advice appreciated!
For example, in Mosel I have these entities:
[email protected] Times_Label
[email protected] Time period
Times: range
Times_Label: array(Times) of string
Profit: array(Times) of realand in VDL I have this view:
<vdl-table>
<vdl-table-column entity="Profit"/>
</vdl-table>
<vdl-chart>
<vdl-chart-series entity="Profit"/>
<vdl-chart-axis axis="x" type="category"/>
</vdl-chart>Then I get these two different time period sortings:
where you can see that the x-axis on the chart (bottom image) has the time periods out of order. I can't tell what is the default sorting of vdl-chart.
5 Replies
- FICOCommunity Manager
Adding a set-sorter fixed the sorting of the vdl-chart x-axis without effecting the sorting of the vdl-table:
<vdl-set-sorter comparator="string" set="Times"/>It's unclear to me why the set-sorter works with the comparator "string" and not "numeric".
- FICOCommunity Manager
Hi Alex,
we tried your example with some dummy data here. It seems to be sorting by underlying values on the x-axis OK.
Is there something else at play?
Best regards,
Joc O'Connor
- FICOCommunity Manager
Hmm, it's a mystery to me. Thanks for the quick analysis and reply! My approach works well enough for now.
- FICOCommunity Manager
I wonder whether you have maybe clicked on the table header at some point and state saving is keeping the table sorted differently?
https://www.fico.com/fico-xpress-optimization/docs/latest/insight/vdl_reference/vdl-table.html (see the attribute 'save-state')
Joc
- FICOCommunity Manager
Could be related to that, but the table is sorted ascending by the set indexes (default sorting for vdl-table) and it's the vdl-chart that has the incorrect sorting. I don't think there's button for the user to change the vdl-chart x-axis sorting.
Related Content
Related Content
vdl-chart with multiple y-axis
vdl-chart is built ontop Plotly.js, which supports multiple y-axis (https://plot.ly/python/multiple-axes/), but I don't see how to use it. Does vdl-chart support multiple axes?6 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum2 unread comments2 unread0Views0likes2Comments
