听起来您需要使用“是/否”标签格式化的第二个 yaxis:
这是我用来生成的小提琴......
$(document).ready(function() {
$.jqplot.config.enablePlugins = true;
var line1 = [[1,1],[2,2],[3,3],[4,4],[5,5]];
var line2 = [[1,1],[2,0],[3,1],[4,1],[5,0]];
$.jqplot('chart1', [line1, line2], {
series: [
{label: 'Analog'},
{label: 'Yes/No', 'yaxis':'y2axis'},
],
axes: {
xaxis: {
label: 'Label'
},
yaxis: {
label: 'Analog'
},
y2axis:{
label: 'Yes/No',
ticks: [0,1],
tickOptions:{formatter:
function (formatString, value){
if (value == 0) return 'No';
else if (value == 1) return 'Yes';
else return "";
}}
}
}
});
});