Maximum and Minimum Y-Axis Values on Keen.io Dashboard Charts

喜夏-厌秋 提交于 2019-12-24 12:51:49

问题


Is it possible to set maximum and minimum values on the Y-axis on keen dashboard charts?

I downloaded the dashboard from this github repo :

https://github.com/keen/dashboards

I have a vertical column chart like below, I want to set the minimum value on the y-axis to be 70 and the maximum to be 90, how can I do this?

  <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:


As soon as I ask the question, I figure it out... Just add the vAxis values below :

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
 }  
}
);


来源:https://stackoverflow.com/questions/35839311/maximum-and-minimum-y-axis-values-on-keen-io-dashboard-charts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!