AAChartModel / AAChartKit

📈📊🚀🚀🚀An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的现代化声明式数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
https://cocoapods.org/pods/AAChartKit
MIT License
4.72k stars 751 forks source link

如何修改Y轴之间的间距,让曲线幅度较大。 #1470

Closed 13662049573 closed 1 year ago

13662049573 commented 1 year ago

假如我有三个数据 78,79,80 ,现在的曲线幅度不是很大,Y轴的间距默认好像是1 ,所以看不到很大的幅度曲线效果,现在问题,如何去修改Y轴之间的曲线幅度大小,修改后的效果看到曲线就是一条下滑很大曲线幅度,Y轴间距也很大。麻烦一下。

AAChartModel commented 1 year ago

你这个问题通过调整 Y 轴的最大值和最小值来解决, 参考:

示例代码如下:

//https://github.com/AAChartModel/AAChartKit/issues/519
- (AAChartModel *)adjustYAxisMaxAndMinValues {
    NSArray *categoriesArr = @[
        @"孤岛危机",
        @"使命召唤",
        @"荣誉勋章",
        @"狙击精英",
        @"神秘海域",
        @"最后生还者",
        @"巫师3狂猎",
        @"对马之魂",
        @"蝙蝠侠阿甘骑士",
        @"地狱边境",
        @"闪客",
        @"忍者之印"
    ];

    return AAChartModel.new
    .chartTypeSet(AAChartTypeAreaspline)
    .legendEnabledSet(false)
    .yAxisVisibleSet(true)
    .markerRadiusSet(@6)
    .markerSymbolStyleSet(AAChartSymbolStyleTypeInnerBlank)
    .zoomTypeSet(AAChartZoomTypeXY)
    .tooltipValueSuffixSet(@"kg")
    .categoriesSet(categoriesArr)
    .yAxisMinSet(@2.0)
    .yAxisMaxSet(@45.4)
    .xAxisTickIntervalSet(@2)
    .seriesSet(@[
        AASeriesElement.new
        .nameSet(@"体重")
        .colorSet(@"#2494F3")
        .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])
               ]);
}
13662049573 commented 1 year ago

你可能没有理解我的意思,不是你说的最大值和最小值问题

13662049573 commented 1 year ago

你可能没有理解我的意思,不是你说的最大值和最小值问题

13662049573 commented 1 year ago

IMG_2AC66510A30A-1 麻烦你看看了,需求是这样的

AAChartModel commented 1 year ago

参考 HighchartsY 轴属性 tickInterval 在线 API:

对应的 AAChartKit 中的 AAYAxis 属性:

AAPropStatementAndPropSetFuncStatement(strong, AAYAxis, NSNumber *, tickInterval) 
AAChartModel commented 1 year ago

另外还可以查看这个 Y 轴的这个 tickPositions 属性

对应的 AAChartKit 中的 AAYAxis 属性:

AAPropSetFuncImplementation(AAYAxis, NSArray  *, tickPositions) //自定义Y轴坐标(如:[@(0), @(25), @(50), @(75) , (100)])