Jqplot y轴缩放 [英] Jqplot y axis scaling
问题描述
我想像下面的图片一样缩放y轴
I want to scale the y axis like following image
但是我有如下图
我想像第一个图一样实现y轴缩放,我想大范围显示.09和1之间的值.我也想将pf值范围显示为0到1(0为最小,1为最大.)
I want to implement the y axis scaling like the first figure.I want to show the values between .09 and 1 in a large scale. also i want to show the pf value range as 0 to 1( 0 as minimum and 1 as maximum.)
有什么主意吗?
我尝试过的代码是 此处
My tried code is HERE
$.jqplot.config.enablePlugins = true;
var chartData = [[1, .92], [2,.93], [3, .98],[4,.95]];
function PlotChart(chartData) {
var plot2 = $.jqplot('chart1', [chartData], {
title: '',
seriesDefaults: {
renderer: $.jqplot.CanvasAxisLabelRenderer,
rendererOptions: {
smooth: true
},
pointLabels: {
show: true
}
},
axes: {
xaxis: {
label: 'date',
ticks : [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10','11', '12', '13', '14'],
renderer: $.jqplot.CategoryAxisRenderer,
// renderer to use to draw the axis,
tickOptions: {
formatString: '%d'
}
},
yaxis: {
ticks:[ '0', '.5','.9', '1' ],
label: 'PF',
tickOptions: {
formatString: '%.2f'
}
}
},
highlighter: {
sizeAdjust: 7.5
},
cursor: {
show: true
}
});
}
PlotChart(chartData);
推荐答案
我认为jqplot不允许做您想做的事情,我知道在轴上工作非常严格(我试图在工具提示上显示即使小数位数太大也无法显示小数).
I think jqplot won't permit to do something like you want to do, I know it's very strict about working on axes (I was trying to show on tooltips the full value with decimals even when the scale was too big to show decimals).
您可以做的是调整间隔大小,尝试使用min和max:
What you can do is resizing the interval, try with min and max:
yaxis: {
ticks:[ '.9', '1' ],
label: 'PF',
tickOptions: {
formatString: '%.2f'
}
min: 0.8,
max: 1.1
}
在此间隔内,jqplot将使您的图形完美地显示线条.
With that interval jqplot will render your graph showing perfectly the lines.
这篇关于Jqplot y轴缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!