Skip to content

Commit

Permalink
- added support for y axis autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
mpz-financial-com committed May 20, 2015
1 parent 49dba67 commit 8902631
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions Charts/Classes/Data/CandleChartDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,41 @@ public class CandleChartDataSet: BarLineScatterCandleChartDataSet
super.init(yVals: yVals, label: label);
}

internal override func calcMinMax()
internal override func calcMinMax(#start: Int, end: Int)
{
if (yVals.count == 0)
{
return;
}

var entries = yVals as! [CandleChartDataEntry];

_yMin = entries[0].low;
_yMax = entries[0].high;

for (var i = 0; i < entries.count; i++)

var endValue : Int;

if end == 0
{
endValue = entries.count - 1;
}
else
{
endValue = end;
}

_lastStart = start;
_lastEnd = end;

_yMin = entries[start].low;
_yMax = entries[start].high;

for (var i = 0; i <= endValue; i++)
{
var e = entries[i];

if (e.low < _yMin)
{
_yMin = e.low;
}

if (e.high > _yMax)
{
_yMax = e.high;
Expand Down

0 comments on commit 8902631

Please sign in to comment.