Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet;

import java.util.ArrayList;
import java.util.List;

public class CandleData extends BarLineScatterCandleBubbleData<ICandleDataSet> {

public CandleData() {
super();
}
public CandleData() {
super();
}

public CandleData(List<ICandleDataSet> dataSets) {
super(dataSets);
}
public CandleData(List<ICandleDataSet> dataSets) {
super(dataSets);
}

public CandleData(ICandleDataSet... dataSets) {
super(dataSets);
}
public CandleData(ICandleDataSet... dataSets) {
super(dataSets);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,121 +114,84 @@ open class CandleDataSet(yVals: MutableList<CandleEntry>?, label: String = "") :
}
}

/**
* Sets the space that is left out on the left and right side of each
* candle, default 0.1f (10%), max 0.45f, min 0f
*/
fun setBarSpace(space: Float) {
var space = space
if (space < 0f) space = 0f
if (space > 0.45f) space = 0.45f

mBarSpace = space
}

override fun getBarSpace(): Float {
return mBarSpace
}

/**
* Sets the width of the candle-shadow-line in pixels. Default 3f.
*/
fun setShadowWidth(width: Float) {
mShadowWidth = width.convertDpToPixel()
}

override fun getShadowWidth(): Float {
return mShadowWidth
}

/**
* Sets whether the candle bars should show?
*/
fun setShowCandleBar(showCandleBar: Boolean) {
mShowCandleBar = showCandleBar
}

override fun getShowCandleBar(): Boolean {
return mShowCandleBar
}

/**
* Sets the one and ONLY color that should be used for this DataSet when
* open == close.
*/
fun setNeutralColor(color: Int) {
mNeutralColor = color
}

override fun getNeutralColor(): Int {
return mNeutralColor
}

/**
* Sets the one and ONLY color that should be used for this DataSet when
* open <= close.
*/
fun setIncreasingColor(color: Int) {
mIncreasingColor = color
}

override fun getIncreasingColor(): Int {
return mIncreasingColor
}

/**
* Sets the one and ONLY color that should be used for this DataSet when
* open > close.
*/
fun setDecreasingColor(color: Int) {
mDecreasingColor = color
}

override fun getDecreasingColor(): Int {
return mDecreasingColor
}

override fun getIncreasingPaintStyle(): Paint.Style? {
return mIncreasingPaintStyle
}

/**
* Sets paint style when open < close
*/
fun setIncreasingPaintStyle(paintStyle: Paint.Style?) {
this.mIncreasingPaintStyle = paintStyle
}

override fun getDecreasingPaintStyle(): Paint.Style? {
return mDecreasingPaintStyle
}

/**
* Sets paint style when open > close
*/
fun setDecreasingPaintStyle(decreasingPaintStyle: Paint.Style?) {
this.mDecreasingPaintStyle = decreasingPaintStyle
}

override fun getShadowColor(): Int {
return mShadowColor
}

/**
* Sets shadow color for all entries
*/
fun setShadowColor(shadowColor: Int) {
this.mShadowColor = shadowColor
}

override fun getShadowColorSameAsCandle(): Boolean {
return mShadowColorSameAsCandle
}
override var barSpace: Float
get() = mBarSpace
set(value) {
/**
* Sets the space that is left out on the left and right side of each
* candle, default 0.1f (10%), max 0.45f, min 0f
*/
var space = value
if (space < 0f) space = 0f
if (space > 0.45f) space = 0.45f

mBarSpace = space
}

/**
* Sets shadow color to be the same color as the candle color
*/
fun setShadowColorSameAsCandle(shadowColorSameAsCandle: Boolean) {
this.mShadowColorSameAsCandle = shadowColorSameAsCandle
}
override var showCandleBar: Boolean
get() = mShowCandleBar
set(value) {
mShowCandleBar = value
}
override var shadowWidth: Float
get() = mShadowWidth
set(value) {
mShadowWidth = value.convertDpToPixel()
}
override var shadowColor: Int
get() = mShadowColor
set(value) {
mShadowColor = value
}
override var neutralColor: Int
get() = mNeutralColor
set(value) {
/**
* Sets the one and ONLY color that should be used for this DataSet when
* open == close.
*/
mNeutralColor = value
}
override var increasingColor: Int
get() = mIncreasingColor
set(value) {
/**
* Sets the one and ONLY color that should be used for this DataSet when
* open <= close.
*/
mIncreasingColor = value
}
override var decreasingColor: Int
get() = mDecreasingColor
set(value) {
/**
* Sets the one and ONLY color that should be used for this DataSet when
* open > close.
*/
mDecreasingColor = value
}
override var increasingPaintStyle: Paint.Style?
get() = mIncreasingPaintStyle
set(value) {
/**
* Sets paint style when open < close
*/
mIncreasingPaintStyle = value
}
override var decreasingPaintStyle: Paint.Style?
get() = mDecreasingPaintStyle
set(value) {
/**
* Sets paint style when open > close
*/
mDecreasingPaintStyle = value
}
override var shadowColorSameAsCandle: Boolean
get() = mShadowColorSameAsCandle
set(value) {
/**
* Sets shadow color to be the same color as the candle color
*/
mShadowColorSameAsCandle = value
}
}
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
package com.github.mikephil.charting.interfaces.datasets;
package com.github.mikephil.charting.interfaces.datasets

import android.graphics.Paint;

import com.github.mikephil.charting.data.CandleEntry;

/**
* Created by philipp on 21/10/15.
*/
public interface ICandleDataSet extends ILineScatterCandleRadarDataSet<CandleEntry> {
import android.graphics.Paint
import com.github.mikephil.charting.data.CandleEntry

interface ICandleDataSet : ILineScatterCandleRadarDataSet<CandleEntry> {
/**
* Returns the space that is left out on the left and right side of each
* candle.
* Returns the space that is left out on the left and right side of each candle.
*/
float getBarSpace();
val barSpace: Float

/**
* Returns whether the candle bars should show?
* When false, only "ticks" will show
* - default: true
*/
boolean getShowCandleBar();
val showCandleBar: Boolean

/**
* Returns the width of the candle-shadow-line in pixels.
*/
float getShadowWidth();
val shadowWidth: Float

/**
* Returns shadow color for all entries
*/
int getShadowColor();
val shadowColor: Int

/**
* Returns the neutral color (for open == close)
*/
int getNeutralColor();
val neutralColor: Int

/**
* Returns the increasing color (for open < close).
*/
int getIncreasingColor();
val increasingColor: Int

/**
* Returns the decreasing color (for open > close).
*/
int getDecreasingColor();
val decreasingColor: Int

/**
* Returns paint style when open < close
*/
Paint.Style getIncreasingPaintStyle();
val increasingPaintStyle: Paint.Style?

/**
* Returns paint style when open > close
*/
Paint.Style getDecreasingPaintStyle();
val decreasingPaintStyle: Paint.Style?

/**
* Is the shadow color same as the candle color?
*/
boolean getShadowColorSameAsCandle();
val shadowColorSameAsCandle: Boolean
}
Loading
Loading