要限制y轴的刻度

时间:2022-10-19 13:47:23

In below code y axis values are not readable, I guess its overlapping. How to set suitable y axis tick range:

在下面的代码y轴值是不可读的,我猜它是重叠的。如何设置合适的y轴刻度范围:

        $(document).ready(function(){
            var line1 = [82,82];
            var line2 = [22,22];
            var line3 = [0,0];


 var ticks = [1,2];$.jqplot('line', [line1, line2, line3], {
    animate: true,
    axesDefaults:{min:0,tickInterval: 1},        
    seriesDefaults: {
        rendererOptions: {
            smooth: true
        }
    },
    series: [{lineWidth: 1.5, label: 'Passed'},
        {lineWidth: 1.5, label: 'Failed'},
        {lineWidth: 1.5, label: 'Skipped'}],
    axes: {
        xaxis: {
            label: "Run Number",
            ticks: ticks,
            tickOptions: {

                formatString: "%'d Run"

            },
            pad: 1.2,
            rendererOptions: {
                tickInset: 0.3,
                minorTicks: 1
            }
        },
        yaxis: {

            label: "TC Number me"

            ,tickOptions: {
                formatString: "%'d Tc"
                },
        }
    },
    highlighter: {
        show: true,
        sizeAdjust: 10,
        tooltipLocation: 'n',
        tooltipAxes: 'y',
        tooltipFormatString: '%d :&nbsp;<b><i><span style="color:black;">Test Cases</span></i></b>',
        useAxesFormatters: false
    },
    cursor: {
        show: true
    },
    grid: {background: '#ffffff', drawGridLines: true, gridLineColor: '#cccccc', borderColor: '#cccccc',
        borderWidth: 0.5, shadow: false},
    legend: {show: true, placement: 'outside', location: 'e'},
    seriesColors: ["#7BB661", "#E03C31", "#21ABCD"]
});
});

要限制y轴的刻度

1 个解决方案

#1


1  

You have either to remove the tickInterval option in axesDefaults to let jqplot computes his own ticks or add the numberTicks option in axesDefaults in order to tell jqplot to draw x ticks where x is the number given to the numberTicks option.

您必须删除axesDefaults中的tickInterval选项,让jqplot计算自己的节拍,或者在axesDefaults中添加numbertick选项,以便告诉jqplot绘制x节拍,x是给numbertick选项的数字。

  • If you use axesDefaults:{min:0, tickInterval:1}, jqplot will draw ticks from 0 to your maximal value with an interval of 1 unit (80+ ticks from 0 to 82).
  • 如果您使用axesDefaults:{min:0, tickInterval:1}, jqplot将绘制从0到最大值的时间间隔为1个单元(80+时间间隔为0到82)。
  • If you use axesDefaults:{min:0}, jqplot will draw 5 ticks (by default) from 0 to your maximal value computing a same gap between two ticks.
  • 如果您使用的是axesDefaults:{min:0}, jqplot将从0到您的最大值计算5个刻度(默认值),在两个刻度之间存在相同的间隙。
  • If you use axesDefaults:{min:0, tickInterval:1, numberTicks:15}, jqplot will draw 15 ticks starting at 0 and with an interval of 1 unit (15 ticks from 0 to 14).
  • 如果您使用axesDefaults:{min:0, tickInterval:1, numbertick:15}, jqplot将从0开始绘制15个tick,间隔为1个单元(从0到14)。
  • If you use axesDefaults:{min:0, numberTicks:15}, jqplot will draw 15 ticks from 0 to your maximal value computing a same gap between two ticks.
  • 如果您使用axesDefaults:{min:0, numberTicks:15}, jqplot将从0到最大值的15个节拍,计算两个节拍之间的相同间隙。

Choose the option which best fits.

选择最适合的选项。

#1


1  

You have either to remove the tickInterval option in axesDefaults to let jqplot computes his own ticks or add the numberTicks option in axesDefaults in order to tell jqplot to draw x ticks where x is the number given to the numberTicks option.

您必须删除axesDefaults中的tickInterval选项,让jqplot计算自己的节拍,或者在axesDefaults中添加numbertick选项,以便告诉jqplot绘制x节拍,x是给numbertick选项的数字。

  • If you use axesDefaults:{min:0, tickInterval:1}, jqplot will draw ticks from 0 to your maximal value with an interval of 1 unit (80+ ticks from 0 to 82).
  • 如果您使用axesDefaults:{min:0, tickInterval:1}, jqplot将绘制从0到最大值的时间间隔为1个单元(80+时间间隔为0到82)。
  • If you use axesDefaults:{min:0}, jqplot will draw 5 ticks (by default) from 0 to your maximal value computing a same gap between two ticks.
  • 如果您使用的是axesDefaults:{min:0}, jqplot将从0到您的最大值计算5个刻度(默认值),在两个刻度之间存在相同的间隙。
  • If you use axesDefaults:{min:0, tickInterval:1, numberTicks:15}, jqplot will draw 15 ticks starting at 0 and with an interval of 1 unit (15 ticks from 0 to 14).
  • 如果您使用axesDefaults:{min:0, tickInterval:1, numbertick:15}, jqplot将从0开始绘制15个tick,间隔为1个单元(从0到14)。
  • If you use axesDefaults:{min:0, numberTicks:15}, jqplot will draw 15 ticks from 0 to your maximal value computing a same gap between two ticks.
  • 如果您使用axesDefaults:{min:0, numberTicks:15}, jqplot将从0到最大值的15个节拍,计算两个节拍之间的相同间隙。

Choose the option which best fits.

选择最适合的选项。