ChartsOrg / ChartsOrg/Charts

How to draw Cubic LineChart without showing Line at 0 and without Line break?

Open
#4,076 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I have use the cubic LineChart and some data of y-Axis are 0 and if the y-axis data are 0 then I don't want to draw the line at the bottom.

If any y value will be 0 then line connect to next value.

Here is my code.

```
func setDataCount(_ count: Int, range: UInt32) {
let set1 = LineChartDataSet(entries: [ChartDataEntry(x: 5, y: 10),
ChartDataEntry(x: 10, y: 15),
ChartDataEntry(x: 15, y: 0),
ChartDataEntry(x: 20, y: 5),
ChartDataEntry(x: 25, y: 8),
ChartDataEntry(x: 30, y: 20)], label: "DataSet 1")
set1.mode = .cubicBezier
set1.drawCirclesEnabled = false
set1.lineWidth = 1.8
set1.circleRadius = 4
set1.setCircleColor(.white)
set1.highlightColor = .clear
set1.fillColor = .white
set1.fillAlpha = 1
set1.drawHorizontalHighlightIndicatorEnabled = false
set1.fillFormatter = CubicLineSampleFillFormatter()

let data = LineChartData(dataSet: set1)
data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 9)!)
data.setDrawValues(false)

chartView.data = data
}
```

how can I pass null value in `ChartDataEntry` y value?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.