Java Code Examples for com.github.mikephil.charting.data.BarDataSet#isStacked()

The following examples show how to use com.github.mikephil.charting.data.BarDataSet#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 iMoney 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 {

		BarDataSet 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 2
Source File: HorizontalBarHighlighter.java    From iMoney 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 {

		BarDataSet 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 3
Source File: BarChartRenderer.java    From iMoney 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++) {
        BarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new BarBuffer(set.getValueCount() * 4 * set.getStackSize(),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}
 
Example 4
Source File: HorizontalBarChartRenderer.java    From iMoney 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++) {
        BarDataSet set = barData.getDataSetByIndex(i);
        mBarBuffers[i] = new HorizontalBarBuffer(set.getValueCount() * 4 * set.getStackSize(),
                barData.getGroupSpace(),
                barData.getDataSetCount(), set.isStacked());
    }
}