|
|
|
|
@ -9,6 +9,7 @@ import com.github.mikephil.charting.charts.BarLineChartBase |
|
|
|
|
import com.github.mikephil.charting.charts.LineChart |
|
|
|
|
import com.github.mikephil.charting.data.* |
|
|
|
|
import com.github.mikephil.charting.highlight.Highlight |
|
|
|
|
import com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet |
|
|
|
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener |
|
|
|
|
import kotlinx.android.synthetic.main.fragment_graph.* |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
@ -132,7 +133,7 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener { |
|
|
|
|
this.legendView.prepareWithStat(this.stat, dataSet.entryCount, this.style) |
|
|
|
|
if (dataSet.entryCount > 0) { |
|
|
|
|
val entry = dataSet.getEntryForIndex(dataSet.entryCount - 1) |
|
|
|
|
this.selectValue(entry, dataSet.label) |
|
|
|
|
this.selectValue(entry, dataSet) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -182,12 +183,14 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val dataSet = this.chartView?.data?.getDataSetForEntry(e) |
|
|
|
|
|
|
|
|
|
e?.let { entry -> |
|
|
|
|
this.selectValue(entry, groupName) |
|
|
|
|
this.selectValue(entry, dataSet) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun selectValue(entry: Entry, groupName: String) { |
|
|
|
|
private fun selectValue(entry: Entry, dataSet: IBarLineScatterCandleBubbleDataSet<out Entry>? = null) { |
|
|
|
|
|
|
|
|
|
val statEntry = when (entry.data) { |
|
|
|
|
is ObjectIdentifier -> { |
|
|
|
|
@ -199,8 +202,10 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
statEntry?.let { |
|
|
|
|
val groupName = dataSet?.label ?: "" |
|
|
|
|
val color = dataSet?.color |
|
|
|
|
val legendValue = it.legendValues(stat, entry, this.style, groupName, requireContext()) |
|
|
|
|
this.legendView.setItemData(legendValue) |
|
|
|
|
this.legendView.setItemData(legendValue, color) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|