7

Jqplotで「y軸」の値を0から開始する方法を知っている人はいますか....デフォルトでは、-500、0、500、1000などの負の値で始まります....助けてください

4

6 に答える 6

19

軸: オブジェクト内で最小: オブジェクト (最小) を 0 に設定します。

$(document).ready(function(){
 // your code here... //
 axes:{
  yaxis: {min:0}
 }
})

rsapru が示唆したように、グラフを好みの範囲に制限するには、max: object (最大) 値をお勧めします。たとえば、最小値を 0、最大値を 7500 にしたい場合

 axes:{
  yaxis: {min:0, max: 7500}
 }

目盛りの目盛りを指定したい場合は、目盛りを ticks: オブジェクトで指定するか、jqPlot に目盛り間隔を自動的に計算させるか (その場合、最小オブジェクトと最大オブジェクト以外は何も必要ありません)、または特定の数で手動で行うことができます。ティック数 (numberTicks: object を使用)

例: 11 ティック (0,100,200,300,400,500,600,700,800,900,1000) を使用して、0 から 1000 まで 100 単位離れたティックの場合、jqPlot 自動計算:

 axes:{
  yaxis: {min:0, max: 1000, numberTicks: 11}
 }

例: 11 ティック (0,100,200,300,400,500,600,700,800,900,1000) を使用して、0 から 1000 まで 100 単位離れたティックの場合:

 axes:{
  yaxis: {min:0, max: 1000, Ticks: [[0],[100],[200],[300],[400],[500],[600],[700],[800],[900],[1000]]}
 }
于 2011-07-03T01:40:56.727 に答える
8
                var plot2 = $.jqplot ('chartdiv', getRequestStats(), {
                // Give the plot a title.
                title: 'Daily Request Status',
                // You can specify options for all axes on the plot at once with
                // the axesDefaults object.  Here, we're using a canvas renderer
                // to draw the axis label which allows rotated text.
                axesDefaults: {
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer
                },
                // An axes object holds options for all axes.
                // Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ...
                // Up to 9 y axes are supported.
                axes: {
                    // options for each axis are specified in seperate option objects.
                    xaxis: {
                        label: "Hour",
                        // Turn off "padding".  This will allow data point to lie on the
                        // edges of the grid.  Default padding is 1.2 and will keep all
                        // points inside the bounds of the grid.
                        pad: 0
                    },
                    yaxis: {
                        label: "Count",
                        pad: 0
                    }
                }
            });

pad: 0 は、Y 軸が 0 から始まるようにします。

于 2012-05-13T01:35:39.830 に答える
3

http://www.jqplot.com/docs/files/jqPlotOptions-txt.htmlを参照してください。

y 軸を設定: {最小: 0、最大: 500、numberTicks:5}

于 2011-06-02T06:07:48.027 に答える
1

yaxis: {min:0} を yaxis に追加します

于 2014-10-17T13:36:28.007 に答える
0

以下をスクリプトに追加します。

yaxis: {
    minimum:0
}

あなたのyaxisで。私はそれを試してみましたが、うまくいきます。

于 2014-12-09T06:16:12.860 に答える