2017-03-07 6 views
0

시간당 서비스 변경으로 오럴 데이터가 발생했습니다. 초 촛대를 그리기 위해 하이 스톡을 사용하고 있지만 마지막 촛불과 이전 것만 표시됩니다. . 내가 OHLC에 대한 속성으로 (밀리 초) 현재 시간을 사용하지만 난 사실 옵션은 문제를 해결 제거 서버Highchart/Highstock OHLC가 라이브 데이터가있는 이전 촛대를 표시하지 않습니다.

this.options = { 
     chart: { 
      width: 1200 , 
      height:800, 
      type: 'candlestick' 
     }, 

     title: { text : 'dynamic data example'}, 
     xAxis: { 
      type: 'datetime', 
      dateTimeLabelFormats : { 
       hour: '%I %p', 
       minute: '%I:%M %p' 
      } 
     }, 
     yAxis: { 
      title: { 
       text: 'Value' 
      }, 
      plotLines: [{ 
       value: 0, 
       width: 1, 
       color: '#808080' 
      }] 
     }, 
     plotOptions: { 
      line: { 
       dataLabels: { 
        enabled: true 
       }, 
       enableMouseTracking: false 
      } 
     }, 
     rangeSelector: { 
      selected: 1 
     }, 
     dataGrouping: { 
      units: [ 
       ['minute', [1]], [ 
       'hour', [1, 2, 3, 4, 6]] 
      ] 
     }, 
     series: [{ 
      name: 'Random data', 
      type: 'candlestick', 
      data: (function() { 
       // generate an array of random data 
       var data:any = [], 
        time = (new Date()).getTime(), 
        i:any; 

       for (i = -5; i <= 0; i++) { 
        data.push([ 
         time + i * 60000, 
         Math.random()*100, 
         Math.random()*100, 
         Math.random()*100, 
         Math.random()*100 
        ]); 
       } 
       return data; 
      })()} 

      ] 
    }; 
    this.connection = this.socketService.getMessages().subscribe(data => { 
     this.data = data; 

     this.chart.series[0].addPoint([ 
      this.data.time, 
      this.data.open, 
      this.data.high, 
      this.data.low, 
      this.data.close, 
     ], true, true); 

    }) 
+0

유일한 유효 시간 소인은 밀리 초 단위입니다. 분을 사용하려면 차트에서 사용하기 전에 시간을 밀리 초로 변환해야합니다. – morganfree

답변

0

에서 나오는 분 시간을 사용할 경우 작동합니다.

this.chart.series [0] .addPoint ([this.data.time, this.data.open, this.data.high, this.data.low, this.data.close,], true, 참된);