title: How to add a marker with some details for Bar Chart using MPAndroidChart in Kotlin?
body: <p>I created a stacked <strong>BarChart using MPAndroidChart</strong> library and now when the user <strong>clicks</strong> on a bar, I want to display a <strong>marker</strong> with some details as in the image bellow:
  <a href="https://i.stack.imgur.com/7U1nv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7U1nv.png" alt="enter image description here" /></a></p>
  <p>I found different topics on this subject but couldn't find a clear solution, so please help me if you can. Thanks!</p>
  <p><strong>EDIT</strong></p>
  <pre><code> for (item in dataTicketsList) {
          if (i &lt;= 2) {
  
              val firstValue: String = transformDataForChart(item.values.first!!)
              hoursValuesArray.add(firstValue.toFloat())
  
              val secondValue: String = transformDataForChart(item.values.second!!)
              hoursValuesArray.add(secondValue.toFloat())
  
              val thirdValue: String = transformDataForChart(item.values.third!!)
              hoursValuesArray.add(thirdValue.toFloat())
  
              entriesVerticalBar.add(BarEntry(i, hoursValuesArray.toFloatArray()))
              i++
              hoursValuesArray.clear()
  
              if (item.label!!.contains(&quot;.&quot; + (Calendar.getInstance().get(Calendar.YEAR) - 1).toString())) {
                  val date: String = item.label!!.replace(&quot;.&quot; + (Calendar.getInstance().get(Calendar.YEAR) - 1).toString(), &quot;&quot;)
                  barLabesArrayList.add(date)
              } else if (item.label!!.contains(&quot;.&quot; + (Calendar.getInstance().get(Calendar.YEAR)).toString())) {
                  val date: String = item.label!!.replace(&quot;.&quot; + (Calendar.getInstance().get(Calendar.YEAR)).toString(), &quot;&quot;)
                  barLabesArrayList.add(date)
              }
          }
      }
  
      verticalBarChartColors.add(Color.rgb(89, 93, 223))
      verticalBarChartColors.add(Color.rgb(25, 227, 180))
      verticalBarChartColors.add(Color.rgb(85, 164, 206))
      val markerView = CustomMarkerView(requireContext(), R.layout.custom_marker_view_layout, hoursValuesArray )
      var barDataSet = BarDataSet(entriesVerticalBar, &quot;&quot;)
      val barChart: BarChart = bar_chart_details
      barDataSet.colors = verticalBarChartColors
      barDataSet.valueTextSize = 8f
      barDataSet.stackLabels = arrayOf(&quot;00:00 - 06:00 h&quot;, &quot;06:00 - 18:00 h&quot;, &quot;18:00 - 24:00 h&quot;)
      barDataSet.valueTextColor = resources.getColor(R.color.white)
      val barData = BarData(barDataSet)
      barData.setValueFormatter(VerticalBarChart.DecimalRemover(DecimalFormat(&quot;###&quot;)))
      barChart.data = barData
      barChart.marker = markerView
  </code></pre>