Skip to content

Commit 8d71842

Browse files
committed
Fix #1571 => add clip property for AASeriesElement
1 parent 49bd2a4 commit 8d71842

File tree

4 files changed

+56
-1
lines changed

4 files changed

+56
-1
lines changed

AAChartKit/AAChartCreator/AASeriesElement.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ AAPropStatementAndPropSetFuncStatement(strong, AASeriesElement, id , reve
9191
AAPropStatementAndPropSetFuncStatement(copy, AASeriesElement, NSString *, id)
9292
AAPropStatementAndPropSetFuncStatement(strong, AASeriesElement, id , connectNulls)
9393
AAPropStatementAndPropSetFuncStatement(strong, AASeriesElement, id , enabledCrosshairs)
94+
AAPropStatementAndPropSetFuncStatement(assign, AASeriesElement, BOOL , clip)
9495

9596
@end
9697

AAChartKit/AAChartCreator/AASeriesElement.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ - (instancetype)init {
4848
_allowPointSelect = false;
4949
_showInLegend = true;
5050
_visible = true;
51+
_clip = true;
5152
}
5253
return self;
5354
}
@@ -97,6 +98,7 @@ - (instancetype)init {
9798
AAPropSetFuncImplementation(AASeriesElement, NSString *, id)
9899
AAPropSetFuncImplementation(AASeriesElement, id , connectNulls)
99100
AAPropSetFuncImplementation(AASeriesElement, id , enabledCrosshairs)
101+
AAPropSetFuncImplementation(AASeriesElement, BOOL , clip)
100102

101103
@end
102104

AAChartKitDemo/Demo/AAChartListVC/MainVC.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ - (NSArray *)chartTypeNameArr {
685685
@"yAxisOnTheRightSideChart---y轴在右侧的图表",
686686
@"configureBoxplotChartWithSpecialStyle---配置盒须图特殊样式",
687687
@"toFixHighchartsWithAThickLineAt0ValuesTheLineIsHalfHidden---修复 Highcharts 在数值为 0 的时候,线条会变粗,但是却被遮挡一半的问题",
688+
@"clipForAASeriesElement---修复线条贴边时,但是却被遮挡一半的问题"
688689
],
689690
/*同时显示多个 AAChartView*/
690691
@[@"Show Two AAChartView On View---同时显示多个 AAChartView",

AAChartKitDemo/Demo/AAOptions/DrawChartWithAAOptionsVC.m

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ - (id)chartConfigurationWithSelectedIndex:(NSUInteger)selectedIndex {
6262
case 13: return [self yAxisOnTheRightSideChart];//y轴在右侧的图表
6363
case 14: return [self configureBoxplotChartWithSpecialStyle];//配置箱线图特殊样式
6464
case 15: return [self toFixHighchartsWithAThickLineAt0ValuesTheLineIsHalfHidden];//修复 Highcharts 在数值为 0 的时候,线条会变粗,但是却被遮挡一半的问题
65-
65+
case 16: return [self clipForAASeriesElement];//修复线条贴边时,但是却被遮挡一半的问题
66+
6667
default:
6768
break;
6869
}
@@ -885,6 +886,56 @@ - (AAOptions *)toFixHighchartsWithAThickLineAt0ValuesTheLineIsHalfHidden {
885886
]);
886887
}
887888

889+
////Highcharts.chart('container', {
890+
//
891+
//title: {
892+
// text: 'Clipping Series'
893+
//},
894+
//
895+
//yAxis: {
896+
// endOnTick: false,
897+
// maxPadding: 0,
898+
// gridLineWidth: 0
899+
//},
900+
//
901+
//series: [{
902+
// name: 'Non clipped series',
903+
// lineWidth: 15,
904+
// type: "area",
905+
// clip: false,
906+
// data: [100, 100, 50, 50, 0, 0]
907+
//}, {
908+
// name: 'Clipped series',
909+
// lineWidth: 15,
910+
//
911+
// data: [0, 0, 50, 50, 100, 100]
912+
//}]
913+
//});
914+
//https://github.com/AAChartModel/AAChartKit/issues/1571#issuecomment-2416086350
915+
- (AAOptions *)clipForAASeriesElement {
916+
AAOptions *aaOptions = AAOptions.new
917+
.chartSet(AAChart.new
918+
.typeSet(AAChartTypeLine))
919+
.titleSet(AATitle.new
920+
.textSet(@"Clipping Series"))
921+
.yAxisSet(AAYAxis.new
922+
.endOnTickSet(false)
923+
// .maxPaddingSet(@0)
924+
.gridLineWidthSet(@0))
925+
.seriesSet(@[
926+
AASeriesElement.new
927+
.nameSet(@"Non clipped series")
928+
.lineWidthSet(@15)
929+
.clipSet(false)
930+
.dataSet(@[@100, @100, @50, @50, @0, @0]),
931+
AASeriesElement.new
932+
.nameSet(@"Clipped series")
933+
.lineWidthSet(@15)
934+
.dataSet(@[@0, @0, @50, @50, @100, @100])
935+
]);
936+
return aaOptions;
937+
}
938+
888939

889940
- (AAOptions *)configureDoubleYAxesAreasplineMixedColumnChart {
890941
AAChart *aaChart = AAChart.new

0 commit comments

Comments
 (0)