本文整理汇总了Java中com.github.mikephil.charting.data.CandleDataSet.setAxisDependency方法的典型用法代码示例。如果您正苦于以下问题:Java CandleDataSet.setAxisDependency方法的具体用法?Java CandleDataSet.setAxisDependency怎么用?Java CandleDataSet.setAxisDependency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.CandleDataSet
的用法示例。
在下文中一共展示了CandleDataSet.setAxisDependency方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateMarginCandleData
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
private CandleData generateMarginCandleData(List<MarketHistory> historyEntries) {
SimpleDateFormat format = new SimpleDateFormat("MMM dd", Locale.getDefault());
int size = historyEntries.size();
List<CandleEntry> entries = new ArrayList<>(size);
List<String> xAxis = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
MarketHistory history = historyEntries.get(i);
Date recordDate = new Date(history.getRecordDate());
xAxis.add(format.format(recordDate));
entries.add(new CandleEntry(i,
(float) history.getHighPrice(),
(float) history.getLowPrice(),
(float) history.getAveragePrice(),
(float) history.getAveragePrice()
));
}
CandleDataSet set = new CandleDataSet(entries, "Price Margins");
set.setShadowColor(Color.DKGRAY);
set.setShadowWidth(2.0f);
set.setShowCandleBar(true);
set.setBarSpace(0.35f);
set.setNeutralColor(Color.DKGRAY);
set.setDrawValues(false);
set.setDrawHighlightIndicators(false);
set.setDrawVerticalHighlightIndicator(false);
set.setAxisDependency(YAxis.AxisDependency.LEFT);
return new CandleData(xAxis, set);
}
示例2: onProgressChanged
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int prog = (mSeekBarX.getProgress() + 1);
tvX.setText("" + prog);
tvY.setText("" + (mSeekBarY.getProgress()));
mChart.resetTracking();
ArrayList<CandleEntry> yVals1 = new ArrayList<CandleEntry>();
for (int i = 0; i < prog; i++) {
float mult = (mSeekBarY.getProgress() + 1);
float val = (float) (Math.random() * 40) + mult;
float high = (float) (Math.random() * 9) + 8f;
float low = (float) (Math.random() * 9) + 8f;
float open = (float) (Math.random() * 6) + 1f;
float close = (float) (Math.random() * 6) + 1f;
boolean even = i % 2 == 0;
yVals1.add(new CandleEntry(
i, val + high,
val - low,
even ? val + open : val - open,
even ? val - close : val + close,
getResources().getDrawable(R.drawable.star)
));
}
CandleDataSet set1 = new CandleDataSet(yVals1, "Data Set");
set1.setDrawIcons(false);
set1.setAxisDependency(AxisDependency.LEFT);
// set1.setColor(Color.rgb(80, 80, 80));
set1.setShadowColor(Color.DKGRAY);
set1.setShadowWidth(0.7f);
set1.setDecreasingColor(Color.RED);
set1.setDecreasingPaintStyle(Paint.Style.FILL);
set1.setIncreasingColor(Color.rgb(122, 242, 84));
set1.setIncreasingPaintStyle(Paint.Style.STROKE);
set1.setNeutralColor(Color.BLUE);
//set1.setHighlightLineWidth(1f);
CandleData data = new CandleData(set1);
mChart.setData(data);
mChart.invalidate();
}
示例3: onProgressChanged
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int prog = (mSeekBarX.getProgress() + 1);
tvX.setText("" + prog);
tvY.setText("" + (mSeekBarY.getProgress()));
mChart.resetTracking();
ArrayList<CandleEntry> yVals1 = new ArrayList<CandleEntry>();
for (int i = 0; i < prog; i++) {
float mult = (mSeekBarY.getProgress() + 1);
float val = (float) (Math.random() * 40) + mult;
float high = (float) (Math.random() * 9) + 8f;
float low = (float) (Math.random() * 9) + 8f;
float open = (float) (Math.random() * 6) + 1f;
float close = (float) (Math.random() * 6) + 1f;
boolean even = i % 2 == 0;
yVals1.add(new CandleEntry(i, val + high, val - low, even ? val + open : val - open,
even ? val - close : val + close));
}
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < prog; i++) {
xVals.add("" + (1990 + i));
}
CandleDataSet set1 = new CandleDataSet(yVals1, "Data Set");
set1.setAxisDependency(AxisDependency.LEFT);
// set1.setColor(Color.rgb(80, 80, 80));
set1.setShadowColor(Color.DKGRAY);
set1.setShadowWidth(0.7f);
set1.setDecreasingColor(Color.RED);
set1.setDecreasingPaintStyle(Paint.Style.FILL);
set1.setIncreasingColor(Color.rgb(122, 242, 84));
set1.setIncreasingPaintStyle(Paint.Style.STROKE);
set1.setNeutralColor(Color.BLUE);
//set1.setHighlightLineWidth(1f);
CandleData data = new CandleData(xVals, set1);
mChart.setData(data);
mChart.invalidate();
}
示例4: onProgressChanged
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int prog = (mSeekBarX.getProgress() + 1);
tvX.setText("" + prog);
tvY.setText("" + (mSeekBarY.getProgress()));
mChart.resetTracking();
ArrayList<CandleEntry> yVals1 = new ArrayList<CandleEntry>();
for (int i = 0; i < prog; i++) {
float mult = (mSeekBarY.getProgress() + 1);
float val = (float) (Math.random() * 40) + mult;
float high = (float) (Math.random() * 9) + 8f;
float low = (float) (Math.random() * 9) + 8f;
float open = (float) (Math.random() * 6) + 1f;
float close = (float) (Math.random() * 6) + 1f;
boolean even = i % 2 == 0;
yVals1.add(new CandleEntry(i, val + high, val - low, even ? val + open : val - open,
even ? val - close : val + close));
}
CandleDataSet set1 = new CandleDataSet(yVals1, "Data Set");
set1.setAxisDependency(AxisDependency.LEFT);
// set1.setColor(Color.rgb(80, 80, 80));
set1.setShadowColor(Color.DKGRAY);
set1.setShadowWidth(0.7f);
set1.setDecreasingColor(Color.RED);
set1.setDecreasingPaintStyle(Paint.Style.FILL);
set1.setIncreasingColor(Color.rgb(122, 242, 84));
set1.setIncreasingPaintStyle(Paint.Style.STROKE);
set1.setNeutralColor(Color.BLUE);
//set1.setHighlightLineWidth(1f);
CandleData data = new CandleData(set1);
mChart.setData(data);
mChart.invalidate();
}