Skip to content

Commit

Permalink
Fixed dataset updates in demos
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Apr 13, 2016
1 parent 2bff257 commit cefa901
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/AnotherBarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ - (void)setDataCount:(int)count range:(double)range
{
set1 = (BarChartDataSet *)_chartView.data.dataSets[0];
set1.yVals = yVals;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/BarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ - (void)setDataCount:(int)count range:(double)range
{
set1 = (BarChartDataSet *)_chartView.data.dataSets[0];
set1.yVals = yVals;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/CubicLineChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ - (void)setDataCount:(int)count range:(double)range
{
set1 = (LineChartDataSet *)_chartView.data.dataSets[0];
set1.yVals = yVals1;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ - (void)setDataCount:(int)count range:(double)range
{
set1 = (BarChartDataSet *)_chartView.data.dataSets[0];
set1.yVals = yVals;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/LineChart1ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ - (void)setDataCount:(int)count range:(double)range
{
set1 = (LineChartDataSet *)_chartView.data.dataSets[0];
set1.yVals = yVals;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/LineChart2ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ - (void)setDataCount:(int)count range:(double)range
set2 = (LineChartDataSet *)_chartView.data.dataSets[1];
set1.yVals = yVals1;
set2.yVals = yVals2;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/MultipleBarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ - (void)setDataCount:(int)count range:(double)range
set1.yVals = yVals1;
set2.yVals = yVals2;
set3.yVals = yVals3;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
36 changes: 13 additions & 23 deletions ChartsDemo/Classes/Demos/PositiveNegativeBarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,29 +149,19 @@ - (void)setChartData
}
}

BarChartDataSet *set = nil;
if (_chartView.data.dataSetCount > 0)
{
set = (BarChartDataSet *)_chartView.data.dataSets[0];
set.yVals = values;
[_chartView notifyDataSetChanged];
}
else
{
set = [[BarChartDataSet alloc] initWithYVals:values label:@"Values"];
set.barSpace = 0.4f;
set.colors = colors;
set.valueColors = colors;

BarChartData *data = [[BarChartData alloc] initWithXVals:dates dataSet:set];
[data setValueFont:[UIFont systemFontOfSize:13.f]];

NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.maximumFractionDigits = 1;
[data setValueFormatter:formatter];

_chartView.data = data;
}
BarChartDataSet *set = set = [[BarChartDataSet alloc] initWithYVals:values label:@"Values"];
set.barSpace = 0.4f;
set.colors = colors;
set.valueColors = colors;

BarChartData *data = [[BarChartData alloc] initWithXVals:dates dataSet:set];
[data setValueFont:[UIFont systemFontOfSize:13.f]];

NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.maximumFractionDigits = 1;
[data setValueFormatter:formatter];

_chartView.data = data;
}

- (void)optionTapped:(NSString *)key
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/SinusBarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ - (void)setDataCount:(int)count
{
set = (BarChartDataSet *)_chartView.data.dataSets[0];
set.yVals = entries;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down
1 change: 1 addition & 0 deletions ChartsDemo/Classes/Demos/StackedBarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ - (void)setDataCount:(int)count range:(double)range
{
set1 = (BarChartDataSet *)_chartView.data.dataSets[0];
set1.yVals = yVals;
_chartView.data.xValsObjc = xVals;
[_chartView notifyDataSetChanged];
}
else
Expand Down

0 comments on commit cefa901

Please sign in to comment.