本文整理汇总了Java中com.github.mikephil.charting.data.BarData.getGroupSpace方法的典型用法代码示例。如果您正苦于以下问题:Java BarData.getGroupSpace方法的具体用法?Java BarData.getGroupSpace怎么用?Java BarData.getGroupSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.BarData
的用法示例。
在下文中一共展示了BarData.getGroupSpace方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawLabels
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
* draws the x-labels on the specified y-position
*
* @param pos
*/
@Override
protected void drawLabels(Canvas c, float pos, PointF anchor) {
final float labelRotationAngleDegrees = mXAxis.getLabelRotationAngle();
// pre allocate to save performance (dont allocate in loop)
float[] position = new float[] {
0f, 0f
};
BarData bd = mChart.getData();
int step = bd.getDataSetCount();
for (int i = mMinX; i <= mMaxX; i += mXAxis.mAxisLabelModulus) {
position[1] = i * step + i * bd.getGroupSpace()
+ bd.getGroupSpace() / 2f;
// consider groups (center label for each group)
if (step > 1) {
position[1] += ((float) step - 1f) / 2f;
}
mTrans.pointValuesToPixel(position);
if (mViewPortHandler.isInBoundsY(position[1])) {
String label = mXAxis.getValues().get(i);
drawLabel(c, label, i, pos, position[1], anchor, labelRotationAngleDegrees);
}
}
}
示例2: renderGridLines
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@Override
public void renderGridLines(Canvas c) {
if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())
return;
float[] position = new float[] {
0f, 0f
};
mGridPaint.setColor(mXAxis.getGridColor());
mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
BarData bd = mChart.getData();
// take into consideration that multiple DataSets increase mDeltaX
int step = bd.getDataSetCount();
for (int i = mMinX; i <= mMaxX; i += mXAxis.mAxisLabelModulus) {
position[1] = i * step + i * bd.getGroupSpace() - 0.5f;
mTrans.pointValuesToPixel(position);
if (mViewPortHandler.isInBoundsY(position[1])) {
c.drawLine(mViewPortHandler.contentLeft(), position[1],
mViewPortHandler.contentRight(), position[1], mGridPaint);
}
}
}
示例3: renderGridLines
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@Override
public void renderGridLines(Canvas c) {
if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())
return;
float[] position = new float[] {
0f, 0f
};
mGridPaint.setColor(mXAxis.getGridColor());
mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
BarData bd = mChart.getData();
int step = bd.getDataSetCount();
for (int i = mMinX; i < mMaxX; i += mXAxis.mAxisLabelModulus) {
position[0] = i * step + i * bd.getGroupSpace() - 0.5f;
mTrans.pointValuesToPixel(position);
if (mViewPortHandler.isInBoundsX(position[0])) {
c.drawLine(position[0], mViewPortHandler.offsetTop(), position[0],
mViewPortHandler.contentBottom(), mGridPaint);
}
}
}
示例4: initBuffers
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@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());
}
}
示例5: generateTransformedValuesBarChart
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
* Transforms an List of Entry into a float array containing the x and
* y values transformed with all matrices for the BARCHART.
*
* @param data
* @param dataSetIndex the dataset index
* @param bd
* @param phaseY
* @return
*/
public float[] generateTransformedValuesBarChart(IBarDataSet data,
int dataSetIndex, BarData bd, float phaseY) {
float[] valuePoints = new float[data.getEntryCount() * 2];
int setCount = bd.getDataSetCount();
float space = bd.getGroupSpace();
for (int j = 0; j < valuePoints.length; j += 2) {
Entry e = data.getEntryForIndex(j / 2);
int i = e.getXIndex();
// calculate the x-position, depending on datasetcount
float x = e.getXIndex() + i * (setCount - 1) + dataSetIndex + space * i
+ space / 2f;
float y = e.getVal();
valuePoints[j] = x;
valuePoints[j + 1] = y * phaseY;
}
getValueToPixelMatrix().mapPoints(valuePoints);
return valuePoints;
}
示例6: generateTransformedValuesHorizontalBarChart
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
* Transforms an List of Entry into a float array containing the x and
* y values transformed with all matrices for the BARCHART.
*
* @param data
* @param dataSet the dataset index
* @return
*/
public float[] generateTransformedValuesHorizontalBarChart(IBarDataSet data,
int dataSet, BarData bd, float phaseY) {
float[] valuePoints = new float[data.getEntryCount() * 2];
int setCount = bd.getDataSetCount();
float space = bd.getGroupSpace();
for (int j = 0; j < valuePoints.length; j += 2) {
Entry e = data.getEntryForIndex(j / 2);
int i = e.getXIndex();
// calculate the x-position, depending on datasetcount
float x = i + i * (setCount - 1) + dataSet + space * i
+ space / 2f;
float y = e.getVal();
valuePoints[j] = y * phaseY;
valuePoints[j + 1] = x;
}
getValueToPixelMatrix().mapPoints(valuePoints);
return valuePoints;
}
示例7: initBuffers
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@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());
}
}
示例8: drawLabels
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
* draws the x-labels on the specified y-position
*
* @param pos
*/
@Override
protected void drawLabels(Canvas c, float pos) {
// pre allocate to save performance (dont allocate in loop)
float[] position = new float[] {
0f, 0f
};
BarData bd = mChart.getData();
int step = bd.getDataSetCount();
for (int i = mMinX; i <= mMaxX; i += mXAxis.mAxisLabelModulus) {
position[1] = i * step + i * bd.getGroupSpace()
+ bd.getGroupSpace() / 2f;
// consider groups (center label for each group)
if (step > 1) {
position[1] += ((float) step - 1f) / 2f;
}
mTrans.pointValuesToPixel(position);
if (mViewPortHandler.isInBoundsY(position[1])) {
String label = mXAxis.getValues().get(i);
drawLabel(c, label, i, pos, position[1] + mXAxis.mLabelHeight / 2f);
}
}
}
示例9: generateTransformedValuesHorizontalBarChart
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
* Transforms an List of Entry into a float array containing the x and
* y values transformed with all matrices for the BARCHART.
*
* @param entries
* @param dataSet the dataset index
* @return
*/
public float[] generateTransformedValuesHorizontalBarChart(List<? extends Entry> entries,
int dataSet, BarData bd, float phaseY) {
float[] valuePoints = new float[entries.size() * 2];
int setCount = bd.getDataSetCount();
float space = bd.getGroupSpace();
for (int j = 0; j < valuePoints.length; j += 2) {
Entry e = entries.get(j / 2);
int i = e.getXIndex();
// calculate the x-position, depending on datasetcount
float x = i + i * (setCount - 1) + dataSet + space * i
+ space / 2f ;
float y = e.getVal();
valuePoints[j] = y * phaseY;
valuePoints[j + 1] = x;
}
getValueToPixelMatrix().mapPoints(valuePoints);
return valuePoints;
}
示例10: initBuffers
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@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());
}
}