2017-07-17 32 views
0

在C3.js中,您可以在放大时重新缩放y轴。x轴上是否存在类似的函数?如图此example从图表如何重新调整时间序列的x轴(C3js)?

var visualizeThis = c3.generate({ 
    bindto: '#this', 
    data: { 
     x: 'Dates', 
     columns:[ 
      dates, 
      dataPoints 
     ] 
    }, 
    axis: { 
     x: { 
      type: 'timeseries', 
      tick: { 
       format: '%m/%d/%Y' 
      } 
     } 
    }, 
    zoom: { 
     enabled: true, 
     rescale: true //this only rescales the y-axis 
    }, 
    point: { 
     show: false 
    } 
}); 

回答

1

类似的代码在c3.js变焦影响到x轴上。

如果您还想缩放y轴,则可以尝试zoom.rescale选项。

zoom: { 
    enabled: true, 
    rescale: true 
} 

工作示例jsfiddle

+0

当我是通过重新调整比例时,我想让我的时间序列的其他日期在放大时填充x轴。我知道您指出的特征。 – ja153903

+0

@ ja153903你可以发布图表的代码吗? – katagorri

+0

我已经发布了图表的代码。 – ja153903