本文整理汇总了Java中com.github.mikephil.charting.data.CandleDataSet.setBarSpace方法的典型用法代码示例。如果您正苦于以下问题:Java CandleDataSet.setBarSpace方法的具体用法?Java CandleDataSet.setBarSpace怎么用?Java CandleDataSet.setBarSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.CandleDataSet
的用法示例。
在下文中一共展示了CandleDataSet.setBarSpace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateCandleData
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
protected CandleData generateCandleData() {
CandleData d = new CandleData();
ArrayList<CandleEntry> entries = new ArrayList<CandleEntry>();
for (int index = 0; index < itemcount; index += 2)
entries.add(new CandleEntry(index + 1f, 90, 70, 85, 75f));
CandleDataSet set = new CandleDataSet(entries, "Candle DataSet");
set.setDecreasingColor(Color.rgb(142, 150, 175));
set.setShadowColor(Color.DKGRAY);
set.setBarSpace(0.3f);
set.setValueTextSize(10f);
set.setDrawValues(false);
d.addDataSet(set);
return d;
}
示例2: generateCandleData
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
protected CandleData generateCandleData() {
CandleData d = new CandleData();
ArrayList<CandleEntry> entries = new ArrayList<CandleEntry>();
for (int index = 0; index < itemcount; index++)
entries.add(new CandleEntry(index, 20f, 10f, 13f, 17f));
CandleDataSet set = new CandleDataSet(entries, "Candle DataSet");
set.setColor(Color.rgb(80, 80, 80));
set.setBarSpace(0.3f);
set.setValueTextSize(10f);
set.setDrawValues(false);
d.addDataSet(set);
return d;
}
示例3: generateCandleData
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
/**
* Prepare CandleData for candlestick chart
* @param xIndex - float
* @param shadowH - float
* @param shadowL - float
* @param open - float
* @param close - float
* @param seriesName - String
* @return CandleData
*/
private CandleData generateCandleData(float xIndex, float shadowH, float shadowL, float open, float close, String seriesName){
CandleData d = new CandleData();
ArrayList<CandleEntry> entries = new ArrayList<>();
entries.add(new CandleEntry(xIndex, shadowH, shadowL, open, close));
CandleDataSet set = new CandleDataSet(entries, seriesName);
set.setDecreasingColor(Color.rgb(142, 150, 175));
set.setShadowColor(Color.DKGRAY);
set.setDecreasingColor(Color.parseColor("#2196F3"));
set.setBarSpace(0.3f);
set.setValueTextSize(10f);
set.setShadowWidth(2f);
set.setDrawValues(false);
d.addDataSet(set);
return d;
}
示例4: 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);
}
示例5: dataSetConfig
import com.github.mikephil.charting.data.CandleDataSet; //导入方法依赖的package包/类
@Override
void dataSetConfig(IDataSet<CandleEntry> dataSet, ReadableMap config) {
CandleDataSet candleDataSet = (CandleDataSet) dataSet;
ChartDataSetConfigUtils.commonConfig(candleDataSet, config);
ChartDataSetConfigUtils.commonBarLineScatterCandleBubbleConfig(candleDataSet, config);
ChartDataSetConfigUtils.commonLineScatterCandleRadarConfig(candleDataSet, config);
// CandleDataSet only config
if (BridgeUtils.validate(config, ReadableType.Number, "barSpace")) {
candleDataSet.setBarSpace((float) config.getDouble("barSpace"));
}
if (BridgeUtils.validate(config, ReadableType.Number, "shadowWidth")) {
candleDataSet.setShadowWidth((float) config.getDouble("shadowWidth"));
}
if (BridgeUtils.validate(config, ReadableType.String, "shadowColor")) {
candleDataSet.setShadowColor(Color.parseColor(config.getString("shadowColor")));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "shadowColorSameAsCandle")) {
candleDataSet.setShadowColorSameAsCandle(config.getBoolean("shadowColorSameAsCandle"));
}
if (BridgeUtils.validate(config, ReadableType.String, "neutralColor")) {
candleDataSet.setNeutralColor(Color.parseColor(config.getString("neutralColor")));
}
if (BridgeUtils.validate(config, ReadableType.String, "decreasingColor")) {
candleDataSet.setDecreasingColor(Color.parseColor(config.getString("decreasingColor")));
}
if (BridgeUtils.validate(config, ReadableType.String, "decreasingPaintStyle")) {
candleDataSet.setDecreasingPaintStyle(Paint.Style.valueOf(config.getString("decreasingPaintStyle").toUpperCase()));
}
if (BridgeUtils.validate(config, ReadableType.String, "increasingColor")) {
candleDataSet.setIncreasingColor(Color.parseColor(config.getString("increasingColor")));
}
if (BridgeUtils.validate(config, ReadableType.String, "increasingPaintStyle")) {
candleDataSet.setIncreasingPaintStyle(Paint.Style.valueOf(config.getString("increasingPaintStyle").toUpperCase()));
}
}