|
|
|
|
@ -45,7 +45,7 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener, Co |
|
|
|
|
private lateinit var parentActivity: PokerAnalyticsActivity |
|
|
|
|
private lateinit var selectedReport: Report |
|
|
|
|
private lateinit var legendView: LegendView |
|
|
|
|
private lateinit var chartView: BarLineChartBase<*> |
|
|
|
|
private var chartView: BarLineChartBase<*>? = null |
|
|
|
|
|
|
|
|
|
private var stat: Stat = Stat.NET_RESULT |
|
|
|
|
private var aggregationType: AggregationType = AggregationType.SESSION |
|
|
|
|
@ -89,14 +89,6 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener, Co |
|
|
|
|
this.legendView = LegendView(requireContext()) |
|
|
|
|
this.legendContainer.addView(this.legendView) |
|
|
|
|
|
|
|
|
|
this.chartView = when (stat.graphType) { |
|
|
|
|
GraphType.LINE -> LineChart(context) |
|
|
|
|
GraphType.BAR -> BarChart(context) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val axisFormatting = aggregationType.axisFormatting |
|
|
|
|
this.chartView.setStyle(false, axisFormatting, requireContext()) |
|
|
|
|
this.chartContainer.addView(this.chartView) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -121,11 +113,19 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener, Co |
|
|
|
|
|
|
|
|
|
this.legendView.prepareWithStat(this.stat, dataSet.entryCount) |
|
|
|
|
|
|
|
|
|
// initialize chart |
|
|
|
|
if (this.chartView == null) { |
|
|
|
|
this.chartView = when (dataSet) { |
|
|
|
|
is LineDataSet -> LineChart(context) |
|
|
|
|
is BarDataSet -> BarChart(context) |
|
|
|
|
else -> null |
|
|
|
|
} |
|
|
|
|
this.chartContainer.addView(this.chartView) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
when (dataSet) { |
|
|
|
|
is LineDataSet -> { |
|
|
|
|
val lineChart: LineChart = this.chartView as LineChart |
|
|
|
|
// val colors = arrayOf(R.color.green_light).toIntArray() |
|
|
|
|
// dataSet.setColors(colors, context) |
|
|
|
|
val lineData = LineData(listOf(dataSet)) |
|
|
|
|
lineChart.data = lineData |
|
|
|
|
} |
|
|
|
|
@ -139,12 +139,14 @@ class GraphFragment : PokerAnalyticsFragment(), OnChartValueSelectedListener, Co |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val axisFormatting = aggregationType.axisFormatting |
|
|
|
|
this.chartView.setStyle(false, axisFormatting, requireContext()) |
|
|
|
|
this.chartView.setOnChartValueSelectedListener(this) |
|
|
|
|
|
|
|
|
|
this.chartView?.let { |
|
|
|
|
it.setStyle(false, axisFormatting, requireContext()) |
|
|
|
|
it.setOnChartValueSelectedListener(this) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.selectValue(dataSet.getEntryForIndex(dataSet.entryCount - 1)) |
|
|
|
|
|
|
|
|
|
// this.chartView.highlightValue((entries.size - 1).toFloat(), 0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|