javascript - 如何在 Flot Char js 中居中栏
问题描述
我有,flot.js 的一些问题,在我的图表中,xaxis 不是以条为中心,我尝试使用 align: 'center' 但它不起作用,我想要的是图表正下方的 xaxis(日期标签)这是我的代码
$.plot('#grafik-presensi', [data], {
series: {
bars: {
show: true,
barWidth: 0.6,
align:'center',
fill: true,
fillColor: {
colors: [{
opacity: 0.9
}, {
opacity: 0.9
}]
}
}
},
colors: ['#25476a'],
yaxis: {
},
xaxis: {
ticks: ticks,
},
grid: {
hoverable: true,
clickable: true,
tickColor: '#eeeeee',
borderWidth: 0
},
legend: {
show: true,
position: 'nw'
},
tooltip: {
show: true,
content: 'Presensi %x, Jumlah %y'
}
});
});
解决方案
您的数据 x 值和刻度似乎根据您的时区 (GMT +7) 发生了变化。您需要确保数据和刻度都使用我们当地时间或两者都使用 UTC。请参阅此处了解更多信息。
如果无法对数据和刻度使用相同的时区,您还可以通过将 7 小时添加到它们来手动移动刻度。
推荐阅读
- handler - 多个处理程序触发器
- apache - Apache 域未指向 DocumentRoot (DigitialOcean Moodle)
- python - “关键”函数如何比 python 排序中的比较函数更有效?
- postgresql - 在 Google 云平台上的 Kubernetes 中创建持久卷
- firebase - React-native-firebase 数据库 - 从嵌套调用中检索数据
- r - 如何在 R 中使用参数调用 OS 命令(shell 文件)
- android - Flutter 需要额外点击才能隐藏 Android 上的所有叠加层
- javascript - 具有三个匹配到单个结果数组的 JS split() 正则表达式
- html - CSS在悬停时开始和暂停动画
- python - 功能和非功能的区别?