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

ChartDataSet min and max values not recalculated when calling clear() #3260

Closed
carlo- opened this issue Feb 11, 2018 · 0 comments
Closed

ChartDataSet min and max values not recalculated when calling clear() #3260

carlo- opened this issue Feb 11, 2018 · 0 comments

Comments

@carlo-
Copy link
Contributor

carlo- commented Feb 11, 2018

The method clear() of ChartDataSet is described as:

Removes all values from this DataSet and recalculates min and max value.

but the min and max values are never recalculated (or rather, reset).
Calling clear() does trigger calcMinMax(), but the variables _yMax, _yMin, _xMax, _xMin are never reset to their initial values because of a guard statement:

open override func calcMinMax()
{
    guard !values.isEmpty else { return }

    _yMax = -Double.greatestFiniteMagnitude
    _yMin = Double.greatestFiniteMagnitude
    _xMax = -Double.greatestFiniteMagnitude
    _xMin = Double.greatestFiniteMagnitude

    values.forEach { calcMinMax(entry: $0) }
}

The guard statement should come after the min max variables are reset (or even removed completely, since it wouldn't make any difference).

liuxuan30 added a commit that referenced this issue Feb 22, 2018
Min and Max reset when clearing ChartDataSet (Fixes #3260)
FreddyZeng added a commit to FreddyZeng/Charts that referenced this issue Feb 26, 2018
* 'master' of https://github.com/danielgindi/Charts:
  add pie chart unit tests (ChartsOrg#3297)
  ChartsOrg#3287: align Objc and Swift demos balloon marker
  update changelog
  Min and Max reset when clearing ChartDataSet (Fixes ChartsOrg#3260)

# Conflicts:
#	Source/Charts/Mark/BalloonMarker.swift
guillermo-ag-95 added a commit to guillermo-ag-95/Project-Atlas that referenced this issue Feb 27, 2018
Charts only display one of every ten entries due to performance issues.
Charts does not recalculate their min and max after clear the graph (ChartsOrg/Charts#3260).
FreddyZeng added a commit to FreddyZeng/Charts that referenced this issue Mar 14, 2018
* master: (55 commits)
  Refactors -[tableView:cellForRowAtIndexPath:] (ChartsOrg#3326)
  fix ChartsOrg#3311. Need one more key for iOS 11 camera roll saving
  revert a mistake, fix ChartsOrg#3299
  add pie chart unit tests (ChartsOrg#3297)
  ChartsOrg#3287: align Objc and Swift demos balloon marker
  update changelog
  Min and Max reset when clearing ChartDataSet (Fixes ChartsOrg#3260)
  Restored old performance (ChartsOrg#3216)
  Support other bundle than main MarkerView.viewFromXib() (ChartsOrg#3215)
  For ChartsOrg#2840. add dataIndex parameter in `highlightValue()` calls (ChartsOrg#2852)
  Balloon Marker indicates position of data (ChartsOrg#3181)
  bump Info.plist version
  Fixed a duplicated assignment compared with obj-c code. (ChartsOrg#3179)
  Updated README for 3.0.5 (ChartsOrg#3183)
  BubbleChart uses correct colour for index now.
  Added custom text alignment for noData
  Fixes the distance issue between the legend and the horizontal bar chart (Fixes ChartsOrg#2138) (ChartsOrg#2214)
  call setNeedsDisplay() here to trigger render noDataText (ChartsOrg#3198)
  添加定制TY的Mark
  添加修改过的Mark到工程中
  ...

# Conflicts:
#	ICXCharts.podspec
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

1 participant