本文整理汇总了Java中com.github.mikephil.charting.data.ScatterData类的典型用法代码示例。如果您正苦于以下问题:Java ScatterData类的具体用法?Java ScatterData怎么用?Java ScatterData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScatterData类属于com.github.mikephil.charting.data包,在下文中一共展示了ScatterData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateScatterData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
protected ScatterData generateScatterData(int dataSets, float range, int count) {
ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>();
ScatterChart.ScatterShape[] shapes = ScatterChart.ScatterShape.getAllDefaultShapes();
for(int i = 0; i < dataSets; i++) {
ArrayList<Entry> entries = new ArrayList<Entry>();
for(int j = 0; j < count; j++) {
entries.add(new Entry(j, (float) (Math.random() * range) + range / 4));
}
ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
ds.setScatterShapeSize(12f);
ds.setScatterShape(shapes[i % shapes.length]);
ds.setColors(ColorTemplate.COLORFUL_COLORS);
ds.setScatterShapeSize(9f);
sets.add(ds);
}
ScatterData d = new ScatterData(sets);
d.setValueTypeface(tf);
return d;
}
示例2: generateScatterData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
protected ScatterData generateScatterData() {
ScatterData d = new ScatterData();
ArrayList<Entry> entries = new ArrayList<Entry>();
for (float index = 0; index < itemcount; index += 0.5f)
entries.add(new Entry(index + 0.25f, getRandom(10, 55)));
ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet");
set.setColors(ColorTemplate.MATERIAL_COLORS);
set.setScatterShapeSize(7.5f);
set.setDrawValues(false);
set.setValueTextSize(10f);
d.addDataSet(set);
return d;
}
示例3: setData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
private void setData() {
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
RealmScatterDataSet<RealmDemoData> set = new RealmScatterDataSet<RealmDemoData>(result, "xValue", "yValue");
set.setLabel("Realm ScatterDataSet");
set.setScatterShapeSize(9f);
set.setColor(ColorTemplate.rgb("#CDDC39"));
set.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
ArrayList<IScatterDataSet> dataSets = new ArrayList<IScatterDataSet>();
dataSets.add(set); // add the dataset
// create a data object with the dataset list
ScatterData data = new ScatterData(dataSets);
styleData(data);
// set data
mChart.setData(data);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
示例4: generateScatterData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
protected ScatterData generateScatterData(int dataSets, float range, int count) {
ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>();
ScatterShape[] shapes = ScatterChart.getAllPossibleShapes();
for(int i = 0; i < dataSets; i++) {
ArrayList<Entry> entries = new ArrayList<Entry>();
for(int j = 0; j < count; j++) {
entries.add(new Entry((float) (Math.random() * range) + range / 4, j));
}
ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
ds.setScatterShapeSize(12f);
ds.setScatterShape(shapes[i % shapes.length]);
ds.setColors(ColorTemplate.COLORFUL_COLORS);
ds.setScatterShapeSize(9f);
sets.add(ds);
}
ScatterData d = new ScatterData(ChartData.generateXVals(0, count), sets);
d.setValueTypeface(tf);
return d;
}
示例5: generateScatterData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
protected ScatterData generateScatterData() {
ScatterData d = new ScatterData();
ArrayList<Entry> entries = new ArrayList<Entry>();
for (int index = 0; index < itemcount; index++)
entries.add(new Entry(getRandom(20, 15), index));
ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet");
set.setColor(Color.GREEN);
set.setScatterShapeSize(7.5f);
set.setDrawValues(false);
set.setValueTextSize(10f);
d.addDataSet(set);
return d;
}
示例6: buildDummyDataForLegend
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
/**
* Create dataset to be displayed in chart legend
* @return CombinedData representing dummy data for a legend
*/
private CombinedData buildDummyDataForLegend(){
CombinedData combinedData = new CombinedData();
float xIndex = 1.5f;
float close = 13;
float open = 26f;
float shadowH = 30.33f;
float shadowL = -2.05f;
float average = 20f;
CandleData candleData = generateCandleData(xIndex, shadowH, shadowL, open, close, "EMU HI/LO" );
ScatterData scatterData = generateScatterData(average, "EMU Mean");
LineData s1 = generateOceanHiLo(close, open, "Ocean HI/LO");
combinedData.setData(s1);
combinedData.setData(candleData);
combinedData.setData(scatterData);
return combinedData;
}
示例7: buildTempData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
/**
* Build a CombinedData object containing temperature data
* @param observation - EMUObservation
* @param stat - EMUStat
* @return - CombinedData
*/
private CombinedData buildTempData(EMUObservation observation, EMUStat stat){
CombinedData combinedData = new CombinedData();
if (stat.getTemp_max() == null || stat.getTemp_min() == null || stat.getTemp_mean() == null || observation.getTemperature() == null){
return combinedData;
}
float xIndex = 1.5f;
float close = (float) stat.getTemp_min().doubleValue();
float open = (float) stat.getTemp_max().doubleValue();
float shadowH = (float)mDataManager.getMaxTemperatureFromSummary().doubleValue(); // 30.33f; // Greatest max temp from summary table
float shadowL = (float) mDataManager.getMinTemperatureFromSummary().doubleValue(); // -2.05f; // Lowest min temp from summary table
float averageTemp = (float)observation.getTemperature().doubleValue();
Log.i("SummaryChartPresenter", "Temperature: Ocean high = " + shadowH + " ocean low = "+ shadowL + " emu min = " + close + " emu max = "+ open + " emu mean for location = "+ averageTemp);
combinedData.setData(generateCandleData(xIndex, shadowH, shadowL, open, close, TEMPERATURE ));
ScatterData sdata = generateScatterData(averageTemp, TEMPERATURE);
combinedData.setData(sdata);
return combinedData;
}
示例8: drawLatencyChart
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
private void drawLatencyChart(List<Entry> phoneEntriesShifted, List<Entry> waltEntries) {
final ScatterDataSet dataSetWalt =
new ScatterDataSet(waltEntries, "WALT Events");
dataSetWalt.setColor(Color.BLUE);
dataSetWalt.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
dataSetWalt.setScatterShapeSize(8f);
final ScatterDataSet dataSetPhoneShifted =
new ScatterDataSet(phoneEntriesShifted, "Phone Events Shifted");
dataSetPhoneShifted.setColor(Color.RED);
dataSetPhoneShifted.setScatterShapeSize(10f);
dataSetPhoneShifted.setScatterShape(ScatterChart.ScatterShape.X);
final ScatterData scatterData = new ScatterData(dataSetWalt, dataSetPhoneShifted);
final Description desc = new Description();
desc.setText("");
desc.setTextSize(12f);
latencyChart.setDescription(desc);
latencyChart.setData(scatterData);
latencyChart.invalidate();
latencyChartLayout.setVisibility(View.VISIBLE);
}
示例9: drawData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
ScatterData scatterData = mChart.getScatterData();
for (IScatterDataSet set : scatterData.getDataSets()) {
if (set.isVisible())
drawDataSet(c, set);
}
}
示例10: initBuffers
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
@Override
public void initBuffers() {
ScatterData scatterData = mChart.getScatterData();
mScatterBuffers = new ScatterBuffer[scatterData.getDataSetCount()];
for (int i = 0; i < mScatterBuffers.length; i++) {
IScatterDataSet set = scatterData.getDataSetByIndex(i);
mScatterBuffers[i] = new ScatterBuffer(set.getEntryCount() * 2);
}
}
示例11: generateScatterData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
/**
* Prepare ScatterData object
* @param averageValue
* @param seriesName
* @return ScatterData
*/
private ScatterData generateScatterData(float averageValue, String seriesName){
ScatterData d = new ScatterData();
ArrayList<Entry> entries = new ArrayList<>();
entries.add(new Entry(1.5f, averageValue));
ScatterDataSet set = new ScatterDataSet(entries, seriesName);
set.setColor(Color.parseColor("#FF4081"));
set.setScatterShape(ScatterChart.ScatterShape.SQUARE);
set.setScatterShapeSize(15f);
set.setDrawValues(false);
set.setValueTextSize(10f);
d.addDataSet(set);
return d;
}
示例12: initBuffers
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
@Override
public void initBuffers() {
ScatterData scatterData = mChart.getScatterData();
mScatterBuffers = new ScatterBuffer[scatterData.getDataSetCount()];
for (int i = 0; i < mScatterBuffers.length; i++) {
ScatterDataSet set = scatterData.getDataSetByIndex(i);
mScatterBuffers[i] = new ScatterBuffer(set.getEntryCount() * 2);
}
}
示例13: drawData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
ScatterData scatterData = mChart.getScatterData();
for (ScatterDataSet set : scatterData.getDataSets()) {
if (set.isVisible())
drawDataSet(c, set);
}
}
示例14: drawLatencyGraph
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
private void drawLatencyGraph(double[] ft, double[] fy, double[] lt, double averageBestShift) {
final ArrayList<Entry> touchEntries = new ArrayList<>();
final ArrayList<Entry> laserEntries = new ArrayList<>();
final double[] laserT = new double[lt.length];
for (int i = 0; i < ft.length; i++) {
touchEntries.add(new Entry((float) ft[i], (float) fy[i]));
}
for (int i = 0; i < lt.length; i++) {
laserT[i] = lt[i] + averageBestShift;
}
final double[] laserY = Utils.interp(laserT, ft, fy);
for (int i = 0; i < laserY.length; i++) {
laserEntries.add(new Entry((float) laserT[i], (float) laserY[i]));
}
final ScatterDataSet dataSetTouch = new ScatterDataSet(touchEntries, "Touch Events");
dataSetTouch.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
dataSetTouch.setScatterShapeSize(8f);
final ScatterDataSet dataSetLaser = new ScatterDataSet(laserEntries,
String.format(Locale.US, "Laser Events Latency=%.1f ms", averageBestShift));
dataSetLaser.setColor(Color.RED);
dataSetLaser.setScatterShapeSize(10f);
dataSetLaser.setScatterShape(ScatterChart.ScatterShape.X);
final ScatterData scatterData = new ScatterData(dataSetTouch, dataSetLaser);
final Description desc = new Description();
desc.setText("Y-Position [pixels] vs. Time [ms]");
desc.setTextSize(12f);
latencyChart.setDescription(desc);
latencyChart.setData(scatterData);
latencyChartLayout.setVisibility(View.VISIBLE);
}
示例15: drawData
import com.github.mikephil.charting.data.ScatterData; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {
ScatterData scatterData = mChart.getScatterData();
IScatterDataSet set;
int setCount = scatterData.getDataSets().size();
for(int i = 0 ; i < setCount ; i++){
set = scatterData.getDataSets().get(i);
if (set.isVisible())
drawDataSet(c, set);
}
}