Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in line chart yAxis when range are less than 1 #2445

Closed
rolyanos opened this issue May 16, 2017 · 6 comments
Closed

Bug in line chart yAxis when range are less than 1 #2445

rolyanos opened this issue May 16, 2017 · 6 comments

Comments

@rolyanos
Copy link

Hello, maybe I doing something wrong, but I am think that there are small bug in y-axis.
screen shot 2017-05-16 at 17 14 40

here is the code:

override func viewDidLoad() {
    super.viewDidLoad()
    
    let data = generateLineData()
    testLineChartView.data = data
    
}

func generateLineData() -> LineChartData {
    let data: LineChartData = LineChartData()
    
    
    var entries: [ChartDataEntry] = []
    
    var dataArr: [Double] = []
    dataArr.append(0.1)
    dataArr.append(0.001)
    dataArr.append(0.8)
    dataArr.append(0.02)
    dataArr.append(1)
    
    
    for index in 0..<5 {
        entries.append(ChartDataEntry(x: Double(index)+0.5,  y: Double(dataArr[index]) ) )
    }
    
    let set: LineChartDataSet = LineChartDataSet(values: entries, label: "Label")
    set.setCircleColor(UIColor.blue)
    set.lineWidth = 1
    set.circleRadius = 5
    set.drawCircleHoleEnabled = false
    set.valueTextColor = UIColor.blue
    set.valueFont = UIFont(name: "Verdana", size: 12.0)!
    set.drawFilledEnabled = true
    set.mode = Charts.LineChartDataSet.Mode.linear
    set.axisDependency = Charts.YAxis.AxisDependency.left
    
    data.addDataSet(set)
    
    return data
}
@liuxuan30
Copy link
Member

What's the issue? seems totally fine to me.

@rolyanos
Copy link
Author

rolyanos commented May 17, 2017

@liuxuan30,there are no 0 number before "," symbol.

Needs 0,1 but there are ,1
screen shot 2017-05-17 at 12 18 17

@thierryH91200
Copy link
Contributor

check out valueFormatter

@rolyanos
Copy link
Author

@thierryH91200, why? there are no needs of customization, just fix a bug with wrong numbers that less than 1. There are wrong numbers in yAxis,xAxis and in value label.

@thierryH91200
Copy link
Contributor

no it's correct
x = 0.5, 1.5, 2.5 etc...
y = 0.1,0.001, 0.8, 0.02,1
format the values

@rolyanos
Copy link
Author

Yep, it works with formatter, thanks. Strange, that it is not show 0 before "," by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants