c3js,保持x轴刻度值并删除点

时间:2014-12-23 02:08:30

标签: javascript c3.js

我有这张图表,x轴加载了近千个时间序列点。

这些观点没有吸引力。

enter image description here

我可以隐藏x轴,但我希望日期显示在下面,减去刻度点。

有没有办法在离开时间时删除刻度点。 (请忽略x轴上的数字我知道它们是错的。)

最好,我希望这是一个类别折线图,完全避免时间序列。

代码,为简单起见删除了数据 -

var chart = c3.generate({
        padding: {
            right: 30
        },
        data: {
          x: 'x',
          columns: [
                ['x',1324252800,1324339200],
                ['OECD Crude Oil Price',102.91,105.05]         
          ],
          type: 'line',
          onclick: function (d, element) { console.log("onclick", d, element); },
          onmouseover: function (d) { console.log("onmouseover", d); },
          onmouseout: function (d) { console.log("onmouseout", d); },
          order: null
        },
        point: {
            show: false
        },
        axis: {
          x: {

            //show:false, 
            //I don't want this, I want to see the dates

            type: 'timeseries',
            tick: {
                culling: {
                    max: 3 
                },
                multiline: false
            }
          },
          y: {
            tick: {
                format: function (d) { return  "$ " + d ; }
            }
          }
        },  
      });

提前致谢

1 个答案:

答案 0 :(得分:2)

好的,哇,我很傻。我之前找到了解决问题的方法。

Here is my answer just a fortnight ago.

捂脸。

这里是图表现在的样子,具有所需的效果 -

enter image description here