Closed yl3066882156 closed 5 months ago
参考 demo 中的如下配置示例, 运行查看交互效果:
//https://api.highcharts.com/highcharts/plotOptions.series.marker.states.hover
//https://api.highcharts.com/highcharts/plotOptions.series.events.mouseOver
//https://api.highcharts.com/class-reference/Highcharts.Point#select
//https://github.com/AAChartModel/AAChartKit/issues/1532
+ (AAOptions *)defaultSelectedAPointForLineChart {
AADataElement *defaultPointData = AADataElement.new
.ySet(@29.9)
.selectedSet(@true);
NSArray *dataArr = @[@29.9, @71.5, @106.4, @129.2, @144.0, @176.0, @135.6, @148.5, @216.4, @194.1, @95.6, defaultPointData];
NSInteger defaultPointIndex = dataArr.count - 1;
AAOptions *options = AAOptions.new
.xAxisSet(AAXAxis.new
.categoriesSet(@[@"Jan", @"Feb", @"Mar", @"Apr", @"May", @"Jun", @"Jul", @"Aug", @"Sep", @"Oct", @"Nov", @"Dec"]))
.plotOptionsSet(AAPlotOptions.new
.seriesSet(AASeries.new
.eventsSet(AASeriesEvents.new
.mouseOverSet([NSString stringWithFormat:@AAJSFunc(function () {
if(this.hasRun) return;
var series = this;
var defaultPointIndex = %ld;
if (series.data.length > defaultPointIndex) {
defaultPoint = series.data[defaultPointIndex];
defaultPoint.select(false);
}
this.hasRun = true;
}), (long)defaultPointIndex]))
.allowPointSelectSet(@true)
.markerSet(AAMarker.new
.statesSet(AAMarkerStates.new
.selectSet(AAMarkerSelect.new
.fillColorSet(@"red")
.lineWidthSet(@10)
.lineColorSet(@"yellow")
.radiusSet(@20))))))
.seriesSet(@[
AASeriesElement.new
.dataSet(dataArr)
]);
return options;
}
pod
库.
参考:
但是我滑动时,添加的marker是不会消失的,还是半径5,怎么在滑动时,让他消失,也就是默认选中某个点,而不是我这样手动加上这个点,最终呈现这样的![WechatIMG19](https://github.com/AAChartModel/AAChartKit/assets/17842822/2a85f58c-9470-4be5-b02a-2f5924539234)