Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IBarDataSet#isStacked()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IBarDataSet#isStacked() . 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: BarHighlighter.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {
    Highlight high = super.getHighlight(x, y);

    if(high == null) {
        return null;
    }

    MPPointD pos = getValsForTouch(x, y);

    BarData barData = mChart.getBarData();

    IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex());
    if (set.isStacked()) {

        return getStackedHighlight(high,
                set,
                (float) pos.x,
                (float) pos.y);
    }

    MPPointD.recycleInstance(pos);

    return high;
}
 
Example 2
Source File: HorizontalBarHighlighter.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

    BarData barData = mChart.getBarData();

    MPPointD pos = getValsForTouch(y, x);

    Highlight high = getHighlightForX((float) pos.y, y, x);
    if (high == null) {
        return null;
    }

    IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex());
    if (set.isStacked()) {

        return getStackedHighlight(high,
                set,
                (float) pos.y,
                (float) pos.x);
    }

    MPPointD.recycleInstance(pos);

    return high;
}
 
Example 3
Source File: HorizontalBarHighlighter.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

	Highlight h = super.getHighlight(x, y);

	if (h == null)
		return h;
	else {

		IBarDataSet set = mChart.getBarData().getDataSetByIndex(h.getDataSetIndex());

		if (set.isStacked()) {

			// create an array of the touch-point
			float[] pts = new float[2];
			pts[0] = y;

			// take any transformer to determine the x-axis value
			mChart.getTransformer(set.getAxisDependency()).pixelsToValue(pts);

			return getStackedHighlight(h, set, h.getXIndex(), h.getDataSetIndex(), pts[0]);
		} else
			return h;
	}
}
 
Example 4
Source File: BarHighlighter.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {
    Highlight high = super.getHighlight(x, y);

    if(high == null) {
        return null;
    }

    MPPointD pos = getValsForTouch(x, y);

    BarData barData = mChart.getBarData();

    IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex());
    if (set.isStacked()) {

        return getStackedHighlight(high,
                set,
                (float) pos.x,
                (float) pos.y);
    }

    MPPointD.recycleInstance(pos);

    return high;
}
 
Example 5
Source File: HorizontalBarHighlighter.java    From Ticket-Analysis with MIT License 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

	BarData barData = mChart.getBarData();

	MPPointD pos = getValsForTouch(y, x);

	Highlight high = getHighlightForX((float) pos.y, y, x);
	if (high == null)
		return null;

	IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex());
	if (set.isStacked()) {

		return getStackedHighlight(high,
				set,
				(float) pos.y,
				(float) pos.x);
	}

	MPPointD.recycleInstance(pos);

	return high;
}
 
Example 6
Source File: BarHighlighter.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

	Highlight h = super.getHighlight(x, y);

	if (h == null)
		return h;
	else {

		IBarDataSet set = mChart.getBarData().getDataSetByIndex(h.getDataSetIndex());

		if (set.isStacked()) {

			// create an array of the touch-point
			float[] pts = new float[2];
			pts[1] = y;

			// take any transformer to determine the x-axis value
			mChart.getTransformer(set.getAxisDependency()).pixelsToValue(pts);

			return getStackedHighlight(h, set, h.getXIndex(), h.getDataSetIndex(), pts[1]);
		} else
			return h;
	}
}
 
Example 7
Source File: HorizontalBarHighlighter.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

	BarData barData = mChart.getBarData();

	MPPointD pos = getValsForTouch(y, x);

	Highlight high = getHighlightForX((float) pos.y, y, x);
	if (high == null)
		return null;

	IBarDataSet set = barData.getDataSetByIndex(high.getDataSetIndex());
	if (set.isStacked()) {

		return getStackedHighlight(high,
				set,
				(float) pos.y,
				(float) pos.x);
	}

	MPPointD.recycleInstance(pos);

	return high;
}
 
Example 8
Source File: HorizontalBarChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 9
Source File: HorizontalBarChartRenderer.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 10
Source File: BarChartRenderer.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 11
Source File: HorizontalBarChartRenderer.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 12
Source File: BarChartRenderer.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 13
Source File: BarChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 14
Source File: BarChartRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 15
Source File: BarChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 16
Source File: HorizontalBarChartRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 17
Source File: BarChartRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new BarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 18
Source File: HorizontalBarChartRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public void initBuffers() {

    BarData barData = mChart.getBarData();
    mBarBuffers = new HorizontalBarBuffer[barData.getDataSetCount()];

    for (int i = 0; i < mBarBuffers.length; i++) {
        IBarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getEntryCount() * 4 * (set.isStacked() ? set.getStackSize() : 1),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 19
Source File: BarHighlighter.java    From NetKnight with Apache License 2.0 4 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

	BarData barData = mChart.getBarData();

	final int xIndex = getXIndex(x);
	final float baseNoSpace = getBase(x);
	final int setCount = barData.getDataSetCount();
	int dataSetIndex = ((int)baseNoSpace) % setCount;

	if (dataSetIndex < 0) {
		dataSetIndex = 0;
	} else if (dataSetIndex >= setCount) {
		dataSetIndex = setCount - 1;
	}

	SelectionDetail selectionDetail = getSelectionDetail(xIndex, y, dataSetIndex);
	if (selectionDetail == null)
		return null;

	IBarDataSet set = barData.getDataSetByIndex(dataSetIndex);
	if (set.isStacked()) {

		float[] pts = new float[2];
		pts[1] = y;

		// take any transformer to determine the x-axis value
		mChart.getTransformer(set.getAxisDependency()).pixelsToValue(pts);

		return getStackedHighlight(selectionDetail,
				set,
				xIndex,
				pts[1]);
	}

	return new Highlight(
			xIndex,
			selectionDetail.value,
			selectionDetail.dataIndex,
			selectionDetail.dataSetIndex,
			-1);
}
 
Example 20
Source File: HorizontalBarHighlighter.java    From NetKnight with Apache License 2.0 4 votes vote down vote up
@Override
public Highlight getHighlight(float x, float y) {

	BarData barData = mChart.getBarData();

	final int xIndex = getXIndex(x);
	final float baseNoSpace = getBase(x);
	final int setCount = barData.getDataSetCount();
	int dataSetIndex = ((int)baseNoSpace) % setCount;

	if (dataSetIndex < 0) {
		dataSetIndex = 0;
	} else if (dataSetIndex >= setCount) {
		dataSetIndex = setCount - 1;
	}

	SelectionDetail selectionDetail = getSelectionDetail(xIndex, y, dataSetIndex);
	if (selectionDetail == null)
		return null;

	IBarDataSet set = barData.getDataSetByIndex(dataSetIndex);
	if (set.isStacked()) {

		float[] pts = new float[2];
		pts[0] = y;

		// take any transformer to determine the x-axis value
		mChart.getTransformer(set.getAxisDependency()).pixelsToValue(pts);

		return getStackedHighlight(selectionDetail,
				set,
				xIndex,
				pts[0]);
	}

	return new Highlight(
			xIndex,
			selectionDetail.value,
			selectionDetail.dataIndex,
			selectionDetail.dataSetIndex,
			-1);
}