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

如何实现x轴滚动时y轴跟着滚动? #1261

Open Shannon-Yang opened 2 years ago

Shannon-Yang commented 2 years ago

如何实现在x的数据滚动时,y轴的数据也跟着滚动,类似这种图表,在滑动x轴时,y轴的数据随着x轴的数据进行滚动,图如下: IMG_0016

AAChartModel commented 2 years ago

试试AAChartView 中的下面这个方法


/// Update the X axis Extremes
/// @param min X axis minimum
/// @param max X axis maximum
- (void)aa_updateXAxisExtremesWithMin:(NSUInteger)min max:(NSUInteger)max;

看看是否能满足需求, demo 中有示例

Shannon-Yang commented 2 years ago

试试AAChartView 中的下面这个方法

/// Update the X axis Extremes
/// @param min X axis minimum
/// @param max X axis maximum
- (void)aa_updateXAxisExtremesWithMin:(NSUInteger)min max:(NSUInteger)max;

看看是否能满足需求, demo 中有示例

我设置了,不行,我设置了scrollPositionX和scrollPositionY,仅仅只有一个轴能滚动,x或者y,不能两则同时滚动,现在想实现当x轴滚动时,y轴也跟着滚动

Shannon-Yang commented 2 years ago

追加问题:请问是否可以设置AAChartView的bounces属性,回弹效果不是我想要的,我通过设置

self.chartView.scrollView.showsVerticalScrollIndicator = false
self.chartView.scrollView.showsHorizontalScrollIndicator = false
self.chartView.scrollView.bounces = false

但好像没有起作用

AAChartModel commented 2 years ago

现在想实现当x轴滚动时,y轴也跟着滚动

这个功能恐怕不支持, 我一开始以为你只是想让 Y 轴的值能够跟着变化

AAChartModel commented 2 years ago

追加问题:请问是否可以设置AAChartView的bounces属性,回弹效果不是我想要的

可以使用 AAChartView 的直接禁用滚动效果属性

/// Set the chart view can scroll or not
@property (nonatomic, assign) BOOL scrollEnabled;