此图表允许您
并且它可以
DHDynamicLineChart
拖入您的项目,并在您的文件中导入DHDynamicLineChart.h
#import "DHDynamicLineChart.h"
CoreGraphic
库添加到您的项目中。 _xAxisLabels = @[@"125",@"250",@"500",@"1000",@"2000",@"4000",@"8000",@"10000"];//Label titles
_yAxisLabels = @[@"0",@"-20",@"-40",@"-60",@"-80",@"-100",@"-120",@"-140"];
_positions = @[@0,@(1.0/7),@(2.0/7),@(3.0/7),@(4.0/7),@(5.0/7),@(6.0/7),@1];
_myLineChart = [[DHDynamicLineChart alloc] initWithXAxisLabelTitles:_xAxisLabels
yAxisLabelTitles:_yAxisLabels
controlPointsByXRatios:_positions
direction:DHDyanmicChartDirectionDown];//Facing up or down.
//Set grid line and line...
[self.view addSubview:_myLineChart];
_positions
数组通过x轴的比率指示控制位置。
[self.myLineChart refreshLineChartWithYRatio:yRatio atIndex:index];
or
[self.myLineChart refreshLineChartWithYRatios:yRatios];
“索引”指示控制点的顺序。“yRatio”表示“实际值”/“最大值”([0,1])。
//X
[self.myLineChart updateWithXAxisLabelTitles:xNewYLabels];
//Y
[self.myLineChart updateWithXAxisLabelTitles:yNewYLabels];
//Or
[self.myLineChart updateWithXAxisLabelTitles:xNewlabels
YAxisLabelTitles:yNewLabels
controlPointsByXRatios:newControlXRatios
direction:newDirection
animated:YES
completion:nil];
[self.myLineChart updateWithControlPointsByXRatios:xNewRatios];
[self.myLineChart switchDirectionAnimated:YES completion:^(DHDynamicLineChart * _Nonnull chart) {
//Do some additional settings with 'chart'.
}];
此存储库受MIT许可协议的约束。