2015-01-28 4 views
0

x 축의 레이블에 동적 문자 메시지를 사용하고 싶습니다. 기본적으로 같은 달의 레이블이 표시된 경우 반복하지 않으려 고합니다. 그러나, 내 jsfiddle 예를 들어, 어떻게 든 작동하지 않습니다 (그것은 원하는 텍스트를 반환합니다). 내가 도대체 ​​뭘 잘못하고있는 겁니까? http://jsfiddle.net/daxu/md2zk/64/내 차트 포맷터가 하이 차트에서 예상대로 작동하지 않는 이유

   if (labelYear == -1 || year != labelYear) { 
        $('#MessagePerformanceChartContainerID').data("FirstYear", year); 
        if (labelYear == -1) 
        { 
         usedLabels = []; 
        } 
        usedLabels.push(curr_month + ' ' + curr_year); 
        $('#MessagePerformanceChartContainerID').data("UsedLabels", usedLabels); 
        ////first one so 
        return curr_month + ' ' + curr_year; 
       } 
       else{ 
        var usedLabel = curr_month + ' ' + curr_year; 
        if ($.inArray(usedLabel, usedLabels) != -1) 
        { 
         usedLabel = curr_day + ' ' + curr_month + ' ' + curr_year; 
         return 'a'; 
        } 
        else 
        { 
         usedLabels.push(usedLabel); 
$('#MessagePerformanceChartContainerID').data("UsedLabels", usedLabels); 

         alert(usedLabel); 
         return usedLabel; 
        } 
       } 

답변

2

그냥 포맷터 두 번 : JS 콘솔을 참조하십시오라고 : http://jsfiddle.net/md2zk/66/를 - 각각의 타임 스탬프가 두 번 나열됩니다.

솔루션으로서, 나는 tickPositionerUsedLabels를 정리하는 것입니다 :

$('#MessagePerformanceChartContainerID').data("UsedLabels", []); 

데모 : http://jsfiddle.net/md2zk/67/

+0

이 우, 당신이 별입니다 – daxu

관련 문제