yasuoza / YOChartImageKit

Chart image framework for watchOS
MIT License
427 stars 55 forks source link

Added ability to override maxValue for line and bar charts #3

Closed EpicDraws closed 8 years ago

EpicDraws commented 8 years ago

Setting maxValue overrides default behavior of using the highest value as the max y value for the charts.

yasuoza commented 8 years ago

When maxValue is a property, its getter should returns user defined value or max value of _values.

So, how about defining like this?

- (NSNumber *)getMaxValue {
    return _maxValue ? _maxValue : [NSNumber numberWithFloat:[[_values valueForKeyPath:@"@max.floatValue"] floatValue]];
}
stuffmc commented 8 years ago

Please oh please don't make a getXXX property. This isn't java ;) the getter should be (NSNumber *)maxValue — or did I misunderstand something?

EpicDraws commented 8 years ago

Agreed, and submitted a change with nonnull, nonatomic as well as the getter method using -maxValue.

On Fri, Jan 29, 2016 at 1:08 AM StuFF mc notifications@github.com wrote:

Please oh please don't make a getXXX property. This isn't java ;) the getter should be (NSNumber *)maxValue — or did I misunderstand something?

— Reply to this email directly or view it on GitHub https://github.com/yasuoza/YOChartImageKit/pull/3#issuecomment-176653324 .

yasuoza commented 8 years ago

@stuffmc Thank you for your whole contribution! Yes, I agree with you.

@EpicDraws Thank you very much! I'll merge this!

yasuoza commented 8 years ago

I will release new version in this weekend. Thank you guys!