AAChartKit icon indicating copy to clipboard operation
AAChartKit copied to clipboard

Demo里有一个问题

Open losedMemory opened this issue 3 years ago • 4 comments

- (AAOptions *)configureCustomStyleTooltipChart {
    AAChartModel *aaChartModel = AAChartModel.new
    .chartTypeSet(AAChartTypeArea)//图表类型
    .titleSet(@"近三个月金价起伏周期图")//图表主标题
    .subtitleSet(@"金价(元/克)")//图表副标题
    .colorsThemeSet(@[@"#FFD700"/*(纯金色)*/,@"#ffc069",@"#06caf4",@"#7dffc0"])//设置主体颜色数组
    .markerSymbolStyleSet(AAChartSymbolStyleTypeBorderBlank)//折线连接点样式为外边缘空白
    .xAxisTickIntervalSet(@15)//x轴刻度点间隔数(设置每隔几个点显示一个 X轴的内容)
    .yAxisGridLineStyleSet([AALineStyle styleWithWidth:@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(@5)//设置取值精确到小数点后几位
    .backgroundColorSet(@"#000000")
    .borderColorSet(@"#000000")
    .styleSet(AAStyleColorSize(@"#FFD700", 12))
    ;
        
    return aaOptions;
}

valueDecimalsSet 设置为5 Tooltip是没有效果的,如果不自定义format就没问题

losedMemory avatar Apr 21 '21 08:04 losedMemory

@losedMemory 你最近在做区块链的项目吗?

AlleniCode avatar Apr 29 '21 09:04 AlleniCode

@AlleniCode 是的,最近在做钱包项目

losedMemory avatar Apr 29 '21 09:04 losedMemory

@losedMemory 😁交流一下,QQ:3500229193

AlleniCode avatar Apr 29 '21 10:04 AlleniCode

valueDecimalsSet 设置为5 Tooltip是没有效果的,如果不自定义format就没问题

估计是因为 Highcharts 内部的 format 属性的优先级高于 valueDecimals 的缘故

AAChartModel avatar Apr 29 '21 10:04 AAChartModel