[WPF] DynamicDataDisplay _ Independent Axes 小BUG

  • 707
  • 0

摘要:[WPF] DynamicDataDisplay _ Independent Axes 小BUG

利用D3想達到 每條LineGraph可以擁有各自獨立的垂直軸...

那你或許可以先參考一下 D3 source內的DevSample/TwoIndependentAxes

幾個觀念如下:

1. 需利用InjectedPlotter (因為僅有InjectedPlotter與ChartPlotter才能有自己獨立的一份座標)

2. 如果你是需要每條LineGraph都要有自己的座標系, 那就使用多少InjectedPlotter當作lineGraphe的parent

3. 使用 

public void SetVerticalTransform(double parentMin, double childMin, double parentMax, double childMax)

進行垂直軸座標的轉換, 這裡的child可以看做自己! parent可以挑ChartPlotter當基準

 

然後此篇的重點是要說...

問題就出在SetVerticalTransform內,請修改如下吧...(直線方程式錯誤, 與childMax=childMin的issue沒考慮到)

public void SetVerticalTransform(double parentMin, double childMin, double parentMax, double childMax)
{
      if (childMax == childMin)
      {   
         childMin--;
         childMax++;
       }
       yScale = (childMax - childMin) / (parentMax - parentMin);
       yShift = childMax - (parentMax * yScale);
}

結果如下↓ 任何問題與建議 歡迎留言