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
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies {
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.activity:activity-compose:1.12.1")
implementation("androidx.compose.material:material-icons-extended")
implementation("com.github.AppDevNext.Logcat:LogcatCoreLib:3.4")
debugImplementation("androidx.compose.ui:ui-tooling")

// Compose testing
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:name="info.hannes.logcat.LoggingApplication"
android:theme="@style/AppTheme">
<activity
android:name="info.appdev.chartexample.notimportant.MainActivity"
Expand Down
17 changes: 6 additions & 11 deletions app/src/main/kotlin/info/appdev/chartexample/BarChartActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.RectF
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -31,10 +30,11 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener
import com.github.mikephil.charting.utils.Fill
import com.github.mikephil.charting.utils.MPPointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.custom.XYMarkerView
import info.appdev.chartexample.formatter.DayAxisValueFormatter
import info.appdev.chartexample.formatter.MyAxisValueFormatter
import info.appdev.chartexample.custom.XYMarkerView
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber

class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener {
private var chart: BarChart? = null
Expand Down Expand Up @@ -296,17 +296,12 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
chart!!.getBarBounds(entry as BarEntry, bounds)
val position = chart!!.getPosition(entry, AxisDependency.LEFT)

Log.i("bounds", bounds.toString())
Log.i("position", position.toString())

Log.i(
"x-index",
("low: " + chart!!.lowestVisibleX + ", high: "
+ chart!!.highestVisibleX)
)
Timber.i("bounds $bounds")
Timber.i("position = $position")
Timber.i("x-index low: ${+chart!!.lowestVisibleX}, high: ${+chart!!.highestVisibleX}")

MPPointF.recycleInstance(position)
}

override fun onNothingSelected() {}
override fun onNothingSelected() = Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -27,6 +26,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.custom.MyMarkerView
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber
import java.util.Locale

class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener {
Expand Down Expand Up @@ -255,10 +255,8 @@ class BarChartActivityMultiDataset : DemoBase(), OnSeekBarChangeListener, OnChar
override fun onStopTrackingTouch(seekBar: SeekBar?) {}

override fun onValueSelected(entry: Entry, highlight: Highlight) {
Log.i("Activity", "Selected: " + entry.toString() + ", dataSet: " + highlight.dataSetIndex)
Timber.i("Selected: $entry, dataSet: ${highlight.dataSetIndex}")
}

override fun onNothingSelected() {
Log.i("Activity", "Nothing selected.")
}
override fun onNothingSelected() = Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class BarChartActivitySinus : DemoBase(), OnSeekBarChangeListener {

binding.chart1.description.isEnabled = false

// if more than 60 entries are displayed in the chart, no values will be
// drawn
// if more than 60 entries are displayed in the chart, no values will be drawn
binding.chart1.setMaxVisibleValueCount(60)

// scaling can now only be done on x- and y-axis separately
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -28,6 +27,7 @@ import com.github.mikephil.charting.utils.ColorTemplate
import com.github.mikephil.charting.utils.MPPointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber

class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener {
private var chart: BubbleChart? = null
Expand Down Expand Up @@ -225,12 +225,12 @@ class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSel
}

override fun onValueSelected(entry: Entry, highlight: Highlight) {
Log.i("VAL SELECTED", "Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex)
Timber.i("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex)
}

override fun onNothingSelected() {}
override fun onNothingSelected() = Unit

override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit

override fun onStopTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) = Unit
}
4 changes: 2 additions & 2 deletions app/src/main/kotlin/info/appdev/chartexample/DataTools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package info.appdev.chartexample
import android.content.Context
import android.graphics.Color
import android.graphics.DashPathEffect
import android.util.Log
import androidx.core.content.ContextCompat
import com.github.mikephil.charting.charts.LineChart
import com.github.mikephil.charting.data.Entry
Expand All @@ -13,6 +12,7 @@ import com.github.mikephil.charting.formatter.IFillFormatter
import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet
import com.github.mikephil.charting.utils.getSDKInt
import timber.log.Timber

class DataTools {
companion object {
Expand Down Expand Up @@ -143,7 +143,7 @@ class DataTools {
}

fun setData(context: Context, lineChart: LineChart, count: Int = VAL_COUNT, range: Float = VAL_RANGE) {
Log.d("setData", "$count= range=$range")
Timber.d("count=$count range=$range")
val values = ArrayList<Entry>()
if (count == VAL_COUNT) {
VAL_FIX.forEachIndexed { index, d ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ package info.appdev.chartexample
import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import androidx.core.content.ContextCompat
import com.github.mikephil.charting.charts.Chart
import com.github.mikephil.charting.data.DataSet
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.data.LineData
Expand All @@ -18,6 +16,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener
import com.github.mikephil.charting.listener.OnDrawListener
import info.appdev.chartexample.databinding.ActivityDrawChartBinding
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber

/**
* This Activity demonstrates drawing into the Chart with the finger. Both line,
Expand Down Expand Up @@ -125,25 +124,25 @@ class DrawChartActivity : DemoBase(), OnChartValueSelectedListener, OnDrawListen
}

override fun onValueSelected(entry: Entry, highlight: Highlight) {
Log.i("VAL SELECTED", ("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex))
Timber.i(("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex))
}

override fun onNothingSelected() = Unit

/** callback for each new entry drawn with the finger */
override fun onEntryAdded(entry: Entry) {
Log.i(Chart.LOG_TAG, entry.toString())
Timber.i(entry.toString())
}

/** callback when a DataSet has been drawn (when lifting the finger) */
override fun onDrawFinished(dataSet: DataSet<*>) {
Log.i(Chart.LOG_TAG, "DataSet drawn. " + dataSet.toSimpleString())
Timber.i("DataSet drawn. " + dataSet.toSimpleString())

// prepare the legend again
binding.chart1.data?.let { binding.chart1.legendRenderer.computeLegend(it) }
}

override fun onEntryMoved(entry: Entry) {
Log.i(Chart.LOG_TAG, "Point moved $entry")
Timber.i("Point moved $entry")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.RectF
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -26,6 +25,7 @@ import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.notimportant.DemoBase
import androidx.core.net.toUri
import info.appdev.chartexample.databinding.ActivityHorizontalbarchartBinding
import timber.log.Timber

class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener {

Expand Down Expand Up @@ -249,8 +249,8 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV
.getAxisDependency()
)

Log.i("bounds", bounds.toString())
Log.i("position", position.toString())
Timber.i(bounds.toString())
Timber.i(position.toString())

MPPointF.recycleInstance(position)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.RectF
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -27,6 +26,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener
import com.github.mikephil.charting.utils.MPPointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber

class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener {
private var chart: HorizontalBarChart? = null
Expand Down Expand Up @@ -256,8 +256,8 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener,
.getAxisDependency()
)

Log.i("bounds", bounds.toString())
Log.i("position", position.toString())
Timber.i("bounds $bounds")
Timber.i("position $position")

MPPointF.recycleInstance(position)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -23,6 +22,7 @@ import com.github.mikephil.charting.utils.EntryXComparator
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.custom.MyMarkerView
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber
import java.util.Collections

class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelectedListener {
Expand Down Expand Up @@ -232,12 +232,12 @@ class InvertedLineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa
}

override fun onValueSelected(entry: Entry, highlight: Highlight) {
Log.i("VAL SELECTED", "Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex)
Timber.i("Value: " + entry.y + ", xIndex: " + entry.x + ", DataSet index: " + highlight.dataSetIndex)
}

override fun onNothingSelected() {}
override fun onNothingSelected() = Unit

override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit

override fun onStopTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) = Unit
}
17 changes: 6 additions & 11 deletions app/src/main/kotlin/info/appdev/chartexample/LineChartActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
Expand All @@ -25,6 +24,7 @@ import info.appdev.chartexample.DataTools.Companion.setData
import info.appdev.chartexample.custom.MyMarkerView
import info.appdev.chartexample.databinding.ActivityLinechartBinding
import info.appdev.chartexample.notimportant.DemoBase
import timber.log.Timber

/**
* Example of a heavily customized [LineChart] with limit lines, custom line shapes, etc.
Expand Down Expand Up @@ -135,7 +135,7 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec
// add data
binding.seekBarX.progress = 45
binding.seekBarY.progress = 180
Log.d("setDataCreate", "count=45 range=180f")
Timber.d("count=45 range=180f")
setData(this, binding.chart1, 45, 180f)

// draw points over time
Expand Down Expand Up @@ -263,15 +263,10 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
override fun onValueSelected(entry: Entry, highlight: Highlight) {
Log.i("Entry selected", entry.toString())
Log.i("LOW HIGH", "low: " + binding.chart1.lowestVisibleX + ", high: " + binding.chart1.highestVisibleX)
Log.i(
"MIN MAX",
"xMin: " + binding.chart1.xChartMin + ", xMax: " + binding.chart1.xChartMax + ", yMin: " + binding.chart1.yChartMin + ", yMax: " + binding.chart1.yChartMax
)
Timber.i(entry.toString())
Timber.i("LOW HIGH low: " + binding.chart1.lowestVisibleX + ", high: " + binding.chart1.highestVisibleX)
Timber.i("MIN MAX xMin: " + binding.chart1.xChartMin + ", xMax: " + binding.chart1.xChartMax + ", yMin: " + binding.chart1.yChartMin + ", yMax: " + binding.chart1.yChartMax)
}

override fun onNothingSelected() {
Log.i("Nothing selected", "Nothing selected.")
}
override fun onNothingSelected() = Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.SeekBar
import android.widget.SeekBar.OnSeekBarChangeListener
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import com.github.mikephil.charting.charts.LineChart
import com.github.mikephil.charting.components.Legend
import com.github.mikephil.charting.components.Legend.LegendForm
Expand All @@ -24,7 +24,7 @@ import com.github.mikephil.charting.listener.OnChartValueSelectedListener
import com.github.mikephil.charting.utils.ColorTemplate
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.notimportant.DemoBase
import androidx.core.net.toUri
import timber.log.Timber

/**
* Example of a dual axis [LineChart] with multiple data sets.
Expand Down Expand Up @@ -357,7 +357,7 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa
}

override fun onValueSelected(entry: Entry, highlight: Highlight) {
Log.i("Entry selected", entry.toString())
Timber.i(entry.toString())

chart!!.centerViewToAnimated(
entry.x, entry.y, chart!!.data!!.getDataSetByIndex(highlight.dataSetIndex)
Expand All @@ -369,9 +369,7 @@ class LineChartDualAxisActivity : DemoBase(), OnSeekBarChangeListener, OnChartVa
// .getAxisDependency(), 1000);
}

override fun onNothingSelected() {
Log.i("Nothing selected", "Nothing selected.")
}
override fun onNothingSelected() = Unit

override fun onStartTrackingTouch(seekBar: SeekBar?) {}

Expand Down
Loading
Loading