val set1: LineDataSet
set1 = LineDataSet(values, "Player Form Graph")
set1.color = Color.GREEN
set1.setCircleColor(Color.GREEN)
set1.lineWidth = 3f
set1.circleRadius = 6f
set1.circleHoleRadius = 3f
set1.setDrawCircleHole(true)
set1.disableDashedLine()
set1.valueTextSize = 16f
set1.setDrawFilled(true)
set1.fillColor = Color.DKGRAY
set1.formLineWidth = 6f
set1.formLineDashEffect = DashPathEffect(floatArrayOf(10f, 5f), 0f)
set1.formSize = 16f
setUpGraph Функция:
private fun setUpGraph() {
binding.chart1.setDrawGridBackground(false)
// no description text
binding.chart1.description.isEnabled = false
// enable touch gestures
binding.chart1.setTouchEnabled(true)
// enable scaling and dragging
binding.chart1.isDragEnabled = false
binding.chart1.setScaleEnabled(false)
// if disabled, scaling can be done on x- and y-axis separately
binding.chart1.setPinchZoom(false)
// set an alternative background color
// binding.chart1.setBackgroundColor(Color.GRAY);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
val mv = MyMarkerView(activity, R.layout.custom_marker_view)
mv.chartView = binding.chart1 // For bounds control
binding.chart1.marker = mv // Set the marker to the chart
val leftAxis = binding.chart1.axisLeft
Log.d("Lucy", xAxisHigh.toString())
leftAxis.axisMaximum = xAxisHigh.toFloat()
leftAxis.axisMinimum = 0f
leftAxis.axisLineWidth = 2f
leftAxis.textColor = Color.WHITE
leftAxis.setDrawZeroLine(false)
// limit lines are drawn behind data (and not on top)
leftAxis.setDrawLimitLinesBehindData(true)
binding.chart1.axisRight.isEnabled = false
val xAxis = binding.chart1.xAxis
xAxis.textColor = Color.YELLOW
//xAxis.mAxisMaximum = 7f
// add data
binding.chart1.animateX(2500)
//binding.chart1.invalidate();
// get the legend (only possible after setting data)
val l = binding.chart1.legend
// modify the legend ...
l.form = Legend.LegendForm.LINE
}