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

如何设置 x 轴两边的间隙? #637

Closed
bruceWangDev opened this issue May 30, 2019 · 3 comments
Closed

如何设置 x 轴两边的间隙? #637

bruceWangDev opened this issue May 30, 2019 · 3 comments

Comments

@bruceWangDev
Copy link

bruceWangDev commented May 30, 2019

如图所示,我希望可以修改 x 轴左侧和右侧的间隙
2
我发现:当不设置 categories 的时候,默认是没有间隙的,但是一旦设置了 categories ,就会出现在这个间隙。
我尝试使用了 AAOptions - AAXAxis 的 tickmarkPlacement 等相关属性
也尝试了设置 AAYAxis 的 offset ,都没有达到我的预期效果
#577 也是类似的问题

此外,参照 # 537 ,发现曲线图也是类似柱形图的结构 ..
3
但是关于设置两边间隙,还是没有头绪 ..

@bruceWangDev
Copy link
Author

忍不住为作者点个👍

@bruceWangDev bruceWangDev changed the title 如何设置 x 轴左边的间隙? 如何设置 x 轴两边的间隙? May 30, 2019
@AAChartModel
Copy link
Owner

这个确实还没有找到比较好的解决办法

@AAChartModel
Copy link
Owner

不过设置Y轴偏移量勉强算是有点效果吧

  1. 配置AAOptions实例
    AAChartModel *aaChartModel = AAChartModel.new
    .chartTypeSet(AAChartTypeAreaspline)
    .titleSet(@"")
    .subtitleSet(@"")
    .categoriesSet(@[@"一月", @"二月", @"三月", @"四月", @"五月", @"六月",
                     @"七月", @"八月", @"九月", @"十月", @"十一月", @"十二月"])
    .yAxisTitleSet(@"")
    .backgroundColorSet(@"#FFFFFF")
    .markerRadiusSet(@0)
    .yAxisLineWidthSet(@1)
    .yAxisGridLineWidthSet(@0)
    .legendEnabledSet(false)
    .stackingSet(AAChartStackingTypeNormal)
    .easyGradientColorsSet(true)
    .seriesSet(@[
                 AASeriesElement.new
                 .nameSet(@"Tokyo Hot")
                 .colorSet((id)AAGradientColor.deepSeaColor)
                 .dataSet(@[@7.0, @6.9, @2.5, @14.5, @18.2, @21.5, @5.2, @26.5, @23.3, @45.3, @13.9, @9.6]),
                 ]
               );
    
    AAOptions *aaOptions = [AAOptionsConstructor configureChartOptionsWithAAChartModel:aaChartModel];
    
    AAYAxis *aaYAxis = aaOptions.yAxis;
    aaYAxis.offsetSet(@(-15));//设置Y轴偏移量
    
  1. 绘制图形
    [aaChartView aa_drawChartWithOptions:aaOptions];
  1. 图形结果
    image

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

No branches or pull requests

2 participants