Flot With “String” x-axis

前端 未结 3 1183
礼貌的吻别
礼貌的吻别 2020-12-24 05:07

When using flot I would like to have a string based x-axis. For example I have a list of customers \"Bob\", \"Chris\", \"Joe\" and would like to plot their revenue on the Y-

3条回答
  •  情话喂你
    2020-12-24 05:38

    @Matt is close, but it would make more sense to just use the ticks option to directly specify what ticks should have what labels:

    var options = {
    
    ...
      xaxis: {
        ticks: [[0,'Bob'],[1,'Chris'],[2,'Joe']]
      }
    ...
    
    };
    

    EDIT: it looks like this (I added more data than labels, but you get the idea).

提交回复
热议问题