本文整理汇总了Java中com.github.mikephil.charting.interfaces.datasets.IBarDataSet.getEntryCount方法的典型用法代码示例。如果您正苦于以下问题:Java IBarDataSet.getEntryCount方法的具体用法?Java IBarDataSet.getEntryCount怎么用?Java IBarDataSet.getEntryCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.interfaces.datasets.IBarDataSet
的用法示例。
在下文中一共展示了IBarDataSet.getEntryCount方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBuffers
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的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.getDataSetCount(), set.isStacked());
}
}
示例2: initBuffers
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的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.getDataSetCount(), set.isStacked());
}
}
示例3: initBuffers
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的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());
}
}
示例4: drawData
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的package包/类
@Override
public void drawData(Canvas c) {
BarData barData = mChart.getBarData();
for (int i = 0; i < barData.getDataSetCount(); i++) {
IBarDataSet set = barData.getDataSetByIndex(i);
if (set.isVisible() && set.getEntryCount() > 0) {
drawDataSet(c, set, i);
}
}
}
示例5: initBuffers
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的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());
}
}
示例6: generateTransformedValuesHorizontalBarChart
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的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: generateTransformedValuesBarChart
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的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;
}
示例8: groupBars
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的package包/类
/**
* Re-implementation of BarData.groupBars(), but allows grouping with only 1 BarDataSet
* This adjusts the x-coordinates of entries, which centers the bars between axis labels
*/
static void groupBars(final BarData barData) {
IBarDataSet max = barData.getMaxEntryCountSet();
int maxEntryCount = max.getEntryCount();
float groupSpaceWidthHalf = GROUP_SPACE / 2f;
float barWidthHalf = barData.getBarWidth() / 2f;
float interval = barData.getGroupWidth(GROUP_SPACE, 0);
float fromX = 0;
for (int i = 0; i < maxEntryCount; i++) {
float start = fromX;
fromX += groupSpaceWidthHalf;
for (IBarDataSet set : barData.getDataSets()) {
fromX += barWidthHalf;
if (i < set.getEntryCount()) {
BarEntry entry = set.getEntryForIndex(i);
if (entry != null) {
entry.setX(fromX);
}
}
fromX += barWidthHalf;
}
fromX += groupSpaceWidthHalf;
float end = fromX;
float innerInterval = end - start;
float diff = interval - innerInterval;
// correct rounding errors
if (diff > 0 || diff < 0) {
fromX += diff;
}
}
barData.notifyDataChanged();
}
示例9: groupBars
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的package包/类
/**
* Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries.
* Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified
* by the parameters.
* Do not forget to call notifyDataSetChanged() on your BarChart object after calling this method.
*
* @param fromX the starting point on the x-axis where the grouping should begin
* @param groupSpace the space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f
* @param barSpace the space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f
*/
public void groupBars(float fromX, float groupSpace, float barSpace) {
int setCount = mDataSets.size();
if (setCount <= 1) {
throw new RuntimeException("BarData needs to hold at least 2 BarDataSets to allow grouping.");
}
IBarDataSet max = getMaxEntryCountSet();
int maxEntryCount = max.getEntryCount();
float groupSpaceWidthHalf = groupSpace / 2f;
float barSpaceHalf = barSpace / 2f;
float barWidthHalf = mBarWidth / 2f;
float interval = getGroupWidth(groupSpace, barSpace);
for (int i = 0; i < maxEntryCount; i++) {
float start = fromX;
fromX += groupSpaceWidthHalf;
for (IBarDataSet set : mDataSets) {
fromX += barSpaceHalf;
fromX += barWidthHalf;
if (i < set.getEntryCount()) {
BarEntry entry = set.getEntryForIndex(i);
if (entry != null) {
entry.setX(fromX);
}
}
fromX += barWidthHalf;
fromX += barSpaceHalf;
}
fromX += groupSpaceWidthHalf;
float end = fromX;
float innerInterval = end - start;
float diff = interval - innerInterval;
// correct rounding errors
if (diff > 0 || diff < 0) {
fromX += diff;
}
}
notifyDataChanged();
}
示例10: groupBars
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; //导入方法依赖的package包/类
/**
* Groups all BarDataSet objects this data object holds together by modifying the x-position of their entries.
* Previously set x-positions of entries will be overwritten. Leaves space between bars and groups as specified
* by the parameters.
* Do not forget to call notifyDataSetChanged() on your BarChart object after calling this method.
*
* @param fromX the starting point on the x-axis where the grouping should begin
* @param groupSpace the space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1f
* @param barSpace the space between individual bars in values (not pixels) e.g. 0.1f for bar width 1f
*/
public void groupBars(float fromX, float groupSpace, float barSpace) {
int setCount = mDataSets.size();
if (setCount <= 1) {
throw new RuntimeException("BarData needs to hold at least 2 BarDataSets to allow grouping.");
}
IBarDataSet max = getMaxEntryCountSet();
int maxEntryCount = max.getEntryCount();
float groupSpaceWidthHalf = groupSpace / 2f;
float barSpaceHalf = barSpace / 2f;
float barWidthHalf = mBarWidth / 2f;
float interval = getGroupWidth(groupSpace, barSpace);
for (int i = 0; i < maxEntryCount; i++) {
float start = fromX;
fromX += groupSpaceWidthHalf;
IBarDataSet set;
final int setCountJ = mDataSets.size();
for(int j = 0 ; j < setCountJ ; j++){
set = mDataSets.get(j);
fromX += barSpaceHalf;
fromX += barWidthHalf;
if (i < set.getEntryCount()) {
BarEntry entry = set.getEntryForIndex(i);
if (entry != null) {
entry.setX(fromX);
}
}
fromX += barWidthHalf;
fromX += barSpaceHalf;
}
fromX += groupSpaceWidthHalf;
float end = fromX;
float innerInterval = end - start;
float diff = interval - innerInterval;
// correct rounding errors
if (diff > 0 || diff < 0) {
fromX += diff;
}
}
notifyDataChanged();
}