本文整理汇总了Java中com.github.mikephil.charting.data.BubbleData类的典型用法代码示例。如果您正苦于以下问题:Java BubbleData类的具体用法?Java BubbleData怎么用?Java BubbleData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BubbleData类属于com.github.mikephil.charting.data包,在下文中一共展示了BubbleData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateBubbleData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
protected BubbleData generateBubbleData() {
BubbleData bd = new BubbleData();
ArrayList<BubbleEntry> entries = new ArrayList<BubbleEntry>();
for (int index = 0; index < itemcount; index++) {
float y = getRandom(10, 105);
float size = getRandom(100, 105);
entries.add(new BubbleEntry(index + 0.5f, y, size));
}
BubbleDataSet set = new BubbleDataSet(entries, "Bubble DataSet");
set.setColors(ColorTemplate.VORDIPLOM_COLORS);
set.setValueTextSize(10f);
set.setValueTextColor(Color.WHITE);
set.setHighlightCircleWidth(1.5f);
set.setDrawValues(true);
bd.addDataSet(set);
return bd;
}
示例2: setData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
private void setData() {
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
RealmBubbleDataSet<RealmDemoData> set = new RealmBubbleDataSet<RealmDemoData>(result, "xValue", "yValue", "bubbleSize");
set.setLabel("Realm BubbleDataSet");
set.setColors(ColorTemplate.COLORFUL_COLORS, 110);
ArrayList<IBubbleDataSet> dataSets = new ArrayList<IBubbleDataSet>();
dataSets.add(set); // add the dataset
// create a data object with the dataset list
BubbleData data = new BubbleData(dataSets);
styleData(data);
// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
示例3: generateBubbleData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
protected BubbleData generateBubbleData() {
BubbleData bd = new BubbleData();
ArrayList<BubbleEntry> entries = new ArrayList<BubbleEntry>();
for (int index = 0; index < itemcount; index++) {
float rnd = getRandom(20, 30);
entries.add(new BubbleEntry(index, rnd, rnd));
}
BubbleDataSet set = new BubbleDataSet(entries, "Bubble DataSet");
set.setColors(ColorTemplate.VORDIPLOM_COLORS);
set.setValueTextSize(10f);
set.setValueTextColor(Color.WHITE);
set.setHighlightCircleWidth(1.5f);
set.setDrawValues(true);
bd.addDataSet(set);
return bd;
}
示例4: drawData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
BubbleData bubbleData = mChart.getBubbleData();
for (IBubbleDataSet set : bubbleData.getDataSets()) {
if (set.isVisible())
drawDataSet(c, set);
}
}
示例5: drawData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
BubbleData bubbleData = mChart.getBubbleData();
for (IBubbleDataSet set : bubbleData.getDataSets()) {
if (set.isVisible() && set.getEntryCount() > 0)
drawDataSet(c, set);
}
}
示例6: drawData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
BubbleData bubbleData = mChart.getBubbleData();
for (BubbleDataSet set : bubbleData.getDataSets()) {
if (set.isVisible() && set.getEntryCount() > 0)
drawDataSet(c, set);
}
}
示例7: drawData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
BubbleData bubbleData = mChart.getBubbleData();
IBubbleDataSet set;
List<IBubbleDataSet> dataSets = bubbleData.getDataSets();
int setCount = dataSets.size();
for (int i = 0; i < setCount; i++) {
set = dataSets.get(i);
if (set.isVisible())
drawDataSet(c, set);
}
}
示例8: getBubbleData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public BubbleData getBubbleData() {
if (mData == null)
return null;
return mData.getBubbleData();
}
示例9: getBubbleData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
public BubbleData getBubbleData() {
return mData;
}
示例10: drawHighlighted
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
BubbleData bubbleData = mChart.getBubbleData();
float phaseY = mAnimator.getPhaseY();
for (Highlight high : indices) {
IBubbleDataSet set = bubbleData.getDataSetByIndex(high.getDataSetIndex());
if (set == null || !set.isHighlightEnabled())
continue;
final BubbleEntry entry = set.getEntryForXValue(high.getX(), high.getY());
if (entry.getY() != high.getY())
continue;
if (!isInBoundsX(entry, set))
continue;
Transformer trans = mChart.getTransformer(set.getAxisDependency());
sizeBuffer[0] = 0f;
sizeBuffer[2] = 1f;
trans.pointValuesToPixel(sizeBuffer);
boolean normalizeSize = set.isNormalizeSizeEnabled();
// calcualte the full width of 1 step on the x-axis
final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
final float maxBubbleHeight = Math.abs(
mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);
pointBuffer[0] = entry.getX();
pointBuffer[1] = (entry.getY()) * phaseY;
trans.pointValuesToPixel(pointBuffer);
high.setDraw(pointBuffer[0], pointBuffer[1]);
float shapeHalf = getShapeSize(entry.getSize(),
set.getMaxSize(),
referenceSize,
normalizeSize) / 2f;
if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
|| !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
break;
final int originalColor = set.getColor((int) entry.getX());
Color.RGBToHSV(Color.red(originalColor), Color.green(originalColor),
Color.blue(originalColor), _hsvBuffer);
_hsvBuffer[2] *= 0.5f;
final int color = Color.HSVToColor(Color.alpha(originalColor), _hsvBuffer);
mHighlightPaint.setColor(color);
mHighlightPaint.setStrokeWidth(set.getHighlightCircleWidth());
c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mHighlightPaint);
}
}
示例11: drawHighlighted
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
BubbleData bubbleData = mChart.getBubbleData();
float phaseX = mAnimator.getPhaseX();
float phaseY = mAnimator.getPhaseY();
for (Highlight indice : indices) {
IBubbleDataSet dataSet = bubbleData.getDataSetByIndex(indice.getDataSetIndex());
if (dataSet == null || !dataSet.isHighlightEnabled())
continue;
BubbleEntry entryFrom = dataSet.getEntryForXIndex(mMinX);
BubbleEntry entryTo = dataSet.getEntryForXIndex(mMaxX);
int minx = dataSet.getEntryIndex(entryFrom);
int maxx = Math.min(dataSet.getEntryIndex(entryTo) + 1, dataSet.getEntryCount());
final BubbleEntry entry = (BubbleEntry) bubbleData.getEntryForHighlight(indice);
if (entry == null || entry.getXIndex() != indice.getXIndex())
continue;
Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());
sizeBuffer[0] = 0f;
sizeBuffer[2] = 1f;
trans.pointValuesToPixel(sizeBuffer);
// calcualte the full width of 1 step on the x-axis
final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
final float maxBubbleHeight = Math.abs(mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);
pointBuffer[0] = (float) (entry.getXIndex() - minx) * phaseX + (float) minx;
pointBuffer[1] = (float) (entry.getVal()) * phaseY;
trans.pointValuesToPixel(pointBuffer);
float shapeHalf = getShapeSize(entry.getSize(), dataSet.getMaxSize(), referenceSize) / 2f;
if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
|| !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
break;
if (indice.getXIndex() < minx || indice.getXIndex() >= maxx)
continue;
final int originalColor = dataSet.getColor(entry.getXIndex());
Color.RGBToHSV(Color.red(originalColor), Color.green(originalColor),
Color.blue(originalColor), _hsvBuffer);
_hsvBuffer[2] *= 0.5f;
final int color = Color.HSVToColor(Color.alpha(originalColor), _hsvBuffer);
mHighlightPaint.setColor(color);
mHighlightPaint.setStrokeWidth(dataSet.getHighlightCircleWidth());
c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mHighlightPaint);
}
}
示例12: drawHighlighted
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
BubbleData bubbleData = mChart.getBubbleData();
float phaseX = mAnimator.getPhaseX();
float phaseY = mAnimator.getPhaseY();
for (Highlight indice : indices) {
BubbleDataSet dataSet = bubbleData.getDataSetByIndex(indice.getDataSetIndex());
if (dataSet == null || !dataSet.isHighlightEnabled())
continue;
Entry entryFrom = dataSet.getEntryForXIndex(mMinX);
Entry entryTo = dataSet.getEntryForXIndex(mMaxX);
int minx = dataSet.getEntryPosition(entryFrom);
int maxx = Math.min(dataSet.getEntryPosition(entryTo) + 1, dataSet.getEntryCount());
final BubbleEntry entry = (BubbleEntry) bubbleData.getEntryForHighlight(indice);
if (entry == null || entry.getXIndex() != indice.getXIndex())
continue;
Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());
sizeBuffer[0] = 0f;
sizeBuffer[2] = 1f;
trans.pointValuesToPixel(sizeBuffer);
// calcualte the full width of 1 step on the x-axis
final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
final float maxBubbleHeight = Math.abs(mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);
pointBuffer[0] = (float) (entry.getXIndex() - minx) * phaseX + (float) minx;
pointBuffer[1] = (float) (entry.getVal()) * phaseY;
trans.pointValuesToPixel(pointBuffer);
float shapeHalf = getShapeSize(entry.getSize(), dataSet.getMaxSize(), referenceSize) / 2f;
if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
|| !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
break;
if (indice.getXIndex() < minx || indice.getXIndex() >= maxx)
continue;
final int originalColor = dataSet.getColor(entry.getXIndex());
Color.RGBToHSV(Color.red(originalColor), Color.green(originalColor),
Color.blue(originalColor), _hsvBuffer);
_hsvBuffer[2] *= 0.5f;
final int color = Color.HSVToColor(Color.alpha(originalColor), _hsvBuffer);
mHighlightPaint.setColor(color);
mHighlightPaint.setStrokeWidth(dataSet.getHighlightCircleWidth());
c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mHighlightPaint);
}
}
示例13: createData
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
ChartData createData(String[] xValues) {
return new BubbleData(xValues);
}
示例14: drawHighlighted
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
BubbleData bubbleData = mChart.getBubbleData();
float phaseY = mAnimator.getPhaseY();
for (Highlight high : indices) {
IBubbleDataSet set = bubbleData.getDataSetByIndex(high.getDataSetIndex());
if (set == null || !set.isHighlightEnabled())
continue;
final BubbleEntry entry = set.getEntryForXPos(high.getX());
if (!isInBoundsX(entry, set))
continue;
Transformer trans = mChart.getTransformer(set.getAxisDependency());
sizeBuffer[0] = 0f;
sizeBuffer[2] = 1f;
trans.pointValuesToPixel(sizeBuffer);
boolean normalizeSize = set.isNormalizeSizeEnabled();
// calcualte the full width of 1 step on the x-axis
final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
final float maxBubbleHeight = Math.abs(
mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);
pointBuffer[0] = entry.getX();
pointBuffer[1] = (entry.getY()) * phaseY;
trans.pointValuesToPixel(pointBuffer);
high.setDraw(pointBuffer[0], pointBuffer[1]);
float shapeHalf = getShapeSize(entry.getSize(),
set.getMaxSize(),
referenceSize,
normalizeSize) / 2f;
if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
|| !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
break;
final int originalColor = set.getColor((int) entry.getX());
Color.RGBToHSV(Color.red(originalColor), Color.green(originalColor),
Color.blue(originalColor), _hsvBuffer);
_hsvBuffer[2] *= 0.5f;
final int color = Color.HSVToColor(Color.alpha(originalColor), _hsvBuffer);
mHighlightPaint.setColor(color);
mHighlightPaint.setStrokeWidth(set.getHighlightCircleWidth());
c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mHighlightPaint);
}
}
示例15: drawHighlighted
import com.github.mikephil.charting.data.BubbleData; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
BubbleData bubbleData = mChart.getBubbleData();
float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));
float phaseY = mAnimator.getPhaseY();
for (Highlight indice : indices) {
IBubbleDataSet dataSet = bubbleData.getDataSetByIndex(indice.getDataSetIndex());
if (dataSet == null || !dataSet.isHighlightEnabled())
continue;
BubbleEntry entryFrom = dataSet.getEntryForXIndex(mMinX);
BubbleEntry entryTo = dataSet.getEntryForXIndex(mMaxX);
int minx = dataSet.getEntryIndex(entryFrom);
int maxx = Math.min(dataSet.getEntryIndex(entryTo) + 1, dataSet.getEntryCount());
final BubbleEntry entry = (BubbleEntry) bubbleData.getEntryForHighlight(indice);
if (entry == null || entry.getXIndex() != indice.getXIndex())
continue;
Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());
sizeBuffer[0] = 0f;
sizeBuffer[2] = 1f;
trans.pointValuesToPixel(sizeBuffer);
boolean normalizeSize = dataSet.isNormalizeSizeEnabled();
// calcualte the full width of 1 step on the x-axis
final float maxBubbleWidth = Math.abs(sizeBuffer[2] - sizeBuffer[0]);
final float maxBubbleHeight = Math.abs(mViewPortHandler.contentBottom() - mViewPortHandler.contentTop());
final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth);
pointBuffer[0] = (float) (entry.getXIndex() - minx) * phaseX + (float) minx;
pointBuffer[1] = entry.getVal() * phaseY;
trans.pointValuesToPixel(pointBuffer);
float shapeHalf = getShapeSize(entry.getSize(), dataSet.getMaxSize(), referenceSize, normalizeSize) / 2f;
if (!mViewPortHandler.isInBoundsTop(pointBuffer[1] + shapeHalf)
|| !mViewPortHandler.isInBoundsBottom(pointBuffer[1] - shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsLeft(pointBuffer[0] + shapeHalf))
continue;
if (!mViewPortHandler.isInBoundsRight(pointBuffer[0] - shapeHalf))
break;
if (indice.getXIndex() < minx || indice.getXIndex() >= maxx)
continue;
final int originalColor = dataSet.getColor(entry.getXIndex());
Color.RGBToHSV(Color.red(originalColor), Color.green(originalColor),
Color.blue(originalColor), _hsvBuffer);
_hsvBuffer[2] *= 0.5f;
final int color = Color.HSVToColor(Color.alpha(originalColor), _hsvBuffer);
mHighlightPaint.setColor(color);
mHighlightPaint.setStrokeWidth(dataSet.getHighlightCircleWidth());
c.drawCircle(pointBuffer[0], pointBuffer[1], shapeHalf, mHighlightPaint);
}
}