chartJS折线图未绘制小于minY的值

使用chart-js lib绘制折线图时遇到问题。

这是codepen:https://codepen.io/bhupendra1011/pen/gObEpJQ,在这里我将min Y值设置如下:

Python 3.8.1 (tags/v3.8.1:1b293b6,Dec 18 2019,22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help","copyright","credits" or "license()" for more information.
>>> 
= RESTART: C:/Users/3D/Desktop/Rushikesh/Python Programs/Roots of Equation/Bracketing Methods/05_Incremental Search.py
Function i/p (in numpy notation): (667.38/x)*(1-np.exp((-0.146843)*x))-40
Function is:  (667.38/x)*(1-np.exp((-0.146843)*x))-40
Precision: 5
Refer to the graph of the function for the start value
Start From: 14.5
The root is:  14.78021
>>> 
= RESTART: C:/Users/3D/Desktop/Rushikesh/Python Programs/Roots of Equation/Bracketing Methods/05_Incremental Search.py
Function i/p (in numpy notation): (667.38/x)*(1-np.exp((-0.146843)*x))-40
Function is:  (667.38/x)*(1-np.exp((-0.146843)*x))-40
Precision: 7
Refer to the graph of the function for the start value
Start From: 14.5
The root is:  14.7802086
>>> 
= RESTART: C:/Users/3D/Desktop/Rushikesh/Python Programs/Roots of Equation/Bracketing Methods/05_Incremental Search.py
Function i/p (in numpy notation): (667.38/x)*(1-np.exp((-0.146843)*x))-40
Function is:  (667.38/x)*(1-np.exp((-0.146843)*x))-40
Precision: 6
Refer to the graph of the function for the start value
Start From: 14.5
The root is:  18.500001
>>> 

但是,如果小于minY的值是不可能的,则绘制的值是不可能的,如果我删除minY option,则所有折线图都是可见的,但是在我的情况下,我希望图形具有一些初始值。

我还尝试使用以下代码代替设置minY:

    yAxes: [{
          ticks: {
            min: minY,maxTicksLimit:5
                    
                },gridLines: {
                display:false
            }   
        }]

虽然所有绘制的线都是可见的,但是图形的初始位置在选择不同的系列选项时会发生变化。以下是相同的代码笔:https://codepen.io/bhupendra1011/pen/bGNJNBw

我希望图表从某个初始值开始,还应绘制小于初始值的值,并且在更新图表时,图表的初始位置不应更改。

谢谢

hyt19880222 回答:chartJS折线图未绘制小于minY的值

将minY设置为数据数组中的最小元素:

Array.min = function( array ){
    return Math.min.apply( Math,array );
};
本文链接:https://www.f2er.com/2707513.html

大家都在问