ios-charts雷达图表关闭自动缩放

ios-charts雷达图表关闭自动缩放,第1张

概述这两个雷达图表具有相同的橙色位数据点,但灰色不同.但是,正如您所看到的那样,它是自动缩放的,并且橙色位在第二个图表上变得更大,即使它们是完全相同的数据点.有没有办法关闭自动缩放功能?我希望100%也可以直接进入图表的边缘. -(void)setupRadarChart{ self.radarChart.descriptionText = @""; self.radarChart.

这两个雷达图表具有相同的橙色位数据点,但灰色不同.但是,正如您所看到的那样,它是自动缩放的,并且橙色位在第二个图表上变得更大,即使它们是完全相同的数据点.有没有办法关闭自动缩放功能?我希望100%也可以直接进入图表的边缘.

-(voID)setupRadarChart{    self.radarChart.descriptionText = @"";    self.radarChart.weblinewidth = .75;    self.radarChart.innerWeblinewidth = 0.375;    self.radarChart.webAlpha = 1.0;    self.radarChart.userInteractionEnabled = NO;    self.radarChart.xAxis.enabled = YES;    ChartYAxis *yAxis = self.radarChart.yAxis;    yAxis.enabled = NO;    ChartLegend *l = self.radarChart.legend;    l.position = ChartLegendpositionBelowChartleft;    l.Font = [UIFont systemFontOfSize:UI_USER_INTERFACE_IdioM() == UIUserInterfaceIdiomPad ? 12 : (headerWIDth/40)];    [self seTradarData];}- (voID)seTradarData{    NSMutableArray *partIEs = [[NSMutableArray alloc] init];    for (PillarModel *m in [DataManager sharedData].pillars)    {        [partIEs addobject:m.abbreviation];    }    NSMutableArray *yVals2 = [[NSMutableArray alloc] init];    NSMutableArray *benchMark = [[NSMutableArray alloc] init];    BOol shouldAdd = YES;    for (PillarModel *pillar in [DataManager sharedData].pillars)    {    int totalPillarscore = (int)[[DataManager sharedData] getTotalscorePossible:[[DataManager sharedData] getIndivIDualQuestionResultsForPillar:pillar.pillarID]];        if ((isCompany ? [[DataManager sharedData] getCompanyscoresForcategory:pillar] : [[DataManager sharedData] getIndivIDualscoreForcategory:pillar.pillarID]) != 0)        {            shouldAdd = NO;        }        if (pillar.pillarID == numberOfPillars -1 && shouldAdd) {            [yVals2 addobject:[[ChartDataEntry alloc] initWithValue:0.01 xIndex:pillar.pillarID]];        }        else{            double val = (isCompany ? (double)[[DataManager sharedData] getCompanyscoresForcategory:pillar]/totalPillarscore                                                                                : (double)[[DataManager sharedData] getIndivIDualscoreForcategory:pillar.pillarID] / totalPillarscore);            [yVals2 addobject:[[ChartDataEntry alloc] initWithValue:val xIndex:pillar.pillarID]];        }        float pillarBenchMark = [[[[[DataManager sharedData].benchmarkJsONDict objectForKey:hightlightedVIEw.lowercaseString] objectForKey:pillar.Title] objectForKey:@"pillar"] intValue];        float ifNoBenchMarkThanCompanyscore = (pillarBenchMark ? pillarBenchMark : (isCompany ? [[DataManager sharedData] getIndivIDualscoreForcategory:pillar.pillarID]: [[DataManager sharedData] getCompanyscoresForcategory:pillar]));        [benchMark addobject:[[ChartDataEntry alloc] initWithValue:ifNoBenchMarkThanCompanyscore/totalPillarscore xIndex:pillar.pillarID]];    }    NSMutableArray *xVals = [[NSMutableArray alloc] init];    for (int i = 0; i < numberOfPillars; i++)    {        [xVals addobject:partIEs[i % partIEs.count]];    }    Nsstring *label = (isCompany ? @"Company score" : @"Your score");    RadarChartDataSet *set2 = [[RadarChartDataSet alloc] initWithYVals:yVals2 label:label];    [set2 setcolor:[DataManager sharedData].maincolor];    set2.drawFilledEnabled = YES;    set2.fillAlpha = 1.0f;    set2.linewidth = 2.0;    RadarChartDataSet *benchMarkSet = [[RadarChartDataSet alloc] initWithYVals:benchMark label:@"Benchmark"];    [benchMarkSet setcolor:[UIcolor colorWithRed:125/255.0f green:125/255.0f blue:125/255.0f Alpha:0.6f]];    benchMarkSet.drawFilledEnabled = YES;    benchMarkSet.fillAlpha = 0.0f;    benchMarkSet.linewidth = 2.0;    benchMarkSet.highlightlineDashLengths = @[[NSNumber numberWithInt:2]];    benchMarkSet.highlightlineDashPhase = 2;    RadarChartData *data = [[RadarChartData alloc] initWithXVals:xVals dataSets:@[set2,benchMarkSet]];    [data setValueFont:[UIFont FontWithname:@"HelveticaNeue-light" size:8.f]];    [data setDrawValues:NO];    self.radarChart.data = data;}
解决方法 孙博弘发布的答案不正确,但它让我意识到这是多么容易解决.这解决了自动缩放问题,现在也到了边缘.

self.radarChart.yAxis.customAxisMin = 0;self.radarChart.yAxis.customAxisMax = 1;
总结

以上是内存溢出为你收集整理的ios-charts雷达图表关闭自动缩放全部内容,希望文章能够帮你解决ios-charts雷达图表关闭自动缩放所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1029644.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存