Morris.js图表(线性)- 显示连续线

huangapple go评论73阅读模式
英文:

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

Morris.js图表(线性)- 显示连续线

但图表显示的是:

Morris.js图表(线性)- 显示连续线

如何将它更改为显示波浪图?

英文:

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:

Morris.js图表(线性)- 显示连续线

But the graph it is showing me that:

Morris.js图表(线性)- 显示连续线

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?

huangapple
  • 本文由 发表于 2023年3月4日 01:39:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/75630248.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定