Vega-lite x轴的折线图顺序

时间:2018-02-07 11:31:01

标签: vega vega-lite

我的数据:

(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)

我需要按顺序排列它们,但是当我选择'month'作为encoding.x的字段时,我会按字母顺序输入它们。当我添加sort:null时,该行仍然从4月到8月到12月,依此类推,而轴的顺序正确(随之而来的是混乱)。当我选择'index'作为encoding.x的字段时,我得到了我需要的正确图形,但我希望标签是月份,而不是索引。

0 个答案:

没有答案