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

y axis range not automatically recalculated when adding entry to data set #2920

Closed
SimonNick opened this issue Oct 28, 2017 · 1 comment
Closed

Comments

@SimonNick
Copy link

SimonNick commented Oct 28, 2017

Hi guys,

When I add a data entry to a entry data set of a line plot the y axis range of the chart data is not recalculated.

let dataSet = lineChartView.data!.getDataSetByIndex(0)
let dataEntry = ChartDataEntry(x: 12.0, y: 30.0) // where 30.0 > maximum of other y values
dataSet?.addEntryOrdered(dataEntry)
lineChartView.data?.calcMinMax() // if i do not call this the y axis range is wrong
lineChartView.notifyDataSetChanged()

I have to call calcMinMax() to recalculate the range of the y axis. The x axis seems to be fine.

Is it intended or a bug?

Best,
Nick

@liuxuan30
Copy link
Member

it's intended. as you have add new data, you can call lineChartView.data?.notifyDataChanged actually. it will call calcMinMax() for you.

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