package cn.jingzhuan.lib.chart.data;

import java.util.List;

import cn.jingzhuan.lib.chart.Viewport;
import cn.jingzhuan.lib.chart.component.AxisY;

/**
 * Created by Donglua on 17/7/26.
 */

public class MinuteLine extends LineDataSet {

    private float mLastClose = -1;

    public MinuteLine(List<PointValue> pointValues) {
        super(pointValues);
    }

    public MinuteLine(List<PointValue> pointValues, @AxisY.AxisDependency int axisDependency) {
        super(pointValues, axisDependency);
    }

    public float getLastClose() {
        return mLastClose;
    }

    public void setLastClose(float lastClose) {
        this.mLastClose = lastClose;
    }

    @Override
    public void calcMinMax(Viewport viewport) {
        super.calcMinMax(viewport);

        if (mLastClose > 0 && getValues() != null && getValues().size() > 0) {
            float maxDiff = Math.max(Math.abs(mViewportYMin - mLastClose), Math.abs(mViewportYMax - mLastClose));
            maxDiff = Math.max(mLastClose * 0.01f, maxDiff);
            mViewportYMin = mLastClose - maxDiff;
            mViewportYMax = mLastClose + maxDiff;
        }
    }

}




@@ -790,20 +790,36 @@
 lose %3E 0
- && 
+) %7B%0A            if (
 getValue
@@ -871,16 +871,20 @@
         
+  
+  
 float ma
@@ -989,16 +989,20 @@
         
+    
 maxDiff 
@@ -1046,32 +1046,36 @@
 f);%0A            
+    
 mViewportYMin = 
@@ -1100,32 +1100,36 @@
 ff;%0A            
+ 
+   
 mViewportYMax = 
@@ -1142,32 +1142,169 @@
 lose + maxDiff;%0A
+            %7D else %7B%0A                mViewportYMin = mLastClose * 0.9f;%0A                mViewportYMax = mLastClose + 1.1f;%0A            %7D%0A
         %7D%0A    %7D%0A

fix minute line empty values