Java Code Examples for com.github.mikephil.charting.data.CandleDataSet#setDrawValues()

The following examples show how to use com.github.mikephil.charting.data.CandleDataSet#setDrawValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KlineFragment.java    From shinny-futures-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * date: 7/9/17
 * author: chenli
 * description: 生成蜡烛图数据
 */
private CandleData generateCandleData(List<CandleEntry> candleEntries) {
    CandleDataSet set = new CandleDataSet(candleEntries, "");
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    set.setShadowWidth(0.7f);
    set.setDecreasingColor(mDecreasingColor);
    set.setDecreasingPaintStyle(Paint.Style.FILL);
    set.setIncreasingColor(mIncreasingColor);
    set.setIncreasingPaintStyle(Paint.Style.STROKE);
    set.setNeutralColor(mHighlightColor);
    set.setShadowColorSameAsCandle(true);
    set.setHighlightLineWidth(0.7f);
    set.setHighLightColor(mHighlightColor);
    set.setDrawValues(true);
    set.setValueTextColor(Color.RED);
    set.setValueTextSize(9f);
    set.setDrawIcons(false);
    set.setValueFormatter(new TopChartLeftYAxisValueFormatter());
    CandleData candleData = new CandleData();
    candleData.addDataSet(set);
    return candleData;
}
 
Example 2
Source File: KLineDataManage.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
private CandleDataSet setACandle(ArrayList<CandleEntry> candleEntries) {
    CandleDataSet candleDataSet = new CandleDataSet(candleEntries, "蜡烛线");
    candleDataSet.setDrawHorizontalHighlightIndicator(true);
    candleDataSet.setHighlightEnabled(true);
    candleDataSet.setHighLightColor(ContextCompat.getColor(mContext, R.color.highLight_Color));
    candleDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    candleDataSet.setDecreasingColor(ContextCompat.getColor(mContext, R.color.down_color));
    candleDataSet.setDecreasingPaintStyle(Paint.Style.FILL);
    candleDataSet.setIncreasingColor(ContextCompat.getColor(mContext, R.color.up_color));
    candleDataSet.setIncreasingPaintStyle(Paint.Style.FILL);
    candleDataSet.setNeutralColor(ContextCompat.getColor(mContext, R.color.equal_color));
    candleDataSet.setShadowColorSameAsCandle(true);
    candleDataSet.setValueTextSize(10);
    candleDataSet.setDrawValues(true);

    return candleDataSet;
}
 
Example 3
Source File: KLineDataManage.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
private CandleDataSet setBOLLCandle(ArrayList<CandleEntry> candleEntries) {
    CandleDataSet candleDataSet = new CandleDataSet(candleEntries, "BOLL叠加蜡烛线");
    candleDataSet.setDrawHorizontalHighlightIndicator(false);
    candleDataSet.setHighlightEnabled(true);
    candleDataSet.setHighLightColor(ContextCompat.getColor(mContext, R.color.highLight_Color));
    candleDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    candleDataSet.setDecreasingColor(ContextCompat.getColor(mContext, R.color.down_color));
    candleDataSet.setDecreasingPaintStyle(Paint.Style.FILL);
    candleDataSet.setIncreasingColor(ContextCompat.getColor(mContext, R.color.up_color));
    candleDataSet.setIncreasingPaintStyle(Paint.Style.FILL);
    candleDataSet.setNeutralColor(ContextCompat.getColor(mContext, R.color.equal_color));
    candleDataSet.setDrawValues(false);
    candleDataSet.setDrawIcons(false);
    candleDataSet.setShowCandleBar(false);
    return candleDataSet;
}
 
Example 4
Source File: CombinedChartActivity.java    From StockChart-MPAndroidChart with MIT License 6 votes vote down vote up
private CandleData generateCandleData() {

        CandleData d = new CandleData();

        ArrayList<CandleEntry> entries = new ArrayList<>();

        for (int index = 0; index < count; 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;
    }
 
Example 5
Source File: KLineView.java    From android-kline with Apache License 2.0 6 votes vote down vote up
@android.support.annotation.NonNull
public CandleDataSet setKLine(int type, ArrayList<CandleEntry> lineEntries) {
    CandleDataSet set = new CandleDataSet(lineEntries, "KLine" + type);
    set.setDrawIcons(false);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    set.setShadowColor(Color.DKGRAY);
    set.setShadowWidth(0.75f);
    set.setDecreasingColor(mDecreasingColor);
    set.setDecreasingPaintStyle(Paint.Style.FILL);
    set.setShadowColorSameAsCandle(true);
    set.setIncreasingColor(mIncreasingColor);
    set.setIncreasingPaintStyle(Paint.Style.FILL);
    set.setNeutralColor(ContextCompat.getColor(getContext(), R.color.increasing_color));
    set.setDrawValues(true);
    set.setValueTextSize(10);
    set.setHighlightEnabled(true);
    if (type != NORMAL_LINE) {
        set.setVisible(false);
    }
    return set;
}
 
Example 6
Source File: CombinedChartActivity.java    From Stayfit with Apache License 2.0 6 votes vote down vote up
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;
    }