2013-07-25 3 views
3

좋아, 그래서 데이터베이스에서 데이터를 올바르게 표시 Highcharts 차트가; 그러나 내가 확대하는 순간 차트가 공백이됩니까?하이 차트 차트가 zoomType에서 공백으로 표시됨 : 'x'영역 범위 확대?

$(function() { 
     $('#content').highcharts({ 
      chart: { 
       zoomType: 'x', 
       backgroundColor:'transparent' 
      }, 
      credits: { 
       enabled: false 
      }, 
      title: { 
       text: 'Players Online' 
      }, 
      subtitle: { 
       text: document.ontouchstart === undefined ? 
        'Click and drag in the plot area to zoom in' : 
        'Drag your finger over the plot to zoom in' 
      }, 
      xAxis: { 
       type: 'datetime', 
       maxZoom: 3600000, // 1 hour 
       title: { 
        text: null 
       } 
      }, 
      yAxis: { 
       title: { 
        text: 'Players Online' 
       } 
      }, 
      tooltip: { 
       enabled: false 
      }, 
      legend: { 
       enabled: false 
      }, 
      plotOptions: { 
       area: { 
        allowPointSelect: false, 
        fillColor: { 
         linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1}, 
         stops: [ 
          [0, Highcharts.getOptions().colors[0]], 
          [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')] 
         ] 
        }, 
        lineWidth: 1, 
        marker: { 
         enabled: false 
        }, 
        shadow: false, 
        states: { 
         hover: { 
          lineWidth: 1, 
          enabled: false 
         } 
        } 
       } 
      }, 
      series: [{ 
       type: 'area', 
       data: [<?php echo join($data, ',') ?>] 
       //This is displayed correctly in Javascript, so the issue isn't in my PHP 
      }] 
     }); 
    }); 

는 여기 바보 같은 일을하고 있습니까 : 차트의 자바 스크립트 코드가 여기에

<div class="content" id="content"></div> 

입니다 : 여기

는 차트 HTML입니까? 차트의 원인이 공백으로 보이지 않는 것 같습니다. :/

+1

가능한 중복 http://stackoverflow.com/questions/11231398/highcharts-not-displaying-data-at-some-zoom-levels – svillamayor

+0

x 오름차순으로 데이터를 정렬 했습니까? Data 객체를 첨부 할 수 있습니까? –

+0

@SebastianBochan 차트가 사용되는 웹 사이트를 링크하여 라이브 데이터를 볼 수 있습니다. – Simo389

답변

4

Highcharts API 문서를 통해 사냥을 한 후에 문제가 해결되었습니다. 나는 소위 'cropThreshold'알고 있어요 모든 차트 유형의 속성이 여기에있다

이이 구체적으로 무엇인지 설명하는 Highcharts API에 대한 링크입니다 : http://api.highcharts.com/highcharts#plotOptions.area.cropThreshold

그러나 요약 ; 300 포인트 이상을 표시하면 (cropThreshold의 기본값은 300), 확대하면 차트가 비어있게됩니다. 이 문제를 해결하려면, 당신은 당신의 차트 구성에 다음을 추가 할 수 있습니다

area: { 
      cropThreshold: 500 <- //Vary this. I display 500 points on my chart in 
           //total and so a value of 500 allows zooming to 
           //work at all levels. This will vary for you 
           //depending on how many points you plot. 
     } 
+0

API에서 방금 보았던 점은 cropthreshold가 오버플로되면 포인트가 cropThreshold 크기 인 300으로 기본 값으로 축소된다는 것을 알 수 있습니다. 그런 다음 어떻게 차트를 비워 둘 수 있습니까? –

+0

@ user2634485 그게 내가 API에서 이해 한 것입니다. 그러나 cropThreshold가 내가 가진 포인트의 수를 초과하여 설정하지 않았을 때, 차트가 확대 될 때 공백이 될 수있었습니다. 특정 구성의 버그 일 수도 있고 어딘가에서의 실수 일 수도 있습니다. 나는 이것을 경험하지 못했기 때문에 버그라고 생각합니다. – Simo389

+0

그것은 나를 위해 일합니다. 나는 똑같은 문제가 있었다. 감사. –

관련 문제