Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当y轴数值都为0时,如何让y轴的0刻度线不在中间 #773

Closed
Libogold opened this issue Nov 5, 2019 · 6 comments
Closed

当y轴数值都为0时,如何让y轴的0刻度线不在中间 #773

Libogold opened this issue Nov 5, 2019 · 6 comments
Labels

Comments

@Libogold
Copy link

Libogold commented Nov 5, 2019

.seriesSet(@[
                 AASeriesElement.new
                 .nameSet(@"2017")
                 .dataSet(@[@0, @0, @0, @0
                 ]);

dataset 都为0时让y轴0刻度线和x轴重合,

@NoLiuxin
Copy link

NoLiuxin commented Dec 12, 2019

AAOptions *aaOptions = [AAOptionsConstructor configureChartOptionsWithAAChartModel:self.aaChartModel];
//设置刻度线个数
aaOptions.yAxis.tickAmount = @6;
//设置是否允许Y轴显示小数
aaOptions.yAxis.allowDecimals = NO;

这样设置后也不需要计算Y轴的刻度尺了。
都为0也会不在中间了,可以试一试

@AAChartModel
Copy link
Owner

   aaOptions.yAxis
    .minSet(@0)
    .minRangeSet(@1)

@AAChartModel
Copy link
Owner

配置 AAOptions

- (AAOptions *)customChartStyleWhenEveryDataValueIsZero {
    AAChartModel *aaChartModel= AAChartModel.new
    .chartTypeSet(AAChartTypeAreaspline)
    .titleSet(@"Custom Chart Style When Every Data Value Is 0")
    .categoriesSet(@[
        @"Java", @"Swift", @"Python", @"Ruby", @"PHP", @"Go",@"C",
        @"C#", @"C++", @"Perl", @"R", @"SQL"])
    .yAxisTitleSet(@"摄氏度 (℃)")
    .seriesSet(@[
        AASeriesElement.new
        .nameSet(@"Tokyo Hot")
        .dataSet(@[@0, @0, @0, @0, @0, @0, @0, @0, @0, @0, @0, @0, ]),
    ]);
    
    AAOptions *aaOptions = [AAOptionsConstructor configureChartOptionsWithAAChartModel:aaChartModel];

    aaOptions.yAxis
    .minSet(@0)
    .minRangeSet(@1);
    
    return aaOptions;
}

折线图图表效果

image

@NextTesla
Copy link

@AAChartModel 作者你好,尝试了设置
aaOptions.yAxis .minSet(@0) .minRangeSet(@1)
在AAChartTypeAreaspline下有效果,但在AAChartTypeLine下没有效果

@AAChartModel
Copy link
Owner

AAChartModel commented May 7, 2020

@AAChartModel 作者你好,尝试了设置
aaOptions.yAxis .minSet(@0) .minRangeSet(@1)
在AAChartTypeAreaspline下有效果,但在AAChartTypeLine下没有效果

已在最新提交中解决, 按照 README 文档中所说, 将pod 更新至最新内容的 AAChartKit 即可.

@NextTesla
Copy link

@AAChartModel 👍非常感谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants