com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet Java Examples

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BarLineScatterCandleBubbleRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Checks if the provided entry object is in bounds for drawing considering the current animation phase.
 *
 * @param e
 * @param set
 * @return
 */
protected boolean isInBoundsX(Entry e, IBarLineScatterCandleBubbleDataSet set) {

    if (e == null)
        return false;

    float entryIndex = set.getEntryIndex(e);

    if (e == null || entryIndex >= set.getEntryCount() * mAnimator.getPhaseX()) {
        return false;
    } else {
        return true;
    }
}
 
Example #2
Source File: BarLineChartTouchListener.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) {
    super(chart);
    this.mMatrix = touchMatrix;

    // this equals to about 9 pixels on a 5.5" FHD screen
    this.mDragTriggerDist = Utils.convertDpToPixel(3f);

    this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f);
}
 
Example #3
Source File: BarLineChartBase.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
/**
 * returns the DataSet object displayed at the touched position of the chart
 *
 * @param x
 * @param y
 * @return
 */
public IBarLineScatterCandleBubbleDataSet getDataSetByTouchPoint(float x, float y) {
    Highlight h = getHighlightByTouchPoint(x, y);
    if (h != null) {
        return mData.getDataSetByIndex(h.getDataSetIndex());
    }
    return null;
}
 
Example #4
Source File: BarLineChartBase.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
/**
 * returns the DataSet object displayed at the touched position of the chart
 *
 * @param x
 * @param y
 * @return
 */
public IBarLineScatterCandleBubbleDataSet getDataSetByTouchPoint(float x, float y) {
    Highlight h = getHighlightByTouchPoint(x, y);
    if (h != null) {
        return mData.getDataSetByIndex(h.getDataSetIndex());
    }
    return null;
}
 
Example #5
Source File: BarLineScatterCandleBubbleRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * Calculates the minimum and maximum x values as well as the range between them.
 *
 * @param chart
 * @param dataSet
 */
public void set(BarLineScatterCandleBubbleDataProvider chart, IBarLineScatterCandleBubbleDataSet dataSet) {
    float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));

    float low = chart.getLowestVisibleX();
    float high = chart.getHighestVisibleX();

    Entry entryFrom = dataSet.getEntryForXValue(low, Float.NaN, DataSet.Rounding.DOWN);
    Entry entryTo = dataSet.getEntryForXValue(high, Float.NaN, DataSet.Rounding.UP);

    min = entryFrom == null ? 0 : dataSet.getEntryIndex(entryFrom);
    max = entryTo == null ? 0 : dataSet.getEntryIndex(entryTo);
    range = (int) ((max - min) * phaseX);
}
 
Example #6
Source File: BarLineScatterCandleBubbleRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the provided entry object is in bounds for drawing considering the current animation phase.
 *
 * @param e
 * @param set
 * @return
 */
protected boolean isInBoundsX(Entry e, IBarLineScatterCandleBubbleDataSet set) {

    if (e == null)
        return false;

    float entryIndex = set.getEntryIndex(e);

    if (e == null || entryIndex >= set.getEntryCount() * mAnimator.getPhaseX()) {
        return false;
    } else {
        return true;
    }
}
 
Example #7
Source File: BarLineChartTouchListener.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor with initialization parameters.
 *
 * @param chart               instance of the chart
 * @param touchMatrix         the touch-matrix of the chart
 * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals
 *                            to about 9 pixels on a 5.5" FHD screen)
 */
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends
        IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) {
    super(chart);
    this.mMatrix = touchMatrix;

    this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance);

    this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f);
}
 
Example #8
Source File: BarLineChartBase.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * returns the DataSet object displayed at the touched position of the chart
 *
 * @param x
 * @param y
 * @return
 */
public IBarLineScatterCandleBubbleDataSet getDataSetByTouchPoint(float x, float y) {
    Highlight h = getHighlightByTouchPoint(x, y);
    if (h != null) {
        return mData.getDataSetByIndex(h.getDataSetIndex());
    }
    return null;
}
 
Example #9
Source File: BarLineScatterCandleBubbleRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Calculates the minimum and maximum x values as well as the range between them.
 *
 * @param chart
 * @param dataSet
 */
public void set(BarLineScatterCandleBubbleDataProvider chart, IBarLineScatterCandleBubbleDataSet dataSet) {
    float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));

    float low = chart.getLowestVisibleX();
    float high = chart.getHighestVisibleX();

    Entry entryFrom = dataSet.getEntryForXValue(low, Float.NaN, DataSet.Rounding.DOWN);
    Entry entryTo = dataSet.getEntryForXValue(high, Float.NaN, DataSet.Rounding.UP);

    min = entryFrom == null ? 0 : dataSet.getEntryIndex(entryFrom);
    max = entryTo == null ? 0 : dataSet.getEntryIndex(entryTo);
    range = (int) ((max - min) * phaseX);
}
 
Example #10
Source File: BarLineChartBase.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * returns the DataSet object displayed at the touched position of the chart
 *
 * @param x
 * @param y
 * @return
 */
public IBarLineScatterCandleBubbleDataSet getDataSetByTouchPoint(float x, float y) {
    Highlight h = getHighlightByTouchPoint(x, y);
    if (h != null) {
        return mData.getDataSetByIndex(h.getDataSetIndex());
    }
    return null;
}
 
Example #11
Source File: CombinedData.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Get dataset for highlight
 *
 * @param highlight current highlight
 * @return dataset related to highlight
 */
public IBarLineScatterCandleBubbleDataSet<? extends Entry> getDataSetByHighlight(Highlight highlight) {
    if (highlight.getDataIndex() >= getAllData().size())
        return null;

    BarLineScatterCandleBubbleData data = getDataByIndex(highlight.getDataIndex());

    if (highlight.getDataSetIndex() >= data.getDataSetCount())
        return null;

    return (IBarLineScatterCandleBubbleDataSet<? extends Entry>)
            data.getDataSets().get(highlight.getDataSetIndex());
}
 
Example #12
Source File: BarLineChartTouchListener.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Constructor with initialization parameters.
 *
 * @param chart               instance of the chart
 * @param touchMatrix         the touch-matrix of the chart
 * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals
 *                            to about 9 pixels on a 5.5" FHD screen)
 */
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends
        IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) {
    super(chart);
    this.mMatrix = touchMatrix;

    this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance);

    this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f);
}
 
Example #13
Source File: BarLineChartBase.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * returns the DataSet object displayed at the touched position of the chart
 *
 * @param x
 * @param y
 * @return
 */
public IBarLineScatterCandleBubbleDataSet getDataSetByTouchPoint(float x, float y) {
    Highlight h = getHighlightByTouchPoint(x, y);
    if (h != null) {
        return mData.getDataSetByIndex(h.getDataSetIndex());
    }
    return null;
}
 
Example #14
Source File: BarLineScatterCandleBubbleRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * Calculates the minimum and maximum x values as well as the range between them.
 *
 * @param chart
 * @param dataSet
 */
public void set(BarLineScatterCandleBubbleDataProvider chart, IBarLineScatterCandleBubbleDataSet dataSet) {
    float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));

    float low = chart.getLowestVisibleX();
    float high = chart.getHighestVisibleX();

    Entry entryFrom = dataSet.getEntryForXValue(low, Float.NaN, DataSet.Rounding.DOWN);
    Entry entryTo = dataSet.getEntryForXValue(high, Float.NaN, DataSet.Rounding.UP);

    min = entryFrom == null ? 0 : dataSet.getEntryIndex(entryFrom);
    max = entryTo == null ? 0 : dataSet.getEntryIndex(entryTo);
    range = (int) ((max - min) * phaseX);
}
 
Example #15
Source File: BarLineScatterCandleBubbleRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * Checks if the provided entry object is in bounds for drawing considering the current animation phase.
 *
 * @param e
 * @param set
 * @return
 */
protected boolean isInBoundsX(Entry e, IBarLineScatterCandleBubbleDataSet set) {

    if (e == null) {
        return false;
    }

    float entryIndex = set.getEntryIndex(e);

    if (e == null || entryIndex >= set.getEntryCount() * mAnimator.getPhaseX()) {
        return false;
    } else {
        return true;
    }
}
 
Example #16
Source File: CombinedData.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * Get dataset for highlight
 *
 * @param highlight current highlight
 * @return dataset related to highlight
 */
public IBarLineScatterCandleBubbleDataSet<? extends Entry> getDataSetByHighlight(Highlight highlight) {
    if (highlight.getDataIndex() >= getAllData().size()) {
        return null;
    }

    BarLineScatterCandleBubbleData data = getDataByIndex(highlight.getDataIndex());

    if (highlight.getDataSetIndex() >= data.getDataSetCount()) {
        return null;
    }

    return (IBarLineScatterCandleBubbleDataSet<? extends Entry>)
            data.getDataSets().get(highlight.getDataSetIndex());
}
 
Example #17
Source File: BarLineChartTouchListener.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * Constructor with initialization parameters.
 *
 * @param chart               instance of the chart
 * @param touchMatrix         the touch-matrix of the chart
 * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals
 *                            to about 9 pixels on a 5.5" FHD screen)
 */
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends
        IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) {
    super(chart);
    this.mMatrix = touchMatrix;

    this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance);

    this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f);
}
 
Example #18
Source File: CombinedData.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) {

    List<BarLineScatterCandleBubbleData> datas = getAllData();

    boolean success = false;

    for (ChartData data : datas) {

        success = data.removeDataSet(d);

        if (success) {
            break;
        }
    }

    return success;
}
 
Example #19
Source File: CombinedData.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public void calcMinMax() {

    if(mDataSets == null){
        mDataSets = new ArrayList<>();
    }
    mDataSets.clear();

    mYMax = -Float.MAX_VALUE;
    mYMin = Float.MAX_VALUE;
    mXMax = -Float.MAX_VALUE;
    mXMin = Float.MAX_VALUE;

    mLeftAxisMax = -Float.MAX_VALUE;
    mLeftAxisMin = Float.MAX_VALUE;
    mRightAxisMax = -Float.MAX_VALUE;
    mRightAxisMin = Float.MAX_VALUE;

    List<BarLineScatterCandleBubbleData> allData = getAllData();

    for (ChartData data : allData) {

        data.calcMinMax();

        List<IBarLineScatterCandleBubbleDataSet<? extends Entry>> sets = data.getDataSets();
        mDataSets.addAll(sets);

        if (data.getYMax() > mYMax)
            mYMax = data.getYMax();

        if (data.getYMin() < mYMin)
            mYMin = data.getYMin();

        if (data.getXMax() > mXMax)
            mXMax = data.getXMax();

        if (data.getXMin() < mXMin)
            mXMin = data.getXMin();

        if (data.mLeftAxisMax > mLeftAxisMax)
            mLeftAxisMax = data.mLeftAxisMax;

        if (data.mLeftAxisMin < mLeftAxisMin)
            mLeftAxisMin = data.mLeftAxisMin;

        if (data.mRightAxisMax > mRightAxisMax)
            mRightAxisMax = data.mRightAxisMax;

        if (data.mRightAxisMin < mRightAxisMin)
            mRightAxisMin = data.mRightAxisMin;

    }
}
 
Example #20
Source File: CombinedData.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public void calcMinMax() {

    if (mDataSets == null) {
        mDataSets = new ArrayList<>();
    }
    mDataSets.clear();

    mYMax = -Float.MAX_VALUE;
    mYMin = Float.MAX_VALUE;
    mXMax = -Float.MAX_VALUE;
    mXMin = Float.MAX_VALUE;

    mLeftAxisMax = -Float.MAX_VALUE;
    mLeftAxisMin = Float.MAX_VALUE;
    mRightAxisMax = -Float.MAX_VALUE;
    mRightAxisMin = Float.MAX_VALUE;

    List<BarLineScatterCandleBubbleData> allData = getAllData();

    for (ChartData data : allData) {

        data.calcMinMax();

        List<IBarLineScatterCandleBubbleDataSet<? extends Entry>> sets = data.getDataSets();
        mDataSets.addAll(sets);

        if (data.getYMax() > mYMax)
            mYMax = data.getYMax();

        if (data.getYMin() < mYMin)
            mYMin = data.getYMin();

        if (data.getXMax() > mXMax)
            mXMax = data.getXMax();

        if (data.getXMin() < mXMin)
            mXMin = data.getXMin();

        if (data.mLeftAxisMax > mLeftAxisMax)
            mLeftAxisMax = data.mLeftAxisMax;

        if (data.mLeftAxisMin < mLeftAxisMin)
            mLeftAxisMin = data.mLeftAxisMin;

        if (data.mRightAxisMax > mRightAxisMax)
            mRightAxisMax = data.mRightAxisMax;

        if (data.mRightAxisMin < mRightAxisMin)
            mRightAxisMin = data.mRightAxisMin;

    }
}
 
Example #21
Source File: CombinedData.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) {

    List<BarLineScatterCandleBubbleData> datas = getAllData();

    boolean success = false;

    for (ChartData data : datas) {

        success = data.removeDataSet(d);

        if (success) {
            break;
        }
    }

    return success;
}
 
Example #22
Source File: CombinedData.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) {

    List<BarLineScatterCandleBubbleData> datas = getAllData();

    boolean success = false;

    for (ChartData data : datas) {

        success = data.removeDataSet(d);

        if (success) {
            break;
        }
    }

    return success;
}
 
Example #23
Source File: BarLineChartTouchListener.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) {
    super(chart);
    this.mMatrix = touchMatrix;
}
 
Example #24
Source File: CombinedData.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public void calcMinMax() {

    if (mDataSets == null) {
        mDataSets = new ArrayList<>();
    }
    mDataSets.clear();

    mYMax = -Float.MAX_VALUE;
    mYMin = Float.MAX_VALUE;
    mXMax = -Float.MAX_VALUE;
    mXMin = Float.MAX_VALUE;

    mLeftAxisMax = -Float.MAX_VALUE;
    mLeftAxisMin = Float.MAX_VALUE;
    mRightAxisMax = -Float.MAX_VALUE;
    mRightAxisMin = Float.MAX_VALUE;

    List<BarLineScatterCandleBubbleData> allData = getAllData();

    for (ChartData data : allData) {

        data.calcMinMax();

        List<IBarLineScatterCandleBubbleDataSet<? extends Entry>> sets = data.getDataSets();
        mDataSets.addAll(sets);

        if (data.getYMax() > mYMax) {
            mYMax = data.getYMax();
        }

        if (data.getYMin() < mYMin) {
            mYMin = data.getYMin();
        }

        if (data.getXMax() > mXMax) {
            mXMax = data.getXMax();
        }

        if (data.getXMin() < mXMin) {
            mXMin = data.getXMin();
        }

        if (data.mLeftAxisMax > mLeftAxisMax) {
            mLeftAxisMax = data.mLeftAxisMax;
        }

        if (data.mLeftAxisMin < mLeftAxisMin) {
            mLeftAxisMin = data.mLeftAxisMin;
        }

        if (data.mRightAxisMax > mRightAxisMax) {
            mRightAxisMax = data.mRightAxisMax;
        }

        if (data.mRightAxisMin < mRightAxisMin) {
            mRightAxisMin = data.mRightAxisMin;
        }

    }
}