2012-05-23 2 views
1
내가 렌더링 않은 jqPlot 및 파이 차트를 사용하여 원형 차트를 만든

이, 내 코드는 내가 직면하고jqPlot 원형 차트 렌더링은되지만 던져 버리고 오류가 발생하고 이상하게 보입니까?

var plot4 = $.jqplot('pie', [[["none",10],["error",20],["click",30],["impression",40]]], { 
     seriesDefaults:{ 
      renderer:$.jqplot.PieRenderer, 
      rendererOptions:{ sliceMargin: 0 } 
     }, 
     legend:{ show: true }  
    }); 

문제 아래에 언급하는 것은 내가 파이 차트 위에 마우스를 할 때 내가

을 알리는 오류를 얻을 수 있다는 것입니다
B.axes[D[0]]._ticks[0] is undefined 

방화 광 콘솔에서. 원형 차트의 슬라이스 중 하나를 클릭하면 클릭 한 전체 슬라이스가 사라지는 훨씬 더 이상한 현상이 나타납니다. 다음과 같이

은 클릭하기 전에 파이 차트는 같습니다 -

Original Pie Chart

을 나는 아래, 심지어 갈색 슬라이스가 사라질 파이 뭔가 것으로 판명 갈색 지역을 클릭 한 후.

Pie Chart without the brown slice

위를위한 솔루션을 제공하십시오. 나는 다른 구성을 시험해 보았지만 딘의 작업. 또한이 페이지에서 막대 그래프와 커서와 같은 다른 플러그인을 사용하고 있다고 알려 드리겠습니다.

내가이 일을하고 어디 내 페이지의 전체 소스 코드를 아래에 언급 한 -

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>jqPlot Demo</title> 
<!--[if IE]><script src="./js/excanvas.min.js"></script><![endif]--> 
<script type="text/javascript" src="./js/jquery.min.js"></script> 
<script type="text/javascript" src="./js/jquery.jqplot.js"></script> 
<script type="text/javascript" src="./js/jqplot.cursor.min.js"></script> 
<script type="text/javascript" src="./js/jqplot.dragable.min.js"></script> 
<script type="text/javascript" src="./js/jqplot.trendline.min.js"></script> 
<script type="text/javascript" src="./js/jqplot.barRenderer.min.js"></script> 
<script type="text/javascript" src="./js/jqplot.pieRenderer.min.js"></script> 
<script type="text/javascript" src="./js/jqplot.canvasAxisLabelRenderer.min.js"></script> 
<script type="text/javascript" src="./js/jquery-ui.min.js"></script> 
<link rel="stylesheet" href="./css/jquery.jqplot.min.css"/> 
<link rel="stylesheet" href="./css/jqPlot.css"/> 
<script> 
$(document).ready(function(){ 
    $.jqplot.config.enablePlugins = true; 
    var lineGraph=$.jqplot('chart', [[[10, 2],[30,5.12],[50,13.1],[70,33.6],[90,85.9],[11,20.9]]], 
      { 
      title:'Exponential Line', 
      axes:{yaxis:{min:0,max:100},xaxis:{min:0,max:100}}, 
      legend:{ 
       show:true, 
       location:'se', 
       xoffset:12, 
       yoffset:0 
       }, 
      grid:{ 
        gridLineColor:'#F2F2F2', 
        background:'#FFFFFF', 
        borderWidth:1, 
        borderColor:'#BBBBBB', 
        shadow:true, 
        shadowAmgle:45, 
        shadowWidth:2, 
        shadowOffset:2, 
        shadowDepth:2 
        }, 
      cursor:{ 
        style: 'pointer', 
        show:false, 
        showTooltip: true, 
        followMouse:true, 
        tooltipOffset:10, 
        tooltipLocation:'se' 
        }, 
      highlighter: { 
         lineWidthAdjust: 2.5, 
         sizeAdjust: 5,   
         showTooltip: true,  
         tooltipLocation: 'nw', 
         fadeTooltip: true,  
         tooltipFadeSpeed: "fast", 
         tooltipOffset: 2,  
         tooltipAxes: 'both', 
         tooltipSeparator: ', ', 
         useAxesFormatters: true, 
         tooltipFormatString: '%.5P' 
        }, 
      seriesDefaults:{ 
         trendline:{ 
           show:true, 
           color:'#A2D379', 
           lable:'trendX', 
           lineWidth:2, 
           shadow:true 
            }, 
         color:'#058DC7', 
         lineWidth:5, 
         fill:true, 
         fillAndStroke:true, 
         fillColor:'#E6F4F9' 
         } 

      }); 
    var plot4 = $.jqplot('pie', [[["none",10],["error",20],["click",30],["impression",40]]], { 
     seriesDefaults:{ 
      renderer:$.jqplot.PieRenderer, 
      rendererOptions:{ sliceMargin: 0 } 
     }, 
     legend:{ show: true }, 
     cursor: { 
      show: false 
     } 
    }); 
}); 
$('document').ready(function(){ 
     $('.column').sortable({ 
      connectWith:'.column', 
      handle:'h2', 
      cursor:'move', 
      placeholder:'placeholder', 
      forcePlaceholderSize:true, 
      opacity:0.4, 
      revert:true 

     }).disableSelection(); 
} 


    ); 
</script> 
</head> 
<body> 
<div class="column" id="column1"> 
     <div class="dragbox" id="item1" > 
      <h2>Handle 1</h2> 
      <div class="dragbox-content" > 
       <div id="chart" style="width:100%;height:100%;float:left"></div> 
      </div> 
     </div> 
</div> 
<div class="column" id="column1"> 
     <div class="dragbox" id="item1" > 
      <h2>Handle 1</h2> 
      <div class="dragbox-content" > 
       <div id="pie" style="width:100%;height:100%;float:left"></div> 
      </div> 
     </div> 
</div> 
<div class="column" id="column1"> 
     <div class="dragbox" id="item1" > 
      <h2>Handle 1</h2> 
      <div class="dragbox-content" > 
       <div id="chart1" style="width:400px;height:300px;float:left"></div> 
      </div> 
     </div> 
</div> 


<div id="barRender" style="width:400px;height:300px;float:left"></div> 
</body> 
</html> 
+0

JavaScript 파일에 문제가있는 경우 또는 파일에 예상되는 방화 광이 가리키는 것과 같은 것이없는 경우 오류가 발생하더라도 평소대로 JavaScript 링크가 아래에 있습니다. 회신 해 주셔서 감사합니다. jqplot.cursor.min.js –

답변

2

좋아요. 질문에 대한 답변을 얻었습니다. 우리는 단지 한 줄의 코드를 제거해야하고 필요한 어디서나 필요 할 때마다 나는 위에 내가 호출하고 개별 플러그인을 제거 겼고, 그

$.jqplot.config.enablePlugins = true; 

후 잘 작동. 이 문장이 있었을 때 모든 플러그인이 활성화되어 이상한 결과를 얻었습니다.

+0

Hello jqplot.pieRenderer.min.js를 사용하는 동안 두 가지 오류가 발생합니다. 1) 캐치되지 않는 유형 오류 : null의 'getContext'속성을 읽을 수 없습니다. 2) 캐치되지 않는 유형 오류 : 'PieRenderer'의 속성을 읽을 수 없습니다. – user3217843

0

문제의 일부를 들어 당신은 형광펜 플러그인을 누락되었습니다. 추가하면 the points on the line chart의 드래그에 문제가 없습니다. 예외를 던지지는 않지만 어떤 이유에서 드래그하는 것은보기 흉한 것처럼 보입니다. 내가 체크하고 당신이 seriesDefaults에서 fill을 사용 불가능하게하면 추악스럽게 보이지 않는다.

필자가 관찰 한 바와 같이 원형 차트는 드래그 가능한 스크립트를 사용할 수 없을 때 올바르게 동작하므로 드래그 가능한 스크립트를 연결하지 않습니다.

편집 :

내가 @Shiv 쿠마 가네 문제를 해결하는 데 사용되는 특정 플러그인에 대한 dragable을 사용하도록 설정하는 방법을 알아낼. It is show here. 중요 사항 : seriesisDragable: true을 설정하고 highlightershow: true을 설정하십시오.

+0

하지만 문제가 뭔가있는 것으로 나타났습니다. 감사합니다. 어쨌든 :) –