Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/429.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jqplot-要限制y轴刻度吗_Javascript_Css_Jqplot - Fatal编程技术网

Javascript jqplot-要限制y轴刻度吗

Javascript jqplot-要限制y轴刻度吗,javascript,css,jqplot,Javascript,Css,Jqplot,在下面的代码中,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

在下面的代码中,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"]
});
});
$(文档).ready(函数(){
var line1=[82,82];
var line2=[22,22];
var line3=[0,0];
变量ticks=[1,2];$.jqplot('line',[line1,line2,line3]{
动画:对,
axesDefaults:{min:0,tickInterval:1},
系列默认值:{
渲染器选项:{
顺利:是的
}
},
系列:[{lineWidth:1.5,标签:'Passed'},
{线宽:1.5,标签:'失败'},
{线宽:1.5,标签:'跳过'}],
轴线:{
xaxis:{
标签:“运行编号”,
滴答声:滴答声,
选择:{
formatString:“%d次运行”
},
pad:1.2,
渲染器选项:{
勾选插图:0.3,
米诺蒂克斯:1
}
},
亚克斯:{
标签:“TC编号me”
,选项:{
formatString:“%d Tc”
},
}
},
荧光灯:{
秀:没错,
大小:10,
工具提示位置:“n”,
工具提示:“y”,
tooltipFormatString:“%d:测试用例”,
useAxesFormatters:false
},
光标:{
秀:真的
},
网格:{背景:'#ffffff',drawGridLines:true,网格线颜色:'#cccccc',边框颜色:'#cccccc',
边框宽度:0.5,阴影:false},
图例:{show:true,位置:'outside',位置:'e'},
系列颜色:[“7BB661”、“E03C31”、“21ABCD”]
});
});

您必须删除axesDefaults中的tickInterval选项,让jqplot计算自己的刻度,或者在axesDefaults中添加numberTicks选项,以便告诉jqplot绘制x个刻度,其中x是给定给numberTicks选项的数字

  • 如果使用axesDefaults:{min:0,tickInterval:1},jqplot将以1个单位的间隔(0到82之间的80+个刻度)从0到最大值绘制刻度
  • 如果使用axesDefaults:{min:0},jqplot将从0到最大值绘制5个刻度(默认情况下),计算两个刻度之间的相同间隙
  • 如果使用axesDefaults:{min:0,tickInterval:1,numberTicks:15},jqplot将从0开始绘制15个刻度,间隔为1个单位(从0到14的15个刻度)
  • 如果使用axesDefaults:{min:0,numberTicks:15},jqplot将从0到最大值绘制15个刻度,计算两个刻度之间的相同间隙
选择最适合的选项