diff --git a/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m index f6b1adaa8b..65439bc914 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/AnotherBarChartViewController.m @@ -97,13 +97,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; - set1.values = yVals; + [set1 replaceEntries:yVals]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[BarChartDataSet alloc] initWithValues:yVals label:@"DataSet"]; + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"DataSet"]; set1.colors = ChartColorTemplates.vordiplom; set1.drawValuesEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m index 52db459e9b..5e1567c088 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/BarChartViewController.m @@ -148,13 +148,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; - set1.values = yVals; + [set1 replaceEntries: yVals]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[BarChartDataSet alloc] initWithValues:yVals label:@"The year 2017"]; + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"The year 2017"]; [set1 setColors:ChartColorTemplates.material]; set1.drawIconsEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m index 765639acfe..9d32596674 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/BubbleChartViewController.m @@ -115,17 +115,17 @@ - (void)setDataCount:(int)count range:(double)range [yVals3 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size]]; } - BubbleChartDataSet *set1 = [[BubbleChartDataSet alloc] initWithValues:yVals1 label:@"DS 1"]; + BubbleChartDataSet *set1 = [[BubbleChartDataSet alloc] initWithEntries:yVals1 label:@"DS 1"]; set1.drawIconsEnabled = NO; [set1 setColor:ChartColorTemplates.colorful[0] alpha:0.50f]; [set1 setDrawValuesEnabled:YES]; - BubbleChartDataSet *set2 = [[BubbleChartDataSet alloc] initWithValues:yVals2 label:@"DS 2"]; + BubbleChartDataSet *set2 = [[BubbleChartDataSet alloc] initWithEntries:yVals2 label:@"DS 2"]; set2.iconsOffset = CGPointMake(0, 15); [set2 setColor:ChartColorTemplates.colorful[1] alpha:0.50f]; [set2 setDrawValuesEnabled:YES]; - BubbleChartDataSet *set3 = [[BubbleChartDataSet alloc] initWithValues:yVals3 label:@"DS 3"]; + BubbleChartDataSet *set3 = [[BubbleChartDataSet alloc] initWithEntries:yVals3 label:@"DS 3"]; [set3 setColor:ChartColorTemplates.colorful[2] alpha:0.50f]; [set3 setDrawValuesEnabled:YES]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m index 6e2a004dc3..25a0e73ca3 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/CandleStickChartViewController.m @@ -105,7 +105,7 @@ - (void)setDataCount:(int)count range:(double)range [yVals1 addObject:[[CandleChartDataEntry alloc] initWithX:i shadowH:val + high shadowL:val - low open:even ? val + open : val - open close:even ? val - close : val + close icon: [UIImage imageNamed:@"icon"]]]; } - CandleChartDataSet *set1 = [[CandleChartDataSet alloc] initWithValues:yVals1 label:@"Data Set"]; + CandleChartDataSet *set1 = [[CandleChartDataSet alloc] initWithEntries:yVals1 label:@"Data Set"]; set1.axisDependency = AxisDependencyLeft; [set1 setColor:[UIColor colorWithWhite:80/255.f alpha:1.f]]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m index a639f6911d..520770f206 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/ColoredLineChartViewController.m @@ -86,7 +86,7 @@ - (LineChartData *)dataWithCount:(int)count range:(double)range [yVals addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; } - LineChartDataSet *set1 = [[LineChartDataSet alloc] initWithValues:yVals label:@"DataSet 1"]; + LineChartDataSet *set1 = [[LineChartDataSet alloc] initWithEntries:yVals label:@"DataSet 1"]; set1.lineWidth = 1.75; set1.circleRadius = 5.0; diff --git a/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m index 17b661712f..995c419210 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/CombinedChartViewController.m @@ -170,7 +170,7 @@ - (LineChartData *)generateLineData [entries addObject:[[ChartDataEntry alloc] initWithX:index + 0.5 y:(arc4random_uniform(15) + 5)]]; } - LineChartDataSet *set = [[LineChartDataSet alloc] initWithValues:entries label:@"Line DataSet"]; + LineChartDataSet *set = [[LineChartDataSet alloc] initWithEntries:entries label:@"Line DataSet"]; [set setColor:[UIColor colorWithRed:240/255.f green:238/255.f blue:70/255.f alpha:1.f]]; set.lineWidth = 2.5; [set setCircleColor:[UIColor colorWithRed:240/255.f green:238/255.f blue:70/255.f alpha:1.f]]; @@ -202,13 +202,13 @@ - (BarChartData *)generateBarData [entries2 addObject:[[BarChartDataEntry alloc] initWithX:0.0 yValues:@[@(arc4random_uniform(13) + 12), @(arc4random_uniform(13) + 12)]]]; } - BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithValues:entries1 label:@"Bar 1"]; + BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithEntries:entries1 label:@"Bar 1"]; [set1 setColor:[UIColor colorWithRed:60/255.f green:220/255.f blue:78/255.f alpha:1.f]]; set1.valueTextColor = [UIColor colorWithRed:60/255.f green:220/255.f blue:78/255.f alpha:1.f]; set1.valueFont = [UIFont systemFontOfSize:10.f]; set1.axisDependency = AxisDependencyRight; - BarChartDataSet *set2 = [[BarChartDataSet alloc] initWithValues:entries2 label:@""]; + BarChartDataSet *set2 = [[BarChartDataSet alloc] initWithEntries:entries2 label:@""]; set2.stackLabels = @[@"Stack 1", @"Stack 2"]; set2.colors = @[ [UIColor colorWithRed:61/255.f green:165/255.f blue:255/255.f alpha:1.f], @@ -243,7 +243,7 @@ - (ScatterChartData *)generateScatterData [entries addObject:[[ChartDataEntry alloc] initWithX:index + 0.25 y:(arc4random_uniform(10) + 55)]]; } - ScatterChartDataSet *set = [[ScatterChartDataSet alloc] initWithValues:entries label:@"Scatter DataSet"]; + ScatterChartDataSet *set = [[ScatterChartDataSet alloc] initWithEntries:entries label:@"Scatter DataSet"]; set.colors = ChartColorTemplates.material; set.scatterShapeSize = 4.5; [set setDrawValuesEnabled:NO]; @@ -265,7 +265,7 @@ - (CandleChartData *)generateCandleData [entries addObject:[[CandleChartDataEntry alloc] initWithX:index + 1 shadowH:90.0 shadowL:70.0 open:85.0 close:75.0]]; } - CandleChartDataSet *set = [[CandleChartDataSet alloc] initWithValues:entries label:@"Candle DataSet"]; + CandleChartDataSet *set = [[CandleChartDataSet alloc] initWithEntries:entries label:@"Candle DataSet"]; [set setColor:[UIColor colorWithRed:80/255.f green:80/255.f blue:80/255.f alpha:1.f]]; set.decreasingColor = [UIColor colorWithRed:142/255.0 green:150/255.0 blue:175/255.0 alpha:1.0]; set.shadowColor = UIColor.darkGrayColor; @@ -290,7 +290,7 @@ - (BubbleChartData *)generateBubbleData [entries addObject:[[BubbleChartDataEntry alloc] initWithX:index + 0.5 y:y size:size]]; } - BubbleChartDataSet *set = [[BubbleChartDataSet alloc] initWithValues:entries label:@"Bubble DataSet"]; + BubbleChartDataSet *set = [[BubbleChartDataSet alloc] initWithEntries:entries label:@"Bubble DataSet"]; [set setColors:ChartColorTemplates.vordiplom]; set.valueTextColor = UIColor.whiteColor; set.valueFont = [UIFont systemFontOfSize:10.f]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m index e28c5cd642..0d590fbf1c 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/CubicLineChartViewController.m @@ -126,13 +126,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; - set1.values = yVals1; + [set1 replaceEntries:yVals1]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[LineChartDataSet alloc] initWithValues:yVals1 label:@"DataSet 1"]; + set1 = [[LineChartDataSet alloc] initWithEntries:yVals1 label:@"DataSet 1"]; set1.mode = LineChartModeCubicBezier; set1.cubicIntensity = 0.2; set1.drawCirclesEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m index 8ea31b875b..e66840c48e 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/HalfPieChartViewController.m @@ -101,7 +101,7 @@ - (void)setDataCount:(int)count range:(double)range [values addObject:[[PieChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + mult / 5) label:parties[i % parties.count]]]; } - PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithValues:values label:@"Election Results"]; + PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:values label:@"Election Results"]; dataSet.sliceSpace = 3.0; dataSet.selectionShift = 5.0; diff --git a/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m index fea156a249..54899281f1 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/HorizontalBarChartViewController.m @@ -127,13 +127,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; - set1.values = yVals; + [set1 replaceEntries:yVals]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[BarChartDataSet alloc] initWithValues:yVals label:@"DataSet"]; + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"DataSet"]; set1.drawIconsEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m b/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m index 669eb3fdd7..66d62a37d9 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/LineChart1ViewController.m @@ -145,13 +145,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; - set1.values = values; + [set1 replaceEntries: values]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[LineChartDataSet alloc] initWithValues:values label:@"DataSet 1"]; + set1 = [[LineChartDataSet alloc] initWithEntries:values label:@"DataSet 1"]; set1.drawIconsEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m b/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m index 99e7d1ba1b..75eceadef6 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/LineChart2ViewController.m @@ -146,15 +146,15 @@ - (void)setDataCount:(int)count range:(double)range set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; set2 = (LineChartDataSet *)_chartView.data.dataSets[1]; set3 = (LineChartDataSet *)_chartView.data.dataSets[2]; - set1.values = yVals1; - set2.values = yVals2; - set3.values = yVals3; + [set1 replaceEntries:yVals1]; + [set2 replaceEntries:yVals2]; + [set3 replaceEntries:yVals3]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[LineChartDataSet alloc] initWithValues:yVals1 label:@"DataSet 1"]; + set1 = [[LineChartDataSet alloc] initWithEntries:yVals1 label:@"DataSet 1"]; set1.axisDependency = AxisDependencyLeft; [set1 setColor:[UIColor colorWithRed:51/255.f green:181/255.f blue:229/255.f alpha:1.f]]; [set1 setCircleColor:UIColor.whiteColor]; @@ -165,7 +165,7 @@ - (void)setDataCount:(int)count range:(double)range set1.highlightColor = [UIColor colorWithRed:244/255.f green:117/255.f blue:117/255.f alpha:1.f]; set1.drawCircleHoleEnabled = NO; - set2 = [[LineChartDataSet alloc] initWithValues:yVals2 label:@"DataSet 2"]; + set2 = [[LineChartDataSet alloc] initWithEntries:yVals2 label:@"DataSet 2"]; set2.axisDependency = AxisDependencyRight; [set2 setColor:UIColor.redColor]; [set2 setCircleColor:UIColor.whiteColor]; @@ -176,7 +176,7 @@ - (void)setDataCount:(int)count range:(double)range set2.highlightColor = [UIColor colorWithRed:244/255.f green:117/255.f blue:117/255.f alpha:1.f]; set2.drawCircleHoleEnabled = NO; - set3 = [[LineChartDataSet alloc] initWithValues:yVals3 label:@"DataSet 3"]; + set3 = [[LineChartDataSet alloc] initWithEntries:yVals3 label:@"DataSet 3"]; set3.axisDependency = AxisDependencyRight; [set3 setColor:UIColor.yellowColor]; [set3 setCircleColor:UIColor.whiteColor]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m b/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m index 6caf4ebf45..f6ec793465 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/LineChartFilledViewController.m @@ -105,14 +105,14 @@ - (void)setDataCount:(int)count range:(double)range { set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; set2 = (LineChartDataSet *)_chartView.data.dataSets[1]; - set1.values = yVals1; - set2.values = yVals2; + [set1 replaceEntries:yVals1]; + [set2 replaceEntries:yVals2]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[LineChartDataSet alloc] initWithValues:yVals1 label:@"DataSet 1"]; + set1 = [[LineChartDataSet alloc] initWithEntries:yVals1 label:@"DataSet 1"]; set1.axisDependency = AxisDependencyLeft; [set1 setColor:[UIColor colorWithRed:255/255.0 green:241/255.0 blue:46/255.0 alpha:1.0]]; set1.drawCirclesEnabled = NO; @@ -127,7 +127,7 @@ - (void)setDataCount:(int)count range:(double)range return self.chartView.leftAxis.axisMinimum; }]; - set2 = [[LineChartDataSet alloc] initWithValues:yVals2 label:@"DataSet 2"]; + set2 = [[LineChartDataSet alloc] initWithEntries:yVals2 label:@"DataSet 2"]; set2.axisDependency = AxisDependencyLeft; [set2 setColor:[UIColor colorWithRed:255/255.0 green:241/255.0 blue:46/255.0 alpha:1.0]]; set2.drawCirclesEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m b/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m index f279248f99..06e6808f4f 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/LineChartTimeViewController.m @@ -126,13 +126,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (LineChartDataSet *)_chartView.data.dataSets[0]; - set1.values = values; + [set1 replaceEntries: values]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[LineChartDataSet alloc] initWithValues:values label:@"DataSet 1"]; + set1 = [[LineChartDataSet alloc] initWithEntries:values label:@"DataSet 1"]; set1.axisDependency = AxisDependencyLeft; set1.valueTextColor = [UIColor colorWithRed:51/255.0 green:181/255.0 blue:229/255.0 alpha:1.0]; set1.lineWidth = 1.5; diff --git a/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m index 1a17776a2c..ec748b8d24 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/MultipleBarChartViewController.m @@ -155,10 +155,10 @@ - (void)setDataCount:(int)count range:(double)range set2 = (BarChartDataSet *)_chartView.data.dataSets[1]; set3 = (BarChartDataSet *)_chartView.data.dataSets[2]; set4 = (BarChartDataSet *)_chartView.data.dataSets[3]; - set1.values = yVals1; - set2.values = yVals2; - set3.values = yVals3; - set4.values = yVals4; + [set1 replaceEntries:yVals1]; + [set2 replaceEntries:yVals2]; + [set3 replaceEntries:yVals3]; + [set4 replaceEntries:yVals4]; BarChartData *data = _chartView.barData; @@ -171,16 +171,16 @@ - (void)setDataCount:(int)count range:(double)range } else { - set1 = [[BarChartDataSet alloc] initWithValues:yVals1 label:@"Company A"]; + set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:@"Company A"]; [set1 setColor:[UIColor colorWithRed:104/255.f green:241/255.f blue:175/255.f alpha:1.f]]; - set2 = [[BarChartDataSet alloc] initWithValues:yVals2 label:@"Company B"]; + set2 = [[BarChartDataSet alloc] initWithEntries:yVals2 label:@"Company B"]; [set2 setColor:[UIColor colorWithRed:164/255.f green:228/255.f blue:251/255.f alpha:1.f]]; - set3 = [[BarChartDataSet alloc] initWithValues:yVals3 label:@"Company C"]; + set3 = [[BarChartDataSet alloc] initWithEntries:yVals3 label:@"Company C"]; [set3 setColor:[UIColor colorWithRed:242/255.f green:247/255.f blue:158/255.f alpha:1.f]]; - set4 = [[BarChartDataSet alloc] initWithValues:yVals4 label:@"Company D"]; + set4 = [[BarChartDataSet alloc] initWithEntries:yVals4 label:@"Company D"]; [set4 setColor:[UIColor colorWithRed:255/255.f green:102/255.f blue:0/255.f alpha:1.f]]; NSMutableArray *dataSets = [[NSMutableArray alloc] init]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m index c49f762c63..358a7e21eb 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/MultipleLinesChartViewController.m @@ -106,7 +106,7 @@ - (void)setDataCount:(int)count range:(double)range [values addObject:[[ChartDataEntry alloc] initWithX:i y:val]]; } - LineChartDataSet *d = [[LineChartDataSet alloc] initWithValues:values label:[NSString stringWithFormat:@"DataSet %d", z + 1]]; + LineChartDataSet *d = [[LineChartDataSet alloc] initWithEntries:values label:[NSString stringWithFormat:@"DataSet %d", z + 1]]; d.lineWidth = 2.5; d.circleRadius = 4.0; d.circleHoleRadius = 2.0; diff --git a/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m index 0e2703a83d..b87ef62a13 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/NegativeStackedBarChartViewController.m @@ -124,7 +124,7 @@ - (void)setChartData if (_chartView.data.dataSetCount > 0) { set = (BarChartDataSet *)_chartView.data.dataSets[0]; - set.values = yValues; + [set replaceEntries: yValues]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } @@ -137,7 +137,7 @@ - (void)setChartData customFormatter.minimumSignificantDigits = 1; customFormatter.minimumFractionDigits = 1; - set = [[BarChartDataSet alloc] initWithValues:yValues label:@"Age Distribution"]; + set = [[BarChartDataSet alloc] initWithEntries:yValues label:@"Age Distribution"]; set.drawIconsEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m index 5197fcea60..5bc3a9d665 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/PieChartViewController.m @@ -97,7 +97,7 @@ - (void)setDataCount:(int)count range:(double)range [values addObject:[[PieChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + mult / 5) label:parties[i % parties.count] icon: [UIImage imageNamed:@"icon"]]]; } - PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithValues:values label:@"Election Results"]; + PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:values label:@"Election Results"]; dataSet.drawIconsEnabled = NO; diff --git a/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m index 98414e0d80..81f092e9be 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/PiePolylineChartViewController.m @@ -82,7 +82,7 @@ - (void)setDataCount:(int)count range:(double)range [entries addObject:[[PieChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + mult / 5) label:parties[i % parties.count]]]; } - PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithValues:entries label:@"Election Results"]; + PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:entries label:@"Election Results"]; dataSet.sliceSpace = 2.0; // add a lot of colors diff --git a/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m index febad6bbd1..2440fe9e1a 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/PositiveNegativeBarChartViewController.m @@ -149,7 +149,7 @@ - (void)setChartData } } - BarChartDataSet *set = set = [[BarChartDataSet alloc] initWithValues:values label:@"Values"]; + BarChartDataSet *set = set = [[BarChartDataSet alloc] initWithEntries:values label:@"Values"]; set.colors = colors; set.valueColors = colors; diff --git a/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m index 857ea82dca..24cfea5b58 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/RadarChartViewController.m @@ -151,7 +151,7 @@ - (void)setChartData [entries2 addObject:[[RadarChartDataEntry alloc] initWithValue:(arc4random_uniform(mult) + min)]]; } - RadarChartDataSet *set1 = [[RadarChartDataSet alloc] initWithValues:entries1 label:@"Last Week"]; + RadarChartDataSet *set1 = [[RadarChartDataSet alloc] initWithEntries:entries1 label:@"Last Week"]; [set1 setColor:[UIColor colorWithRed:103/255.0 green:110/255.0 blue:129/255.0 alpha:1.0]]; set1.fillColor = [UIColor colorWithRed:103/255.0 green:110/255.0 blue:129/255.0 alpha:1.0]; set1.drawFilledEnabled = YES; @@ -160,7 +160,7 @@ - (void)setChartData set1.drawHighlightCircleEnabled = YES; [set1 setDrawHighlightIndicators:NO]; - RadarChartDataSet *set2 = [[RadarChartDataSet alloc] initWithValues:entries2 label:@"This Week"]; + RadarChartDataSet *set2 = [[RadarChartDataSet alloc] initWithEntries:entries2 label:@"This Week"]; [set2 setColor:[UIColor colorWithRed:121/255.0 green:162/255.0 blue:175/255.0 alpha:1.0]]; set2.fillColor = [UIColor colorWithRed:121/255.0 green:162/255.0 blue:175/255.0 alpha:1.0]; set2.drawFilledEnabled = YES; diff --git a/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m index 1434995699..19a158f640 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/ScatterChartViewController.m @@ -110,15 +110,15 @@ - (void)setDataCount:(int)count range:(double)range [yVals3 addObject:[[ChartDataEntry alloc] initWithX:(double)i + 0.66 y:val]]; } - ScatterChartDataSet *set1 = [[ScatterChartDataSet alloc] initWithValues:yVals1 label:@"DS 1"]; + ScatterChartDataSet *set1 = [[ScatterChartDataSet alloc] initWithEntries:yVals1 label:@"DS 1"]; [set1 setScatterShape:ScatterShapeSquare]; [set1 setColor:ChartColorTemplates.colorful[0]]; - ScatterChartDataSet *set2 = [[ScatterChartDataSet alloc] initWithValues:yVals2 label:@"DS 2"]; + ScatterChartDataSet *set2 = [[ScatterChartDataSet alloc] initWithEntries:yVals2 label:@"DS 2"]; [set2 setScatterShape:ScatterShapeCircle]; set2.scatterShapeHoleColor = ChartColorTemplates.colorful[3]; set2.scatterShapeHoleRadius = 3.5f; [set2 setColor:ChartColorTemplates.colorful[1]]; - ScatterChartDataSet *set3 = [[ScatterChartDataSet alloc] initWithValues:yVals3 label:@"DS 3"]; + ScatterChartDataSet *set3 = [[ScatterChartDataSet alloc] initWithEntries:yVals3 label:@"DS 3"]; [set3 setScatterShape:ScatterShapeCross]; [set3 setColor:ChartColorTemplates.colorful[2]]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m index c945986a36..e64bf3388b 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/SinusBarChartViewController.m @@ -118,13 +118,13 @@ - (void)setDataCount:(int)count if (_chartView.data.dataSetCount > 0) { set = (BarChartDataSet *)_chartView.data.dataSets[0]; - set.values = entries; + [set replaceEntries: entries]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set = [[BarChartDataSet alloc] initWithValues:entries label:@"Sinus Function"]; + set = [[BarChartDataSet alloc] initWithEntries:entries label:@"Sinus Function"]; [set setColor:[UIColor colorWithRed:240/255.f green:120/255.f blue:124/255.f alpha:1.f]]; BarChartData *data = [[BarChartData alloc] initWithDataSet:set]; diff --git a/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m b/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m index 0a572b4cf8..69fb1053bf 100644 --- a/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m +++ b/ChartsDemo-iOS/Objective-C/Demos/StackedBarChartViewController.m @@ -119,13 +119,13 @@ - (void)setDataCount:(int)count range:(double)range if (_chartView.data.dataSetCount > 0) { set1 = (BarChartDataSet *)_chartView.data.dataSets[0]; - set1.values = yVals; + [set1 replaceEntries: yVals]; [_chartView.data notifyDataChanged]; [_chartView notifyDataSetChanged]; } else { - set1 = [[BarChartDataSet alloc] initWithValues:yVals label:@"Statistics Vienna 2014"]; + set1 = [[BarChartDataSet alloc] initWithEntries:yVals label:@"Statistics Vienna 2014"]; set1.drawIconsEnabled = NO; diff --git a/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift index 38891b0c89..abfe17ef3c 100644 --- a/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/AnotherBarChartViewController.swift @@ -70,11 +70,11 @@ class AnotherBarChartViewController: DemoBaseViewController { var set1: BarChartDataSet! = nil if let set = chartView.data?.dataSets.first as? BarChartDataSet { set1 = set - set1?.values = yVals + set1?.replaceEntries(yVals) chartView.data?.notifyDataChanged() chartView.notifyDataSetChanged() } else { - set1 = BarChartDataSet(values: yVals, label: "Data Set") + set1 = BarChartDataSet(entries: yVals, label: "Data Set") set1.colors = ChartColorTemplates.vordiplom() set1.drawValuesEnabled = false diff --git a/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift index a9a629120a..02fc03034a 100644 --- a/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/BarChartViewController.swift @@ -121,11 +121,11 @@ class BarChartViewController: DemoBaseViewController { var set1: BarChartDataSet! = nil if let set = chartView.data?.dataSets.first as? BarChartDataSet { set1 = set - set1.values = yVals + set1.replaceEntries(yVals) chartView.data?.notifyDataChanged() chartView.notifyDataSetChanged() } else { - set1 = BarChartDataSet(values: yVals, label: "The year 2017") + set1 = BarChartDataSet(entries: yVals, label: "The year 2017") set1.colors = ChartColorTemplates.material() set1.drawValuesEnabled = false diff --git a/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift index 61d944b735..b53576fc79 100644 --- a/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/BubbleChartViewController.swift @@ -89,18 +89,18 @@ class BubbleChartViewController: DemoBaseViewController { return BubbleChartDataEntry(x: Double(i), y: val, size: size) } - let set1 = BubbleChartDataSet(values: yVals1, label: "DS 1") + let set1 = BubbleChartDataSet(entries: yVals1, label: "DS 1") set1.drawIconsEnabled = false set1.setColor(ChartColorTemplates.colorful()[0], alpha: 0.5) set1.drawValuesEnabled = true - let set2 = BubbleChartDataSet(values: yVals2, label: "DS 2") + let set2 = BubbleChartDataSet(entries: yVals2, label: "DS 2") set2.drawIconsEnabled = false set2.iconsOffset = CGPoint(x: 0, y: 15) set2.setColor(ChartColorTemplates.colorful()[1], alpha: 0.5) set2.drawValuesEnabled = true - let set3 = BubbleChartDataSet(values: yVals3, label: "DS 3") + let set3 = BubbleChartDataSet(entries: yVals3, label: "DS 3") set3.setColor(ChartColorTemplates.colorful()[2], alpha: 0.5) set3.drawValuesEnabled = true diff --git a/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift index ae2fcc6a89..d8fd334ca0 100644 --- a/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/CandleStickChartViewController.swift @@ -87,7 +87,7 @@ class CandleStickChartViewController: DemoBaseViewController { return CandleChartDataEntry(x: Double(i), shadowH: val + high, shadowL: val - low, open: even ? val + open : val - open, close: even ? val - close : val + close, icon: UIImage(named: "icon")!) } - let set1 = CandleChartDataSet(values: yVals1, label: "Data Set") + let set1 = CandleChartDataSet(entries: yVals1, label: "Data Set") set1.axisDependency = .left set1.setColor(UIColor(white: 80/255, alpha: 1)) set1.drawIconsEnabled = false diff --git a/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift index a5309ea707..a2e105995e 100644 --- a/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/ColoredLineChartViewController.swift @@ -62,7 +62,7 @@ class ColoredLineChartViewController: DemoBaseViewController { return ChartDataEntry(x: Double(i), y: val) } - let set1 = LineChartDataSet(values: yVals, label: "DataSet 1") + let set1 = LineChartDataSet(entries: yVals, label: "DataSet 1") set1.lineWidth = 1.75 set1.circleRadius = 5.0 diff --git a/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift index d3162293a7..e78aadaa96 100644 --- a/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/CombinedChartViewController.swift @@ -126,7 +126,7 @@ class CombinedChartViewController: DemoBaseViewController { return ChartDataEntry(x: Double(i) + 0.5, y: Double(arc4random_uniform(15) + 5)) } - let set = LineChartDataSet(values: entries, label: "Line DataSet") + let set = LineChartDataSet(entries: entries, label: "Line DataSet") set.setColor(UIColor(red: 240/255, green: 238/255, blue: 70/255, alpha: 1)) set.lineWidth = 2.5 set.setCircleColor(UIColor(red: 240/255, green: 238/255, blue: 70/255, alpha: 1)) @@ -151,13 +151,13 @@ class CombinedChartViewController: DemoBaseViewController { return BarChartDataEntry(x: 0, yValues: [Double(arc4random_uniform(13) + 12), Double(arc4random_uniform(13) + 12)]) } - let set1 = BarChartDataSet(values: entries1, label: "Bar 1") + let set1 = BarChartDataSet(entries: entries1, label: "Bar 1") set1.setColor(UIColor(red: 60/255, green: 220/255, blue: 78/255, alpha: 1)) set1.valueTextColor = UIColor(red: 60/255, green: 220/255, blue: 78/255, alpha: 1) set1.valueFont = .systemFont(ofSize: 10) set1.axisDependency = .left - let set2 = BarChartDataSet(values: entries2, label: "") + let set2 = BarChartDataSet(entries: entries2, label: "") set2.stackLabels = ["Stack 1", "Stack 2"] set2.colors = [UIColor(red: 61/255, green: 165/255, blue: 255/255, alpha: 1), UIColor(red: 23/255, green: 197/255, blue: 255/255, alpha: 1) @@ -185,7 +185,7 @@ class CombinedChartViewController: DemoBaseViewController { return ChartDataEntry(x: i+0.25, y: Double(arc4random_uniform(10) + 55)) } - let set = ScatterChartDataSet(values: entries, label: "Scatter DataSet") + let set = ScatterChartDataSet(entries: entries, label: "Scatter DataSet") set.colors = ChartColorTemplates.material() set.scatterShapeSize = 4.5 set.drawValuesEnabled = false @@ -199,7 +199,7 @@ class CombinedChartViewController: DemoBaseViewController { return CandleChartDataEntry(x: Double(i+1), shadowH: 90, shadowL: 70, open: 85, close: 75) } - let set = CandleChartDataSet(values: entries, label: "Candle DataSet") + let set = CandleChartDataSet(entries: entries, label: "Candle DataSet") set.setColor(UIColor(red: 80/255, green: 80/255, blue: 80/255, alpha: 1)) set.decreasingColor = UIColor(red: 142/255, green: 150/255, blue: 175/255, alpha: 1) set.shadowColor = .darkGray @@ -216,7 +216,7 @@ class CombinedChartViewController: DemoBaseViewController { size: CGFloat(arc4random_uniform(50) + 105)) } - let set = BubbleChartDataSet(values: entries, label: "Bubble DataSet") + let set = BubbleChartDataSet(entries: entries, label: "Bubble DataSet") set.setColors(ChartColorTemplates.vordiplom(), alpha: 1) set.valueTextColor = .white set.valueFont = .systemFont(ofSize: 10) diff --git a/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift index 627d13d08d..257be284f1 100644 --- a/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/CubicLineChartViewController.swift @@ -89,7 +89,7 @@ class CubicLineChartViewController: DemoBaseViewController { return ChartDataEntry(x: Double(i), y: val) } - let set1 = LineChartDataSet(values: yVals1, label: "DataSet 1") + let set1 = LineChartDataSet(entries: yVals1, label: "DataSet 1") set1.mode = .cubicBezier set1.drawCirclesEnabled = false set1.lineWidth = 1.8 diff --git a/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift index f820f53dae..541aa6080c 100644 --- a/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/HalfPieChartViewController.swift @@ -80,7 +80,7 @@ class HalfPieChartViewController: DemoBaseViewController { label: parties[i % parties.count]) } - let set = PieChartDataSet(values: entries, label: "Election Results") + let set = PieChartDataSet(entries: entries, label: "Election Results") set.sliceSpace = 3 set.selectionShift = 5 set.colors = ChartColorTemplates.material() diff --git a/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift index 2dbcab9491..850a6b6eab 100644 --- a/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/HorizontalBarChartViewController.swift @@ -100,7 +100,7 @@ class HorizontalBarChartViewController: DemoBaseViewController { return BarChartDataEntry(x: Double(i)*spaceForBar, y: val, icon: #imageLiteral(resourceName: "icon")) } - let set1 = BarChartDataSet(values: yVals, label: "DataSet") + let set1 = BarChartDataSet(entries: yVals, label: "DataSet") set1.drawIconsEnabled = false let data = BarChartData(dataSet: set1) diff --git a/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift b/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift index 6f34b8b763..39b0e0f30a 100644 --- a/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/LineChart1ViewController.swift @@ -113,7 +113,7 @@ class LineChart1ViewController: DemoBaseViewController { return ChartDataEntry(x: Double(i), y: val, icon: #imageLiteral(resourceName: "icon")) } - let set1 = LineChartDataSet(values: values, label: "DataSet 1") + let set1 = LineChartDataSet(entries: values, label: "DataSet 1") set1.drawIconsEnabled = false set1.lineDashLengths = [5, 2.5] diff --git a/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift b/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift index 564d50f66d..dc94f6c65b 100644 --- a/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/LineChart2ViewController.swift @@ -102,7 +102,7 @@ class LineChart2ViewController: DemoBaseViewController { return ChartDataEntry(x: Double(i), y: val) } - let set1 = LineChartDataSet(values: yVals1, label: "DataSet 1") + let set1 = LineChartDataSet(entries: yVals1, label: "DataSet 1") set1.axisDependency = .left set1.setColor(UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)) set1.setCircleColor(.white) @@ -113,7 +113,7 @@ class LineChart2ViewController: DemoBaseViewController { set1.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) set1.drawCircleHoleEnabled = false - let set2 = LineChartDataSet(values: yVals2, label: "DataSet 2") + let set2 = LineChartDataSet(entries: yVals2, label: "DataSet 2") set2.axisDependency = .right set2.setColor(.red) set2.setCircleColor(.white) @@ -124,7 +124,7 @@ class LineChart2ViewController: DemoBaseViewController { set2.highlightColor = UIColor(red: 244/255, green: 117/255, blue: 117/255, alpha: 1) set2.drawCircleHoleEnabled = false - let set3 = LineChartDataSet(values: yVals3, label: "DataSet 3") + let set3 = LineChartDataSet(entries: yVals3, label: "DataSet 3") set3.axisDependency = .right set3.setColor(.yellow) set3.setCircleColor(.white) diff --git a/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift b/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift index 11726e4e4f..7c515c352b 100644 --- a/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/LineChartFilledViewController.swift @@ -72,7 +72,7 @@ class LineChartFilledViewController: DemoBaseViewController { return ChartDataEntry(x: Double(i), y: val) } - let set1 = LineChartDataSet(values: yVals1, label: "DataSet 1") + let set1 = LineChartDataSet(entries: yVals1, label: "DataSet 1") set1.axisDependency = .left set1.setColor(UIColor(red: 255/255, green: 241/255, blue: 46/255, alpha: 1)) set1.drawCirclesEnabled = false @@ -87,7 +87,7 @@ class LineChartFilledViewController: DemoBaseViewController { return CGFloat(self.chartView.leftAxis.axisMinimum) } - let set2 = LineChartDataSet(values: yVals2, label: "DataSet 2") + let set2 = LineChartDataSet(entries: yVals2, label: "DataSet 2") set2.axisDependency = .left set2.setColor(UIColor(red: 255/255, green: 241/255, blue: 46/255, alpha: 1)) set2.drawCirclesEnabled = false diff --git a/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift b/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift index 0ab688ec60..92258e15db 100644 --- a/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/LineChartTimeViewController.swift @@ -99,7 +99,7 @@ class LineChartTimeViewController: DemoBaseViewController { return ChartDataEntry(x: x, y: Double(y)) } - let set1 = LineChartDataSet(values: values, label: "DataSet 1") + let set1 = LineChartDataSet(entries: values, label: "DataSet 1") set1.axisDependency = .left set1.setColor(UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)) set1.lineWidth = 1.5 diff --git a/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift index 93c9f4654b..26d806d5e2 100644 --- a/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/MultipleBarChartViewController.swift @@ -107,16 +107,16 @@ class MultipleBarChartViewController: DemoBaseViewController { let yVals3 = (startYear ..< endYear).map(block) let yVals4 = (startYear ..< endYear).map(block) - let set1 = BarChartDataSet(values: yVals1, label: "Company A") + let set1 = BarChartDataSet(entries: yVals1, label: "Company A") set1.setColor(UIColor(red: 104/255, green: 241/255, blue: 175/255, alpha: 1)) - let set2 = BarChartDataSet(values: yVals2, label: "Company B") + let set2 = BarChartDataSet(entries: yVals2, label: "Company B") set2.setColor(UIColor(red: 164/255, green: 228/255, blue: 251/255, alpha: 1)) - let set3 = BarChartDataSet(values: yVals3, label: "Company C") + let set3 = BarChartDataSet(entries: yVals3, label: "Company C") set3.setColor(UIColor(red: 242/255, green: 247/255, blue: 158/255, alpha: 1)) - let set4 = BarChartDataSet(values: yVals4, label: "Company D") + let set4 = BarChartDataSet(entries: yVals4, label: "Company D") set4.setColor(UIColor(red: 255/255, green: 102/255, blue: 0/255, alpha: 1)) let data = BarChartData(dataSets: [set1, set2, set3, set4]) diff --git a/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift index 4b11f73d28..78a969c698 100644 --- a/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/MultipleLinesChartViewController.swift @@ -78,7 +78,7 @@ class MultipleLinesChartViewController: DemoBaseViewController { } let dataSets = (0..<3).map { i -> LineChartDataSet in let yVals = (0.. 0 ? red : green } - let set = BarChartDataSet(values: yVals, label: "Values") + let set = BarChartDataSet(entries: yVals, label: "Values") set.colors = colors set.valueColors = colors diff --git a/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift b/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift index ffd810749d..c46736f98d 100644 --- a/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift +++ b/ChartsDemo-iOS/Swift/Demos/RadarChartViewController.swift @@ -124,7 +124,7 @@ class RadarChartViewController: DemoBaseViewController { let entries1 = (0.. 0 && values[m - 1].x == xValue + while m > 0 && self[m - 1].x == xValue { m -= 1 } - high = values.endIndex + high = endIndex // loop over all "equal" entries while m < high { - entry = values[m] + entry = self[m] if entry.x == xValue { entries.append(entry) @@ -275,16 +278,16 @@ open class ChartDataSet: ChartBaseDataSet closestToY yValue: Double, rounding: ChartDataSetRounding) -> Int { - var low = values.startIndex - var high = values.endIndex - 1 + var low = startIndex + var high = endIndex - 1 var closest = high while low < high { let m = (low + high) / 2 - let d1 = values[m].x - xValue - let d2 = values[m + 1].x - xValue + let d1 = self[m].x - xValue + let d2 = self[m + 1].x - xValue let ad1 = abs(d1), ad2 = abs(d2) if ad2 < ad1 @@ -320,12 +323,12 @@ open class ChartDataSet: ChartBaseDataSet if closest != -1 { - let closestXValue = values[closest].x + let closestXValue = self[closest].x if rounding == .up { // If rounding up, and found x-value is lower than specified x, and we can go upper... - if closestXValue < xValue && closest < values.endIndex - 1 + if closestXValue < xValue && closest < endIndex - 1 { closest += 1 } @@ -342,20 +345,20 @@ open class ChartDataSet: ChartBaseDataSet // Search by closest to y-value if !yValue.isNaN { - while closest > 0 && values[closest - 1].x == closestXValue + while closest > 0 && self[closest - 1].x == closestXValue { closest -= 1 } - var closestYValue = values[closest].y + var closestYValue = self[closest].y var closestYIndex = closest while true { closest += 1 - if closest >= values.endIndex { break } + if closest >= endIndex { break } - let value = values[closest] + let value = self[closest] if value.x != closestXValue { break } if abs(value.y - yValue) <= abs(closestYValue - yValue) @@ -406,7 +409,6 @@ open class ChartDataSet: ChartBaseDataSet { calcMinMax(entry: e) - isIndirectValuesCall = true if let last = last, last.x > e.x { var closestIndex = entryIndex(x: e.x, closestToY: e.y, rounding: .up) @@ -414,7 +416,7 @@ open class ChartDataSet: ChartBaseDataSet { closestIndex += 1 } - values.insert(e, at: closestIndex) + entries.insert(e, at: closestIndex) } else { @@ -478,7 +480,7 @@ open class ChartDataSet: ChartBaseDataSet { let copy = super.copy(with: zone) as! ChartDataSet - copy.values = values + copy.entries = entries copy._yMax = _yMax copy._yMin = _yMin copy._xMax = _xMax @@ -494,15 +496,15 @@ extension ChartDataSet: MutableCollection { public typealias Element = ChartDataEntry public var startIndex: Index { - return values.startIndex + return entries.startIndex } public var endIndex: Index { - return values.endIndex + return entries.endIndex } public func index(after: Index) -> Index { - return values.index(after: after) + return entries.index(after: after) } @objc @@ -510,12 +512,11 @@ extension ChartDataSet: MutableCollection { get { // This is intentionally not a safe subscript to mirror // the behaviour of the built in Swift Collection Types - return values[position] + return entries[position] } set { - isIndirectValuesCall = true calcMinMax(entry: newValue) - self.values[position] = newValue + entries[position] = newValue } } } @@ -523,47 +524,53 @@ extension ChartDataSet: MutableCollection { // MARK: RandomAccessCollection extension ChartDataSet: RandomAccessCollection { public func index(before: Index) -> Index { - return values.index(before: before) + return entries.index(before: before) } } // MARK: RangeReplaceableCollection extension ChartDataSet: RangeReplaceableCollection { public func append(_ newElement: Element) { - isIndirectValuesCall = true calcMinMax(entry: newElement) - self.values.append(newElement) + entries.append(newElement) } public func remove(at position: Index) -> Element { - let element = self.values.remove(at: position) + let element = entries.remove(at: position) + notifyDataSetChanged() return element } public func removeFirst() -> Element { - let element = self.values.removeFirst() + let element = entries.removeFirst() + notifyDataSetChanged() return element } public func removeFirst(_ n: Int) { - self.values.removeFirst(n) + entries.removeFirst(n) + notifyDataSetChanged() } public func removeLast() -> Element { - let element = self.values.removeLast() + let element = entries.removeLast() + notifyDataSetChanged() return element } public func removeLast(_ n: Int) { - self.values.removeLast(n) + entries.removeLast(n) + notifyDataSetChanged() } public func removeSubrange(_ bounds: R) where R : RangeExpression, Index == R.Bound { - self.values.removeSubrange(bounds) + entries.removeSubrange(bounds) + notifyDataSetChanged() } @objc public func removeAll(keepingCapacity keepCapacity: Bool) { - self.values.removeAll(keepingCapacity: keepCapacity) + entries.removeAll(keepingCapacity: keepCapacity) + notifyDataSetChanged() } } diff --git a/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift b/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift index de4a01fe8c..b53ddd4d05 100644 --- a/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift +++ b/Source/Charts/Data/Implementations/Standard/LineChartDataSet.swift @@ -36,9 +36,9 @@ open class LineChartDataSet: LineRadarChartDataSet, ILineChartDataSet initialize() } - public override init(values: [ChartDataEntry]?, label: String?) + public override init(entries: [ChartDataEntry]?, label: String?) { - super.init(values: values, label: label) + super.init(entries: entries, label: label) initialize() } diff --git a/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift b/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift index 069ebf9789..ac0e63489a 100644 --- a/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift +++ b/Source/Charts/Data/Implementations/Standard/PieChartDataSet.swift @@ -33,9 +33,9 @@ open class PieChartDataSet: ChartDataSet, IPieChartDataSet initialize() } - public override init(values: [ChartDataEntry]?, label: String?) + public override init(entries: [ChartDataEntry]?, label: String?) { - super.init(values: values, label: label) + super.init(entries: entries, label: label) initialize() } diff --git a/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift b/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift index 5cb4560d62..030269d6a2 100644 --- a/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift +++ b/Source/Charts/Data/Implementations/Standard/RadarChartDataSet.swift @@ -26,9 +26,9 @@ open class RadarChartDataSet: LineRadarChartDataSet, IRadarChartDataSet initialize() } - public required override init(values: [ChartDataEntry]?, label: String?) + public required override init(entries: [ChartDataEntry]?, label: String?) { - super.init(values: values, label: label) + super.init(entries: entries, label: label) initialize() } diff --git a/Tests/Charts/BarChartTests.swift b/Tests/Charts/BarChartTests.swift index ccf82993e9..ff7ee7a89b 100644 --- a/Tests/Charts/BarChartTests.swift +++ b/Tests/Charts/BarChartTests.swift @@ -61,7 +61,7 @@ class BarChartTests: FBSnapshotTestCase func setupDefaultDataSet(chartDataEntries: [ChartDataEntry]) -> BarChartDataSet { - let dataSet = BarChartDataSet(values: chartDataEntries, label: "Bar chart unit test data") + let dataSet = BarChartDataSet(entries: chartDataEntries, label: "Bar chart unit test data") dataSet.drawIconsEnabled = false dataSet.iconsOffset = CGPoint(x: 0, y: -10.0) return dataSet diff --git a/Tests/Charts/CombinedChartTests.swift b/Tests/Charts/CombinedChartTests.swift index 269ced6880..bfd9d0d28e 100644 --- a/Tests/Charts/CombinedChartTests.swift +++ b/Tests/Charts/CombinedChartTests.swift @@ -46,7 +46,7 @@ class CombinedChartTests: FBSnapshotTestCase entries.append(BarChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) } - barDataSet = BarChartDataSet(values: entries, label: "Bar chart unit test data") + barDataSet = BarChartDataSet(entries: entries, label: "Bar chart unit test data") barDataSet.drawIconsEnabled = false let data = BarChartData(dataSet: barDataSet) @@ -67,7 +67,7 @@ class CombinedChartTests: FBSnapshotTestCase entries.append(ChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) } - lineDataSet = LineChartDataSet(values: entries, label: "Line chart unit test data") + lineDataSet = LineChartDataSet(entries: entries, label: "Line chart unit test data") lineDataSet.drawIconsEnabled = false return LineChartData(dataSet: lineDataSet) } diff --git a/Tests/Charts/LineChartTests.swift b/Tests/Charts/LineChartTests.swift index 26f69c4b7e..58f57b40e3 100755 --- a/Tests/Charts/LineChartTests.swift +++ b/Tests/Charts/LineChartTests.swift @@ -27,7 +27,7 @@ class LineChartTests: FBSnapshotTestCase entries.append(ChartDataEntry(x: Double(i), y: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) } - dataSet = LineChartDataSet(values: entries, label: "First unit test data") + dataSet = LineChartDataSet(entries: entries, label: "First unit test data") dataSet.drawIconsEnabled = false dataSet.iconsOffset = CGPoint(x: 0, y: 20.0) diff --git a/Tests/Charts/PieChartTests.swift b/Tests/Charts/PieChartTests.swift index 8ff8697daa..9c6685650d 100644 --- a/Tests/Charts/PieChartTests.swift +++ b/Tests/Charts/PieChartTests.swift @@ -25,7 +25,7 @@ class PieChartTests: FBSnapshotTestCase entries.append(PieChartDataEntry(value: value, icon: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil))) } - dataSet = PieChartDataSet(values: entries, label: "First unit test data") + dataSet = PieChartDataSet(entries: entries, label: "First unit test data") dataSet.drawIconsEnabled = false dataSet.iconsOffset = CGPoint(x: 0, y: 20.0)