2012-03-02 4 views
0

동적으로 jqplot 해당 파일을로드하는 및 차트 div 수 있지만 때로는 점점 그래프 오전 및 일부 다른 시간 그래프 점점 내 코드로 점점 오전 아내는 전화를 얻으려면 값이와 객체 일의 그래프 출력에 전달 여기에 표시됩니다 무엇입니까 http://i43.tinypic.com/wcfns0.png은 제가 비슷한 문제를 가지고 있었고, 그것이 내가 테이블 요소에 전역 스타일을 한 것으로 밝혀졌다Jqplot 원형 차트 만 렌더링하는 행

jsFunction3(xyz) { 
jQuery.getCSS = function(url, media) 
{ 
jQuery(document.createElement('link')).attr({ href: url, media: media || 'screen', type: 'text/css', rel: 'stylesheet' }).appendTo('head'); }; 

$.getCSS('/redkanproject/plugins/jqplot-0.1/css/jqplot/jquery.jqplot.css','print'); 
$.getScript('/redkanproject/plugins/jqplot-0.1/js/jqplot/jquery.jqplot.min.js', 

function() { }); $.getScript('/redkanproject/plugins/jqplot-0.1/js/jqplot/excanvas.min.js', function() { }); 
$.getScript('/redkanproject/plugins/jqplot-0.1/js/jqplot/plugin/jqplot.pieRenderer.min.js', function() { }); 

var JSONObject = new Object; 
JSONObject.id =xyz; 
JSONstring = JSON.stringify(JSONObject); 
var url = "${createLink(controller:'page', action:'example4')}"; new Ajax.Request(url, { method:'post', contentType:'application/json', postBody:JSONstring, asynchronous:true, onSuccess: function (res) { 
st=(res.responseJSON) 
x="chart" // this is my div to display chart 
var plot1 = $.jqplot (x, [st], { title: 'Bianual Reviews percentage', grid: { 
background:'#834100', shadow: true,borderWidth: 0, borderColor: 'white',shadowDepth: 0}, seriesDefaults: { 
// Make this a pie chart. 
renderer: $.jqplot.PieRenderer, rendererOptions: { 
// Put datalabels on the pie slices. 
// By default, labels show the percentage of the slice. 
sliceMargin:6, 
showDataLabels: true 
} 
}, 
legend: { show:true, location: 'e' } }); 
$(x).bind('jqplotDataClick', function(ev,seriesIndex, pointIndex, data) 
{ alert(" data: "+data); } 
); 
} 
})//ajax } 
------------------------------------------------------------------------ 
+0

:-) 도움이

table{ width:auto; } 

희망을 표시 것으로 변경 예를 들면? – Mark

+0

@Mark 내가 깔끔하게 편집 해주었습니다. –

+1

왜 $ .getCSS와 $ .getScript를 사용하고 있습니까? jqPlot이 정적으로 필요로하는 리소스를로드하는 것이 어떻습니까? 너 여기에 약간의 경쟁 조건이 있다고 생각해. Ajax를 통해 CSS 및 JS 파일을 검색하고 동시에 Ajax를 통해 플롯을 작성하십시오. 그것들은 모두 비동기식 요청이므로 플롯 호출 전에 JS와 CSS가로드된다는 보장이 없습니다. – Mark

답변

1

기능을 도와주세요하는 너비를 100 %로 설정합니다. 는

table{ 
width:100% 
} 

나는 자동차와 모든 것을 제대로 그런 형식의 질문을 떠날 때 당신은 심각하게 누군가가 당신을 도울 것으로 기대