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 @@ -55,7 +55,7 @@ class HalfPieChartActivity : DemoBase() {
binding.chart1.isDrawCenterText = true

binding.chart1.isRotationEnabled = false
binding.chart1.isHighlightPerTapEnabled = true
binding.chart1.isHighlightPerTap = true

binding.chart1.maxAngle = 180f // HALF CHART
binding.chart1.rotationAngle = 180f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV
binding.seekBarX.setOnSeekBarChangeListener(this)

binding.chart1.setOnChartValueSelectedListener(this)
binding.chart1.isLogEnabled = true
binding.chart1.isLogging = true

// chart.setHighlightEnabled(false);
binding.chart1.isDrawBarShadow = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
binding.chart1.rotationAngle = 0f
// enable rotation of the chart by touch
binding.chart1.isRotationEnabled = true
binding.chart1.isHighlightPerTapEnabled = true
binding.chart1.isHighlightPerTap = true

// chart.setUnit(" €");
// chart.setDrawUnitsInChart(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu
binding.chart1.rotationAngle = 0f
// enable rotation of the chart by touch
binding.chart1.isRotationEnabled = true
binding.chart1.isHighlightPerTapEnabled = true
binding.chart1.isHighlightPerTap = true

// chart.setUnit(" €");
// chart.setDrawUnitsInChart(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PiePolylineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVal
binding.chart1.rotationAngle = 0f
// enable rotation of the chart by touch
binding.chart1.isRotationEnabled = true
binding.chart1.isHighlightPerTapEnabled = true
binding.chart1.isHighlightPerTap = true

// chart.setUnit(" €");
// chart.setDrawUnitsInChart(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt

drawMarkers(canvas)

if (isLogEnabled) {
if (isLogging) {
val drawtime = (System.currentTimeMillis() - startTime)
totalTime += drawtime
drawCycles += 1
Expand All @@ -353,7 +353,7 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
}

protected open fun prepareValuePxMatrix() {
if (isLogEnabled) {
if (isLogging) {
Timber.i("Preparing Value-Px Matrix, xMin: ${mXAxis.mAxisMinimum}, xMax: ${mXAxis.mAxisMaximum}, xDelta: ${mXAxis.axisRange}")
}

Expand All @@ -368,12 +368,12 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt

override fun notifyDataSetChanged() {
if (mData == null) {
if (isLogEnabled) {
if (isLogging) {
Timber.i("Preparing... DATA NOT SET.")
}
return
} else {
if (isLogEnabled) {
if (isLogging) {
Timber.i("Preparing...")
}
}
Expand Down Expand Up @@ -522,7 +522,7 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt

viewPortHandler.restrainViewPort(max(minOffset, offsetLeft), max(minOffset, offsetTop), max(minOffset, offsetRight), max(minOffset, offsetBottom))

if (isLogEnabled) {
if (isLogging) {
Timber.i("offsetLeft: $offsetLeft, offsetTop: $offsetTop, offsetRight: $offsetRight, offsetBottom: $offsetBottom")
Timber.i("Content: ${viewPortHandler.contentRect}")
}
Expand Down
18 changes: 9 additions & 9 deletions chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
/**
* Returns true if log-output is enabled for the chart, fals if not.
*/
var isLogEnabled: Boolean = false
var isLogging = false

/**
* object that holds all data that was originally set for the chart, before
Expand All @@ -65,12 +65,12 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
* Set this to false to prevent values from being highlighted by tap gesture.
* Values can still be highlighted via drag or programmatically. Default: true
*/
var isHighlightPerTapEnabled: Boolean = true
var isHighlightPerTap = true

/**
* If set to true, chart continues to scroll after touch up
*/
var isDragDecelerationEnabled: Boolean = true
var isDragDeceleration = true

/**
* Deceleration friction coefficient in [0 ; 1] interval, higher values
Expand Down Expand Up @@ -221,7 +221,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
mInfoPaint.textAlign = Align.CENTER
mInfoPaint.textSize = 12f.convertDpToPixel()

if (this.isLogEnabled) {
if (this.isLogging) {
Timber.i("Chart.init()")

// enable being detected by ScreenReader
Expand Down Expand Up @@ -535,7 +535,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
if (high == null) {
this.highlighted = null
} else {
if (this.isLogEnabled) {
if (this.isLogging) {
Timber.i("Highlighted: $high")
}

Expand Down Expand Up @@ -1051,7 +1051,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
// let the chart know there is new data
notifyDataSetChanged()

if (isLogEnabled) {
if (isLogging) {
Timber.i("Data is set.")
}
}
Expand Down Expand Up @@ -1203,17 +1203,17 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
}

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
if (this.isLogEnabled) {
if (this.isLogging) {
Timber.i("OnSizeChanged()")
}

if (w > 0 && h > 0 && w < 10000 && h < 10000) {
if (this.isLogEnabled) {
if (this.isLogging) {
Timber.i("Setting chart dimens, width: $w, height: $h")
}
viewPortHandler.setChartDimens(w.toFloat(), h.toFloat())
} else {
if (this.isLogEnabled) {
if (this.isLogging) {
Timber.w("*Avoiding* setting chart dimens! width: $w, height: $h")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ open class HorizontalBarChart : BarChart {
max(minOffset, offsetBottom)
)

if (isLogEnabled) {
if (isLogging) {
Timber.i("offsetLeft: $offsetLeft, offsetTop: $offsetTop, offsetRight: $offsetRight, offsetBottom: $offsetBottom")
Timber.i("Content: ${viewPortHandler.contentRect}")
}
Expand Down Expand Up @@ -251,7 +251,7 @@ open class HorizontalBarChart : BarChart {
*/
override fun getHighlightByTouchPoint(x: Float, y: Float): Highlight? {
if (mData == null) {
if (isLogEnabled) {
if (isLogging) {
Timber.e("Can't select by touch. No data set.")
}
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ abstract class PieRadarChartBase<T : ChartData<out IDataSet<out Entry>>>

viewPortHandler.restrainViewPort(offsetLeft, offsetTop, offsetRight, offsetBottom)

if (isLogEnabled)
if (isLogging)
Timber.i("offsetLeft: $offsetLeft, offsetTop: $offsetTop, offsetRight: $offsetRight, offsetBottom: $offsetBottom")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class BarLineChartTouchListener(
if (abs(velocityX.toDouble()) > Utils.minimumFlingVelocity ||
abs(velocityY.toDouble()) > Utils.minimumFlingVelocity
) {
if (touchMode == DRAG && chart.isDragDecelerationEnabled) {
if (touchMode == DRAG && chart.isDragDeceleration) {
stopDeceleration()

decelerationLastTime = AnimationUtils.currentAnimationTimeMillis()
Expand Down Expand Up @@ -502,7 +502,7 @@ class BarLineChartTouchListener(

chart.zoom(scaleX, scaleY, trans.x, trans.y)

if (chart.isLogEnabled)
if (chart.isLogging)
Timber.i("Double-Tap, Zooming In, x: ${trans.x} y: ${trans.y}")

onChartGestureListener?.onChartScale(e, scaleX, scaleY)
Expand All @@ -528,7 +528,7 @@ class BarLineChartTouchListener(

l?.onChartSingleTapped(e)

if (!chart.isHighlightPerTapEnabled) {
if (!chart.isHighlightPerTap) {
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PieRadarChartTouchListener(chart: PieRadarChartBase<*>) : ChartTouchListen

resetVelocity()

if (chart.isDragDecelerationEnabled) {
if (chart.isDragDeceleration) {
sampleVelocity(x, y)
}

Expand All @@ -52,7 +52,7 @@ class PieRadarChartTouchListener(chart: PieRadarChartBase<*>) : ChartTouchListen
}

MotionEvent.ACTION_MOVE -> {
if (chart.isDragDecelerationEnabled) {
if (chart.isDragDeceleration) {
sampleVelocity(x, y)
}

Expand All @@ -72,7 +72,7 @@ class PieRadarChartTouchListener(chart: PieRadarChartBase<*>) : ChartTouchListen
}

MotionEvent.ACTION_UP -> {
if (chart.isDragDecelerationEnabled) {
if (chart.isDragDeceleration) {
stopDeceleration()

sampleVelocity(x, y)
Expand Down Expand Up @@ -114,7 +114,7 @@ class PieRadarChartTouchListener(chart: PieRadarChartBase<*>) : ChartTouchListen

onChartGestureListener?.onChartSingleTapped(e)

if (!chart.isHighlightPerTapEnabled) {
if (!chart.isHighlightPerTap) {
return false
}

Expand Down
Loading