Keen.io仪表板图表上的最大和最小Y轴值

时间:2016-03-07 08:35:20

标签: charts dashboard keen-io

是否可以在敏锐的仪表板图表上设置Y轴的最大值和最小值?

我从这个github repo下载了仪表板:

https://github.com/keen/dashboards

我有一个如下所示的垂直柱形图,我想将y轴上的最小值设置为70,最大值设置为90,我该怎么做?

  <div class="col-sm-8">
    <div class="chart-wrapper">
      <div class="chart-title">
        Alex Weight (kg)
      </div>
      <div class="chart-stage">
        <div id="chart-01"></div>
      </div>
      <div class="chart-notes">   
      </div>
    </div>
  </div>


var query = new Keen.Query("maximum", {
    eventCollection: "weight",
    interval: "daily",
    targetProperty: "value",
    timeframe: "this_14_days",
    timezone: "Australia/Sydney"
});

client.draw(
query, document.getElementById("chart-01"), {
    height: 150,
width: '100%',
chartType: 'columnchart',

hAxis: {
    format:'d MMM'
}
}
);

1 个答案:

答案 0 :(得分:1)

我一问这个问题,我就弄清楚了...... 只需添加以下vAxis值:

var query = new Keen.Query("maximum", {
eventCollection: "weight",
interval: "daily",
targetProperty: "value",
timeframe: "this_14_days",
timezone: "Australia/Sydney"
});

client.draw(
query, document.getElementById("chart-01"), {
height: 150,
width: '100%',
chartType: 'columnchart',

hAxis: {
    format:'d MMM'
},
vAxis: { 
    minValue: 70,
    maxValue: 80
 }  
}
);
相关问题