2014-04-08 1 views
0

나는 약 2000 포인트의 시간 챠트 차트를 가지고 있으며, 데이터는 csv 파일에서로드됩니다. 최소, 최대 및 마지막 점에 대한 레이블을 추가하고 싶습니다.하이 라벨, 추가 레이블이있는 최소, 최대,

내가 이런 식으로 할 때 genereate하는 데 너무 많은 시간이 걸립니다. 어떻게하면 더 빨리이 작업을 수행 할 수 있습니까?

var chart = new Highcharts.Chart(options); 
chart.series[0].data[chartMinNo].update({ 
    marker: { 
    radius: 2, 
    lineColor: '#CC2929', 
    lineWidth: 2, 
    fillColor: '#CC2929', 
    enabled: true 
    }, 
    dataLabels: { 
    enabled: true, 
    borderRadius: 3, 
    borderColor: '#CC2929', 
    borderWidth: 1, 
    y: -23, 
    formatter: function() { 
     return "Min : " + chartMinValue; 
     } 
    } 
}); 

답변

2

하이 포인트를 사용하고 있기 때문에 2000 포인트를 표시하는 것이 좋지 않으므로 속도가 느립니다. 하이 포인트를 대신 사용하여 평균/합계를 표시하는 지점을 그룹화하는 것이 좋습니다. 포인트 그룹. http://jsfiddle.net/me5Uf/2/

$('#container').highcharts({ 
     xAxis: { 
      type: 'datetime' 
     }, 
     plotOptions: { 
      series: { 
       marker: { 
        enabled: false 
       }, 
       dataLabels: { 
        enabled: true, 
        formatter: function() { 
         if (this.point.options.showLabel) { 
          return this.y; 
         } 
         return null; 
        } 
       } 
      } 
     }, 
     series: [{ 
      name: 'AAPL', 
      data: data, 
      tooltip: { 
       valueDecimals: 2 
      } 
     }] 
    }, callback); 
}); 

function callback(chart) { 
    var series = chart.series[0], 
     points = series.points, 
     pLen = points.length, 
     i = 0, 
     lastIndex = pLen - 1, 
     minIndex = series.processedYData.indexOf(series.dataMin), 
     maxIndex = series.processedYData.indexOf(series.dataMax); 

    points[minIndex].options.showLabel = true; 
    points[maxIndex].options.showLabel = true; 
    points[lastIndex].options.showLabel = true; 
    series.isDirty = true; 
    chart.redraw(); 
} 
:

그러나, 여기 데모

그리고 코드입니다

관련 문제