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

Straight Line in third quadrant does't show up #3898

Closed
ArduinoManager opened this issue Mar 13, 2019 · 1 comment
Closed

Straight Line in third quadrant does't show up #3898

ArduinoManager opened this issue Mar 13, 2019 · 1 comment

Comments

@ArduinoManager
Copy link

What did you do?

Simple LineChart with negative x and y values.

`

        let ds1 = LineChartDataSet(values: [], label: "I [mA]")
        ds1.mode = .linear
        ds1.drawCirclesEnabled = true
        ds1.drawCircleHoleEnabled = false
        ds1.circleRadius = 2
        ds1.setCircleColor(.black)
        ds1.colors = [NSUIColor.red]
        ds1.append(ChartDataEntry(x: 0, y: 0))
        ds1.append(ChartDataEntry(x: -50, y: -50))
        ds1.append(ChartDataEntry(x: -100, y: -100))

        chartData.addDataSet(ds1)
        self.lineChartView.data = chartData            
        self.lineChartView.gridBackgroundColor = NSUIColor.white`

What did you expect to happen?

A straight line in the third quadrant

What happened instead?

Nothing. The chart is empty.

Replacing:

ds1.append(ChartDataEntry(x: 0, y: 0))
ds1.append(ChartDataEntry(x: -50, y: -50))
ds1.append(ChartDataEntry(x: -100, y: -100))

with:

ds1.append(ChartDataEntry(x: 0, y: 0))
ds1.append(ChartDataEntry(x: 50, y: 50))
ds1.append(ChartDataEntry(x: 100, y: 100))

a straight line shows up in the first quadrant, as expected.

Charts Environment

Charts version/Branch/Commit Number: Pod 3.2.2
Xcode version: 10.1
Swift version: 4.2
Platform(s) running Charts: macOS 10.14.3
macOS version running Xcode: macOS 10.14.3

Demo Project

NA

@liuxuan30
Copy link
Member

seems the order of your x values matters. use -100,-50,0

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

2 participants