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 @@ -319,15 +319,15 @@ abstract class BaseDataSet<T : Entry>() : IDataSet<T> {
this.mDrawValues = enabled
}

override fun isDrawValuesEnabled(): Boolean {
override fun isDrawValues(): Boolean {
return mDrawValues
}

override fun setDrawIcons(enabled: Boolean) {
mDrawIcons = enabled
}

override fun isDrawIconsEnabled(): Boolean {
override fun isDrawIcons(): Boolean {
return mDrawIcons
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public interface IDataSet<T extends Entry> {
/**
* Returns true if y-value drawing is enabled, false if not
*/
boolean isDrawValuesEnabled();
boolean isDrawValues();

/**
* Set this to true to draw y-icons on the chart.
Expand All @@ -342,7 +342,7 @@ public interface IDataSet<T extends Entry> {
/**
* Returns true if y-icon drawing is enabled, false if not
*/
boolean isDrawIconsEnabled();
boolean isDrawIcons();

/**
* Offset of icons drawn on the chart.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,15 @@ open class BarChartRenderer(
val entry = dataSet.getEntryForIndex(j / 4)
val `val` = entry.y

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas, dataSet.valueFormatter, `val`, entry, i, x,
if (`val` >= 0) (buffer.buffer[j + 1] + posOffset) else (buffer.buffer[j + 3] + negOffset),
dataSet.getValueTextColor(j / 4)
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

var px = x
Expand Down Expand Up @@ -372,7 +372,7 @@ open class BarChartRenderer(
continue
}

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas, dataSet.valueFormatter, entry.y, entry, i, x,
buffer.buffer[bufferIndex + 1] +
Expand All @@ -381,7 +381,7 @@ open class BarChartRenderer(
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

var px = x
Expand Down Expand Up @@ -454,7 +454,7 @@ open class BarChartRenderer(
continue
}

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas,
dataSet.valueFormatter,
Expand All @@ -467,7 +467,7 @@ open class BarChartRenderer(
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

icon?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class BarLineScatterCandleBubbleRenderer(animator: ChartAnimator, viewP
* Returns true if the DataSet values should be drawn, false if not.
*/
protected fun shouldDrawValues(set: IDataSet<*>): Boolean {
return set.isVisible() && (set.isDrawValuesEnabled() || set.isDrawIconsEnabled())
return set.isVisible() && (set.isDrawValues() || set.isDrawIcons())
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ open class BubbleChartRenderer(

val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas, dataSet.valueFormatter, entry.size, entry, i, x,
y + (0.5f * lineHeight), valueTextColor
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

icon?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ open class CandleStickChartRenderer(

val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas,
dataSet.valueFormatter,
Expand All @@ -264,7 +264,7 @@ open class CandleStickChartRenderer(
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

icon?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ open class HorizontalBarChartRenderer(
negOffset = -negOffset - valueTextWidth
}

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas,
formattedValue!!,
Expand All @@ -244,7 +244,7 @@ open class HorizontalBarChartRenderer(
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

var px = buffer.buffer[j + 2] + (if (`val` >= 0) posOffset else negOffset)
Expand Down Expand Up @@ -310,7 +310,7 @@ open class HorizontalBarChartRenderer(
negOffset = -negOffset - valueTextWidth
}

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas, formattedValue!!,
buffer.buffer[bufferIndex + 2]
Expand All @@ -319,7 +319,7 @@ open class HorizontalBarChartRenderer(
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

var px = (buffer.buffer[bufferIndex + 2]
Expand Down Expand Up @@ -410,11 +410,11 @@ open class HorizontalBarChartRenderer(
continue
}

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(canvas, formattedValue!!, x, y + halfTextHeight, color)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

icon?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ open class LineChartRenderer(
return

paintRender.strokeWidth = dataSet.lineWidth
paintRender.setPathEffect(dataSet.dashPathEffect)
paintRender.pathEffect = dataSet.dashPathEffect

when (dataSet.lineMode) {
LineDataSet.Mode.LINEAR, LineDataSet.Mode.STEPPED -> drawLinear(canvas, dataSet)
Expand All @@ -97,7 +97,7 @@ open class LineChartRenderer(
else -> drawLinear(canvas, dataSet)
}

paintRender.setPathEffect(null)
paintRender.pathEffect = null
}

protected fun drawHorizontalBezier(dataSet: ILineDataSet) {
Expand Down Expand Up @@ -147,7 +147,7 @@ open class LineChartRenderer(

bitmapCanvas!!.drawPath(cubicPath, paintRender)

paintRender.setPathEffect(null)
paintRender.pathEffect = null
}

protected fun drawCubicBezier(dataSet: ILineDataSet) {
Expand Down Expand Up @@ -221,7 +221,7 @@ open class LineChartRenderer(

bitmapCanvas!!.drawPath(cubicPath, paintRender)

paintRender.setPathEffect(null)
paintRender.pathEffect = null
}

protected fun drawCubicFill(canvas: Canvas, dataSet: ILineDataSet, spline: Path, trans: Transformer, bounds: XBounds) {
Expand Down Expand Up @@ -379,7 +379,7 @@ open class LineChartRenderer(
}
}

paintRender.setPathEffect(null)
paintRender.pathEffect = null
}

protected var mGenerateFilledPathBuffer: Path = Path()
Expand Down Expand Up @@ -532,14 +532,14 @@ open class LineChartRenderer(
val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)

if (entry != null) {
if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas, dataSet.valueFormatter, entry.y, entry, i, x,
y - valOffset, dataSet.getValueTextColor(j / 2)
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

icon?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ open class PieChartRenderer(
if (dataSet.entryCount == 0) {
continue
}
val drawValues = dataSet.isDrawValuesEnabled
val drawValues = dataSet.isDrawValues
if (!drawValues && !drawEntryLabels) {
continue
}
Expand Down Expand Up @@ -586,7 +586,7 @@ open class PieChartRenderer(
}
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

val x = (labelRadius + iconsOffset.y) * sliceXBase + center.x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ open class RadarChartRenderer(
pOut
)

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas,
dataSet.valueFormatter,
Expand All @@ -169,7 +169,7 @@ open class RadarChartRenderer(
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

Utils.getPosition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ open class ScatterChartRenderer(@JvmField var dataProvider: ScatterDataProvider,

val entry = dataSet.getEntryForIndex(j / 2 + xBounds.min)

if (dataSet.isDrawValuesEnabled) {
if (dataSet.isDrawValues) {
drawValue(
canvas,
dataSet.valueFormatter,
Expand All @@ -129,7 +129,7 @@ open class ScatterChartRenderer(@JvmField var dataProvider: ScatterDataProvider,
)
}

if (entry.icon != null && dataSet.isDrawIconsEnabled) {
if (entry.icon != null && dataSet.isDrawIcons) {
val icon = entry.icon

icon?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ class AnotherBarActivity : DemoBase(), OnSeekBarChangeListener {
}

R.id.actionToggleValues -> {
for (set in chart!!.data!!.dataSets) set.setDrawValues(!set.isDrawValuesEnabled())

chart!!.data!!.dataSets.forEach { set ->
set.setDrawValues(!set.isDrawValues())
}
chart!!.invalidate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
}

R.id.actionToggleValues -> {
for (set in chart!!.data!!.dataSets)
set.setDrawValues(!set.isDrawValuesEnabled())

chart!!.data!!.dataSets.forEach { set ->
set.setDrawValues(!set.isDrawValues())
}
chart!!.invalidate()
}

R.id.actionToggleIcons -> {
for (set in chart!!.data!!.dataSets)
set.setDrawIcons(!set.isDrawIconsEnabled())
set.setDrawIcons(!set.isDrawIcons())

chart!!.invalidate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChar
}

R.id.actionToggleValues -> {
for (set in chart!!.data!!.dataSets) set.setDrawValues(!set.isDrawValuesEnabled())

chart!!.data!!.dataSets.forEach { set ->
set.setDrawValues(!set.isDrawValues())
}
chart!!.invalidate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ class BarChartActivitySinus : DemoBase(), OnSeekBarChangeListener {
}

R.id.actionToggleValues -> {
for (set in binding.chart1.data!!.dataSets) set.setDrawValues(!set.isDrawValuesEnabled())

binding.chart1.data!!.dataSets.forEach { set ->
set.setDrawValues(!set.isDrawValues())
}
binding.chart1.invalidate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@ class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSel
}

R.id.actionToggleValues -> {
for (set in chart!!.data!!.dataSets) set.setDrawValues(!set.isDrawValuesEnabled())

chart!!.data!!.dataSets.forEach { set ->
set.setDrawValues(!set.isDrawValues())
}
chart!!.invalidate()
}

R.id.actionToggleIcons -> {
for (set in chart!!.data!!.dataSets) set.setDrawIcons(!set.isDrawIconsEnabled())
for (set in chart!!.data!!.dataSets) set.setDrawIcons(!set.isDrawIcons())

chart!!.invalidate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,14 @@ class CandleStickChartActivity : DemoBase(), OnSeekBarChangeListener {
}

R.id.actionToggleValues -> {
for (set in chart!!.data!!.dataSets) set.setDrawValues(!set.isDrawValuesEnabled())

chart!!.data!!.dataSets.forEach { set ->
set.setDrawValues(!set.isDrawValues())
}
chart!!.invalidate()
}

R.id.actionToggleIcons -> {
for (set in chart!!.data!!.dataSets) set.setDrawIcons(!set.isDrawIconsEnabled())
for (set in chart!!.data!!.dataSets) set.setDrawIcons(!set.isDrawIcons())

chart!!.invalidate()
}
Expand Down
Loading
Loading