2017-10-13 16 views
0

グラフがロードされて初めてズームすると、データは角度グラフに表示されません。ここで初めて角度データにズーミングデータがありません

enter image description here

をズームした後、スクリーンショット

enter image description here

であることはここに私のコード

function getPopUpGraph() { 
     $scope.currentZoom = 1; 
     $scope.popUpGraph = {}; 
     $scope.popUpGraph = { 
      data: [], 
      options: { 
       labels: ["Date", $scope.selectedDataPoint.LegendName, "TrendLine"], 
       showPopover: false, 
       //customBars: true, 
       legend: "onmouseover", 
       highlightSeriesOpts: { 
        strokeWidth: 2, 
        strokeBorderWidth: 1 
       }, 
       animatedZooms: true, 
       interactionModel: Dygraph.defaultInteractionModel, 
       showRangeSelector: true, 
       rangeSelectorPlotLineWidth: 1, 
       rangeSelectorPlotStrokeColor: 'gray', 
       rangeSelectorPlotFillColor: 'gray', 
       highlightCircleSize: 4, 
       rangeSelectorAlpha: 0.9, 
       rangeSelectorForegroundLineWidth: 1.25, 
       rangeSelectorForegroundStrokeColor: 'dark gray', 
       visibility: [true, false], 
       series: { 
        'TrendLine': { 
         strokePattern: [3, 2, 3, 2] 
        }, 
       }, 
       //xlabel: 'Date', 
       ylabel: $scope.selectedDataPoint.Unit, 
       title: $scope.selectedDataPoint.LegendName, 
       legendEnabled: false, 
       colors: ["#ff0000"], 
       valueRange: null, 
       height: 300, 
       resizeEnabled: true, 
       strokeWidth: 2, 
       axes: { 
        x: { 
         axisLabelFormatter: function (d, gran) { 
          if ($scope.currentZoomLevel.name == '12h') { 
           return $filter('date')(d, 'h:mm a'); 
          } 
          else 
           return $filter('date')(d, 'MMM dd h:mm'); 
         }, 
         valueFormatter: function (ms) { 
          return $filter('date')(ms, 'M/d/yy h:mm a'); 
         } 
        } 
       }, 
       drawCallback: function (g, is_initial) { 
        if (g.dateWindow_) 
         myPopUpRange(g.dateWindow_) 
       } 
      } 
     } 
     $scope.getPopGraphData($scope.currentZoom, 0); 
    } 

データは$ scope.getPopGraphData関数からフェッチされています。

このメイン関数で他の関数を呼び出しています。これは問題ではないと私は思う。角度ダイグラフィックのデモでは、ズーム後、レンジセレクタも変化します。データが正しく表示されています。私の場合、レンジセレクタは最初のズーム時に変化しません。 どのような解決策ですか?事前に感謝...

答えて

0

私は解決策を見つけました。 getPopUpGraph()関数には、関数呼び出しの欠点があります。 myPopUpRange()関数を無効にすると、正常に動作します。 myPopUpRange()は、x軸の値をリセットするために使用されます。しかし、dygraphはx軸の範囲を自動的に割り当てるので、必要はありません。

関連する問題