英文:
Morris.js Chart (line) - Is showing a continuous line
问题
我正在维护一个系统,需要在仪表板上更改一个图表,它们正在使用morris.js。
我需要创建一个Morris.Line图表,但有些东西不对,我找不到问题出在哪。
目前的代码如下:
$.ajax({
url: url,
type: 'get',
dataType: 'JSON',
async: true,
beforeSend: function() { console.log('instagram ') },
success: function(response) {
console.log(response);
new Morris.Line({
element: 'morrisLine1',
data: response,
xkey: 'y',
ykeys: ['a'],
labels: ['每日进展'],
lineColors: ['#f74f75'],
lineWidth: 3,
ymax: 300000,
gridTextSize: 12,
hideHover: 'auto',
resize: true
});
},
complete: function() { console.log('instagram end') }
});
在这里,你可以看到控制台中的"response"值:
但图表显示的是:
如何将它更改为显示波浪图?
英文:
I am doing maintenance in a system, and I need to change a graph on the dashboard,they are using the morris.js.
I need to create a Morris.Line Graph, but something is not working, and I could not find what I am doing wrong.
The code for now is that:
$.ajax({
url: url,
type: 'get',
dataType: 'JSON',
async: true,
beforeSend: function() {console.log('instagram ') },
success: function(response) {
console.log(response);
new Morris.Line({
element: 'morrisLine1',
data: response,
xkey: 'y',
ykeys: ['a'],
labels: ['Daily Progress'],
lineColors: ['#f74f75'],
lineWidth: 3,
ymax: 300000,
gridTextSize: 12,
hideHover: 'auto',
resize: true
});
},
complete: function() { console.log('instagram end') }
});
Here you will see, in the console, the "response" value:
But the graph it is showing me that:
How can I change it to show the waves?
答案1
得分: 1
我不熟悉那个库。
但是你的响应数字太相似,无法在图表中显示差异。
如果根据最小和最大响应来动态设置ymax和ymin呢?
英文:
I'm not familiar with that library.
but your response numbers are too similar to show the difference in the chart.
what if you make ymax, ymin dynamic based on min max response?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论