如何使用flot渲染此条形图

Mor*_*rri 7 flot

你能用flot渲染这样的条形图吗?

示例图表

我是否需要手动创建数据集才能获得此结果,而不是使用模式:'time'?

Mar*_*ark 26

实际上很容易使用flot生产.

var options = {
     series: {
         bars: {
             show: true,
             barWidth: 15778463000, // 1/2 year in milliseconds
             align: 'center'
         },
     },
     yaxes: {
         min: 0
     },
     xaxis: {
         mode: 'time',
         timeformat: "%y",
         tickSize: [1, "year"],
         autoscaleMargin: .10 // allow space left and right
     }
 };

 $(function() {
     $.plot($('#placeholder'), [[[1230768000*1000, 100], //[seconds * 1000 = milli, y value]
                                [1262304000*1000, 200],
                                [1293840000*1000, 300]]], options);
 });
Run Code Online (Sandbox Code Playgroud)

生产:

在此输入图像描述