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

如何隐藏”恢复缩放“按钮? #954

Closed
Raysonly opened this issue Jul 24, 2020 · 4 comments
Closed

如何隐藏”恢复缩放“按钮? #954

Raysonly opened this issue Jul 24, 2020 · 4 comments

Comments

@Raysonly
Copy link

@Raysonly Raysonly commented Jul 24, 2020

设置缩放后,可以隐藏”恢复缩放“按钮吗?项目里图表比较小,这个按钮遮挡了很多,如何隐藏掉呢?

@Raysonly
Copy link
Author

@Raysonly Raysonly commented Aug 18, 2020

好吧,更新5.0.3后连设置按钮标题的方法都没了,缩放后变成“Reset zoom”。

@AAChartModel
Copy link
Owner

@AAChartModel AAChartModel commented Aug 18, 2020

配置 AAOptions

//https://github.com/AAChartModel/AAChartKit/issues/199
//https://github.com/AAChartModel/AAChartKit/issues/954
- (AAOptions *)configureCustomStyleTooltipChart {
    AAChartModel *aaChartModel = AAChartModel.new
    .chartTypeSet(AAChartTypeArea)//图表类型
    .titleSet(@"近三个月金价起伏周期图")//图表主标题
    .subtitleSet(@"金价(元/克)")//图表副标题
    .colorsThemeSet(@[@"#FFD700"/*(纯金色)*/,@"#ffc069",@"#06caf4",@"#7dffc0"])//设置主体颜色数组
    .markerSymbolStyleSet(AAChartSymbolStyleTypeBorderBlank)//折线连接点样式为外边缘空白
    .xAxisTickIntervalSet(@15)//x轴刻度点间隔数(设置每隔几个点显示一个 X轴的内容)
    .yAxisGridLineWidthSet(@0.8)//y轴横向分割线宽度(为0即是隐藏分割线)
    .zoomTypeSet(AAChartZoomTypeX)
    .categoriesSet(@[
        @"10-01",@"10-02",@"10-03",@"10-04",@"10-05",@"10-06",@"10-07",@"10-08",@"10-09",@"10-10",@"10-11",
        @"10-12",@"10-13",@"10-14",@"10-15",@"10-16",@"10-17",@"10-18",@"10-19",@"10-20",@"10-21",@"10-22",
        @"10-23",@"10-024",@"10-25",@"10-26",@"10-27",@"10-28",@"10-29",@"10-30",@"10-31",@"11-01",@"11-02",
        @"11-03",@"11-04",@"11-05",@"11-06",@"11-07",@"11-08",@"11-09",@"11-10",@"11-11",@"11-12",@"11-13",
        @"11-14",@"11-15",@"11-16",@"11-17",@"11-18",@"11-19",@"11-20",@"11-21",@"11-22",@"11-23",@"11-024",
        @"11-25",@"11-26",@"11-27",@"11-28",@"11-29",@"11-30",@"12-01",@"12-02",@"12-03",@"12-04",@"12-05",
        @"12-06",@"12-07",@"12-08",@"12-09",@"12-10",@"12-11",@"12-12",@"12-13",@"12-14",@"12-15",@"12-16",
        @"12-17",@"12-18",@"12-19",@"12-20",@"12-21",@"12-22",@"12-23",@"12-024",@"12-25",@"12-26",@"12-27",
        @"12-28",@"12-29",@"12-30"
                   ])
    .seriesSet(@[
        AASeriesElement.new
        .lineWidthSet(@1.5)
        .fillOpacitySet(@0.4)
        .nameSet(@"2021")
        .dataSet(@[
            @1.51, @6.7, @0.94, @1.44, @1.6, @1.63, @1.56, @1.91, @2.45, @3.87, @3.24, @4.90, @4.61, @4.10,
            @4.17, @3.85, @4.17, @3.46, @3.46, @3.55, @3.50, @4.13, @2.58, @2.28,@1.51, @12.7, @0.94, @1.44,
            @18.6, @1.63, @1.56, @1.91, @2.45, @3.87, @3.24, @4.90, @4.61, @4.10, @4.17, @3.85, @4.17, @3.46,
            @3.46, @3.55, @3.50, @4.13, @2.58, @2.28,@1.33, @4.68, @1.31, @1.10, @13.9, @1.10, @1.16, @1.67,
            @2.64, @2.86, @3.00, @3.21, @4.14, @4.07, @3.68, @3.11, @3.41, @3.25, @3.32, @3.07, @3.92, @3.05,
            @2.18, @3.24,@3.23, @3.15, @2.90, @1.81, @2.11, @2.43, @5.59, @3.09, @4.09, @6.14, @5.33, @6.05,
            @5.71, @6.22, @6.56, @4.75, @5.27, @6.02, @5.48
                 ])
               ]);
    
    AAOptions *aaOptions = aaChartModel.aa_toAAOptions;
    
    aaOptions.chart
    .resetZoomButtonSet(AAResetZoomButton.new
                        .themeSet(@{
                            @"display":@"none"//隐藏图表缩放后的默认显示的缩放按钮
                                  }));
    
    /*Custom Tooltip Style --- 自定义图表浮动提示框样式及内容*/
    aaOptions.tooltip
    .useHTMLSet(true)
    .headerFormatSet(@"🌕 🌖 🌗 🌘 🌑 🌒 🌓 🌔 <br>")
    .pointFormatSet(@" Support format properties Just Right Now !!!<br>")
    .footerFormatSet(@"The Gold Price In <b>{series.name}-{point.key}</b> Is &nbsp<b>{point.y}</b>&nbspDollars Per Gram")
    .valueDecimalsSet(@2)//设置取值精确到小数点后几位
    .backgroundColorSet(@"#000000")
    .borderColorSet(@"#000000")
    .styleSet(AAStyleColorSize(@"#FFD700", 12))
    ;
        
    return aaOptions;
}

缩放前

image

缩放后

image

@AAChartModel
Copy link
Owner

@AAChartModel AAChartModel commented Aug 18, 2020

由上可知,隐藏 重置按钮 的关键内容是

    aaOptions.chart
    .resetZoomButtonSet(AAResetZoomButton.new
                        .themeSet(@{
                            @"display":@"none"//隐藏图表缩放后的默认显示的缩放按钮
                                  }));

@AAChartModel
Copy link
Owner

@AAChartModel AAChartModel commented Aug 18, 2020

附言:

pod 'AAChartKit', :git => 'https://github.com/AAChartModel/AAChartKit.git'

如 README 文档所言, 更新 AAChartKit 至最新内容即可使用新对象 AAResetZoomButton

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

Successfully merging a pull request may close this issue.

None yet
2 participants