Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IDataSet#isHighlightEnabled()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IDataSet#isHighlightEnabled() . 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: ChartData.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * Returns true if highlighting of all underlying values is enabled, false
 * if not.
 *
 * @return
 */
public boolean isHighlightEnabled() {
    for (IDataSet set : mDataSets) {
        if (!set.isHighlightEnabled()) {
            return false;
        }
    }
    return true;
}
 
Example 2
Source File: ChartData.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
/**
 * Returns true if highlighting of all underlying values is enabled, false
 * if not.
 *
 * @return
 */
public boolean isHighlightEnabled() {
    for (IDataSet set : mDataSets) {
        if (!set.isHighlightEnabled())
            return false;
    }
    return true;
}
 
Example 3
Source File: ChartData.java    From android-kline with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if highlighting of all underlying values is enabled, false
 * if not.
 *
 * @return
 */
public boolean isHighlightEnabled() {
    for (IDataSet set : mDataSets) {
        if (!set.isHighlightEnabled())
            return false;
    }
    return true;
}
 
Example 4
Source File: ChartData.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if highlighting of all underlying values is enabled, false
 * if not.
 *
 * @return
 */
public boolean isHighlightEnabled() {
    for (IDataSet set : mDataSets) {
        if (!set.isHighlightEnabled())
            return false;
    }
    return true;
}
 
Example 5
Source File: ChartData.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if highlighting of all underlying values is enabled, false
 * if not.
 *
 * @return
 */
public boolean isHighlightEnabled() {
    for (IDataSet set : mDataSets) {
        if (!set.isHighlightEnabled())
            return false;
    }
    return true;
}
 
Example 6
Source File: CombinedHighlighter.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a list of SelectionDetail object corresponding to the given xIndex.
 *
 * @param xIndex
 * @return
 */
@Override
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex, int dataSetIndex) {

    List<SelectionDetail> vals = new ArrayList<SelectionDetail>();
    float[] pts = new float[2];

    CombinedData data = (CombinedData) mChart.getData();

    // get all chartdata objects
    List<ChartData> dataObjects = data.getAllData();

    for (int i = 0; i < dataObjects.size(); i++) {

        for(int j = 0; j < dataObjects.get(i).getDataSetCount(); j++) {

            IDataSet dataSet = dataObjects.get(i).getDataSetByIndex(j);

            // dont include datasets that cannot be highlighted
            if (!dataSet.isHighlightEnabled())
                continue;

            // extract all y-values from all DataSets at the given x-index
            final float yVals[] = dataSet.getYValsForXIndex(xIndex);
            for (float yVal : yVals) {
                pts[1] = yVal;

                mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);

                if (!Float.isNaN(pts[1])) {
                    vals.add(new SelectionDetail(pts[1], yVal, i, j, dataSet));
                }
            }
        }
    }

    return vals;
}
 
Example 7
Source File: ChartHighlighter.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
/**
 * Returns a list of Highlight objects representing the entries closest to the given xVal.
 * The returned list contains two objects per DataSet (closest rounding up, closest rounding down).
 *
 * @param xVal the transformed x-value of the x-touch position
 * @param x    touch position
 * @param y    touch position
 * @return
 */
protected List<Highlight> getHighlightsAtXValue(float xVal, float x, float y) {

    mHighlightBuffer.clear();

    BarLineScatterCandleBubbleData data = getData();

    if (data == null) {
        return mHighlightBuffer;
    }

    for (int i = 0, dataSetCount = data.getDataSetCount(); i < dataSetCount; i++) {

        IDataSet dataSet = data.getDataSetByIndex(i);

        // don't include DataSets that cannot be highlighted
        if (!dataSet.isHighlightEnabled()) {
            continue;
        }

        mHighlightBuffer.addAll(buildHighlights(dataSet, i, xVal, DataSet.Rounding.CLOSEST));
    }

    return mHighlightBuffer;
}
 
Example 8
Source File: ChartHighlighter.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
/**
 * Returns a list of Highlight objects representing the entries closest to the given xVal.
 * The returned list contains two objects per DataSet (closest rounding up, closest rounding down).
 *
 * @param xVal the transformed x-value of the x-touch position
 * @param x    touch position
 * @param y    touch position
 * @return
 */
protected List<Highlight> getHighlightsAtXValue(float xVal, float x, float y) {

    mHighlightBuffer.clear();

    BarLineScatterCandleBubbleData data = getData();

    if (data == null)
        return mHighlightBuffer;

    for (int i = 0, dataSetCount = data.getDataSetCount(); i < dataSetCount; i++) {

        IDataSet dataSet = data.getDataSetByIndex(i);

        // don't include DataSets that cannot be highlighted
        if (!dataSet.isHighlightEnabled())
            continue;

        mHighlightBuffer.addAll(buildHighlights(dataSet, i, xVal, DataSet.Rounding.CLOSEST));
    }

    return mHighlightBuffer;
}
 
Example 9
Source File: ChartHighlighter.java    From android-kline with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a list of Highlight objects representing the entries closest to the given xVal.
 * The returned list contains two objects per DataSet (closest rounding up, closest rounding down).
 *
 * @param xVal the transformed x-value of the x-touch position
 * @param x    touch position
 * @param y    touch position
 * @return
 */
protected List<Highlight> getHighlightsAtXValue(float xVal, float x, float y) {

    mHighlightBuffer.clear();

    BarLineScatterCandleBubbleData data = getData();

    if (data == null)
        return mHighlightBuffer;

    for (int i = 0, dataSetCount = data.getDataSetCount(); i < dataSetCount; i++) {

        IDataSet dataSet = data.getDataSetByIndex(i);

        // don't include DataSets that cannot be highlighted
        if (!dataSet.isHighlightEnabled())
            continue;

        mHighlightBuffer.addAll(buildHighlights(dataSet, i, xVal, DataSet.Rounding.CLOSEST));
    }

    return mHighlightBuffer;
}
 
Example 10
Source File: ChartHighlighter.java    From NetKnight with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a list of SelectionDetail object corresponding to the given xIndex.
 *
 * @param xIndex
 * @param dataSetIndex dataSet index to look at. -1 if unspecified.
 * @return
 */
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex, int dataSetIndex) {

	List<SelectionDetail> vals = new ArrayList<SelectionDetail>();

	if (mChart.getData() == null) return vals;

	float[] pts = new float[2];

	for (int i = 0, dataSetCount = mChart.getData().getDataSetCount();
		 i < dataSetCount;
		 i++) {

		if (dataSetIndex > -1 && dataSetIndex != i)
			continue;

		IDataSet dataSet = mChart.getData().getDataSetByIndex(i);

		// dont include datasets that cannot be highlighted
		if (!dataSet.isHighlightEnabled())
			continue;

		// extract all y-values from all DataSets at the given x-index
		final float[] yVals = dataSet.getYValsForXIndex(xIndex);
		for (float yVal : yVals) {
			if (Float.isNaN(yVal))
				continue;

			pts[1] = yVal;

			mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);

			if (!Float.isNaN(pts[1]))
			{
				vals.add(new SelectionDetail(pts[1], yVal, i, dataSet));
			}
		}
	}

	return vals;
}
 
Example 11
Source File: CombinedHighlighter.java    From Stayfit with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a list of SelectionDetail object corresponding to the given xIndex.
 *
 * @param xIndex
 * @return
 */
@Override
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex) {

    CombinedData data = (CombinedData) mChart.getData();

    // get all chartdata objects
    List<ChartData> dataObjects = data.getAllData();

    List<SelectionDetail> vals = new ArrayList<SelectionDetail>();

    float[] pts = new float[2];

    for (int i = 0; i < dataObjects.size(); i++) {

        for(int j = 0; j < dataObjects.get(i).getDataSetCount(); j++) {

            IDataSet dataSet = dataObjects.get(i).getDataSetByIndex(j);

            // dont include datasets that cannot be highlighted
            if (!dataSet.isHighlightEnabled())
                continue;

            // extract all y-values from all DataSets at the given x-index
            final float yVal = dataSet.getYValForXIndex(xIndex);
            if (yVal == Float.NaN)
                continue;

            pts[1] = yVal;

            mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);

            if (!Float.isNaN(pts[1])) {
                vals.add(new SelectionDetail(pts[1], j, dataSet));
            }
        }
    }

    return vals;
}
 
Example 12
Source File: ChartHighlighter.java    From Stayfit with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a list of SelectionDetail object corresponding to the given xIndex.
 * 
 * @param xIndex
 * @return
 */
protected List<SelectionDetail> getSelectionDetailsAtIndex(int xIndex) {

	List<SelectionDetail> vals = new ArrayList<SelectionDetail>();

	float[] pts = new float[2];

	for (int i = 0; i < mChart.getData().getDataSetCount(); i++) {

		IDataSet dataSet = mChart.getData().getDataSetByIndex(i);

		// dont include datasets that cannot be highlighted
		if (!dataSet.isHighlightEnabled())
			continue;

		// extract all y-values from all DataSets at the given x-index
		final float yVal = dataSet.getYValForXIndex(xIndex);
		if (yVal == Float.NaN)
			continue;

		pts[1] = yVal;

		mChart.getTransformer(dataSet.getAxisDependency()).pointValuesToPixel(pts);

		if (!Float.isNaN(pts[1])) {
			vals.add(new SelectionDetail(pts[1], i, dataSet));
		}
	}

	return vals;
}