我的数据:
(12) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]0: {index: 0, month: "Jan", yield: 1.1864614990387585, Symbol(vega_id): 1}1: {index: 1, month: "Feb", yield: 2.1219813590422714, Symbol(vega_id): 2}2: {index: 2, month: "Maa", yield: 4.074651725158576, Symbol(vega_id): 3}3: {index: 3, month: "Apr", yield: 6.097184505206099, Symbol(vega_id): 4}4: {index: 4, month: "Mei", yield: 6.433726592798336, Symbol(vega_id): 5}5: {index: 5, month: "Jun", yield: 6.66769562709039, Symbol(vega_id): 6}6: {index: 6, month: "Jul", yield: 6.483542378096409, Symbol(vega_id): 7}7: {index: 7, month: "Aug", yield: 5.7479008300368495, Symbol(vega_id): 8}8: {index: 8, month: "Sep", yield: 4.3635099156150075, Symbol(vega_id): 9}9: {index: 9, month: "Okt", yield: 2.4647144833082195, Symbol(vega_id): 10}10: {index: 10, month: "Nov", yield: 1.1705485181998911, Symbol(vega_id): 11}11: {index: 11, month: "Dec", yield: 0.8511712929997286, Symbol(vega_id): 12}length: 12__proto__: Array(0)
我只需要按顺序排列它们,但是当我选择“月份”作为 encoding.x 的字段时,我会按字母顺序获取它们。当我添加sort:null
时,这条线仍然从四月到八月到十二月等等,而轴的顺序是正确的(随之而来的是混乱)。当我选择“索引”作为 encoding.x 的字段时,我得到了我需要的正确图表,但我希望标签是月份,而不是索引。