You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my UI, I have a segmented control and a chart. I also have 31 days of data. Based on the selected segment of segmented control, I will respectively show 1 day, 7 days and 1 month of data. The segmented control also starts at "1 day" segment.
When user taps on a new segment, I will filter the original datas: self.filteredChartDatas = [self.chartDatas filteredArrayUsingPredicate:predicate];
And then I will construct the data sets for the chart again and then determine the customAxisMax and customAxisMin values for the chart id <IChartDataSet> set = self.vwChart.data.dataSets[0]; CGFloat maximumValue = set.yMax; CGFloat minimumValue = set.yMin;
And then I will redraw the chart [self.vwChart animateWithXAxisDuration:2.5 easingOption:ChartEasingOptionEaseInOutQuart];
Let's say for 1 day, the maximum value and minimum value are 1254.45 and 1252.25
for 7 days, the maximum value and minimum value are 1269.95 and 1227.40
for 1 month, the maximum value and minimum value are 1280.80 and 1203.45
The issue is: the chart starts out displaying correctly:
However when I taps on 7 days, the new chart still used the previous maximum and minimum value for 1 day:
And when I taps on 1 month, the chart used the previous maximum and minimum value for 7 days:
It seems whenever I recalculate the maximum and minimum values and redraw the chart, the chart doesn't update properly and still use the previous maximum and minimum values.
I also don't want to set a universal maximum and minimum values, as it might make 1 day chart meaningless:
May I know how should I change my implementation?
The text was updated successfully, but these errors were encountered:
In my UI, I have a segmented control and a chart. I also have 31 days of data. Based on the selected segment of segmented control, I will respectively show 1 day, 7 days and 1 month of data. The segmented control also starts at "1 day" segment.
When user taps on a new segment, I will filter the original datas:
self.filteredChartDatas = [self.chartDatas filteredArrayUsingPredicate:predicate];
And then I will construct the data sets for the chart again and then determine the customAxisMax and customAxisMin values for the chart
id <IChartDataSet> set = self.vwChart.data.dataSets[0];
CGFloat maximumValue = set.yMax;
CGFloat minimumValue = set.yMin;
ChartYAxis *leftAxis = self.vwChart.leftAxis;
leftAxis.customAxisMax = maximumValue;
leftAxis.customAxisMin = minimumValue;
And then I will redraw the chart
[self.vwChart animateWithXAxisDuration:2.5 easingOption:ChartEasingOptionEaseInOutQuart];
Let's say for 1 day, the maximum value and minimum value are 1254.45 and 1252.25
for 7 days, the maximum value and minimum value are 1269.95 and 1227.40
for 1 month, the maximum value and minimum value are 1280.80 and 1203.45
The issue is: the chart starts out displaying correctly:
However when I taps on 7 days, the new chart still used the previous maximum and minimum value for 1 day:
And when I taps on 1 month, the chart used the previous maximum and minimum value for 7 days:
It seems whenever I recalculate the maximum and minimum values and redraw the chart, the chart doesn't update properly and still use the previous maximum and minimum values.
I also don't want to set a universal maximum and minimum values, as it might make 1 day chart meaningless:
May I know how should I change my implementation?
The text was updated successfully, but these errors were encountered: