AAChartKit icon indicating copy to clipboard operation
AAChartKit copied to clipboard

Y轴点顶部偶现一条线

Open wangxuewen opened this issue 10 months ago • 5 comments

Image

wangxuewen avatar Apr 16 '25 01:04 wangxuewen

能贴一下控制台输出的 json 配置代码吗? 方便我在 demo 中复现一下问题

AAChartModel avatar Apr 16 '25 03:04 AAChartModel

还有机型和 iOS 系统版本号

AAChartModel avatar Apr 16 '25 03:04 AAChartModel

机型:iphone12 系统:16.0.3 json配置代码以及测试数据

// 折线图对应线段的颜色集合
    NSArray *xPositins11 = @[@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23"];
    NSArray *yvalues11 = @[@0,@0,@0,@0,@0,@0,@0,@0,@0,@0,@1.22,@1.68,@0.96,@0.25,@0.04,@0,@0,@0,@0,@0,@0,@0,@0,@0];
    NSMutableArray *mZonesSet = [NSMutableArray arrayWithCapacity:0];
    NSMutableArray *mYValyeArray = [NSMutableArray arrayWithCapacity:0];
    for (NSInteger i = 0; i < yvalues11.count; i++) {
        if (i < 20) {
            [mZonesSet addObject:AAZonesElement.new
                            .valueSet(@(i + 1))
             .colorSet(AARgbaColor(56, 196, 148, 1.0))
             .fillColorSet((id)[AAGradientColor gradientColorWithStartColorString:AARgbaColor(255, 255, 255, 0) endColorString:AARgbaColor(56, 196, 148, 0.8)])];
            [mYValyeArray addObject:yvalues11[i]];
        } else {
            [mZonesSet addObject:AAZonesElement.new
                            .valueSet(@(i + 1))
             .colorSet(AARgbaColor(28, 28, 30, 1.0))
             .fillColorSet((id)[AAGradientColor gradientColorWithStartColorString:AARgbaColor(28, 28, 30, 1.0) endColorString:AARgbaColor(28, 28, 30, 1.0)])];
            [mYValyeArray addObject:@0];
        }
    }
    
    
    
    AAChartModel *model = AAChartModel.new
    .chartTypeSet(AAChartTypeArea)
    .categoriesSet(xPositins11)
    .markerRadiusSet(@0.0)  // marker点半径为0个像素
    .animationDurationSet(@800)
    .xAxisTickIntervalSet(@2)
    .xAxisLabelsStyleSet(AAStyle.new.colorSet(AARgbaColor(255, 255, 255, 0.4)))
    .yAxisLabelsStyleSet(AAStyle.new.colorSet(AARgbaColor(255, 255, 255, 0.4)))
    .yAxisLineWidthSet(@0)
    .yAxisVisibleSet(true)
    .yAxisGridLineStyleSet([AALineStyle styleWithColor:@"#484B4C" dashStyle:@"solid" width:@0.5])//y轴横向分割线宽度为0(即是隐藏分割线)
    .legendEnabledSet(false)
    .tooltipEnabledSet(true)//是否可以点击
    .seriesSet(@[
        AASeriesElement.new
        .nameSet(self.seriesName)
        .lineWidthSet(@1.0)
//        .colorSet(AARgbaColor(56, 196, 148, 0.4))
//        .fillColorSet((id)[AAGradientColor gradientColorWithStartColorString:AARgbaColor(255, 255, 255, 0) endColorString:AARgbaColor(56, 196, 148, 0.4)])
        .markerSet(AAMarker.new
                   .statesSet(AAMarkerStates.new
                              .hoverSet(AAMarkerHover.new
                                        .radiusSet(@0)
                                        .lineWidthSet(@0))))
        .dataSet(yvalues11)
        .zoneAxisSet(AAChartZoneAxisTypeX)
        .zonesSet(mZonesSet)
    ])
    .yAxisPlotLinesSet(@[   // Y轴提示线
        AAPlotLinesElement.new
        .dashStyleSet(AAChartLineDashStyleTypeSolid)
        .colorSet(AARgbColor(72, 75, 76))
        .widthSet(@(0.5)) //标示线粗细
        .valueSet(@(0)) //所在位置
        .zIndexSet(@(5)) //层叠,标示线在图表中显示的层叠级别,值越大,显示越向前
    ])
    .yAxisMaxSet(@(2));

wangxuewen avatar Apr 16 '25 03:04 wangxuewen

@AAChartModel 你好,这个问题一些特定的情况才会出现,帮忙看一下

wangxuewen avatar Apr 21 '25 01:04 wangxuewen

测试了一下你的代码, 在 iPhone 真机和模拟器上都没有复现出来, 有点难搞了

AAChartModel avatar Apr 22 '25 01:04 AAChartModel