1
체크 박스를 클릭 한 후에 만 jqplot에서 오버레이를 트리거하는 방법 (html이로드되지 않을 때). 처음에 overlay 옵션 show를 false로 설정하면 첫 번째 플롯에 오버레이가 표시되지 않고 트리거 함수를 사용할 때 오버레이가 나타나지 않습니다. 그때 사용canvasOverlay in jqplot
<div id="fastest" style="margin-top:20px; margin-left:20px; margin-right:200px; width:800px; height:400px;">
<script class="code" type="text/javascript">
$(document).ready(function(){
var dataset="too long to be displayed here"
plot1 = $.jqplot('fastest', dataset, {
title: 'Test_figs',
legend: {show:false},
series: [{
showMarker: false,
color: '#ED0E0E',
label: 'R spectrum',
neighborThreshold: -1
}],
axes:{
xaxis:{
label:'Restframe Wavelength'
},
yaxis:{
label:'Flux',
tickOptions:{formatString:'%.3e'}
}
},
cursor:{
show:true,
zoom:true,
tooltipLocation:'sw'
},
Canvasoverlay: {
show: false,
objects: [
{verticalLine: {
name: 'Na-ID',
x: 5893.000000,
lineWidth: 2,
color: '#F0630C',
lineCap:'butt',
yOffset:0,
shadow: true
}}
]
}
});
});
function NaID_trigger() {
var co = plot1.plugins.canvasOverlay;
var line = co.get('Na-ID');
if (line.options.show==false) line.options.show = true;
else line.options.show = false;
co.draw(plot1);
}
</script>
:
<button onclick="NaID_trigger()">Na-ID</button>
가 또는 예를 들어 떨어져 오버레이를 트리거 는 여기 플롯에 사용하는 코드입니다.
추신 : 나는 오버레이 옵션에서 show = false를했을 때 작동하지 않는다고 권고 한대로 replot에 의해 draw를 대체 해 보았습니다.
아직 시도한 내용으로 몇 가지 코드를 제공해 주시겠습니까? co.draw (plot1)를 co.replot()으로 대체하려고 했습니까? – AnthonyLeGovic
방금 질문에 qjplot에 대해 사용한 함수를 추가했습니다. – Demetrius
나는 co.draw (plot1)를 plot1.replot()으로 변경하려고 시도했다. – Demetrius