当我吧contentWidth设置成3倍,然后scrolledEabled = yes, 背景色设置成蓝色后,我在最开始的时候向右滑动,左边会有一部分白色底色,请问如何消除
试试设置一下 AAChartView 的背景色
我设置成蓝色了,不管用
那就简单粗暴地直接将图表设置为透明色再试试
还是不可以,我这里贴一下我的源代码,
-(void)drawChart{
CGFloat chartViewWidth = _batteryLife.frame.size.width;
CGFloat chartViewHeight = _batteryLife.frame.size.height+100;
AAChartView *_aaChartView = [[AAChartView alloc]init];
_aaChartView.frame = CGRectMake(0, 200, chartViewWidth, chartViewHeight);
_aaChartView.scrollEnabled = YES;
_batteryLife = _aaChartView;
_currentBattery = [NSNumber numberWithInt:79];
_aaChartView.contentWidth = chartViewWidth * 3;
_batteryLife.backgroundColor = [UIColor redColor];
[self.view addSubview:_batteryLife];
AAChartModel *aaChartModel= AAObject(AAChartModel)
.chartTypeSet(AAChartTypeSpline)//设置图表的类型(这里以设置的为折线面积图为例)
.zoomTypeSet(@"AAChartZoomTypeX")
.backgroundColorSet(@"#00000000")
.categoriesSet(@[@"7-1",@"7-2",@"7-3",@"7-4",@"7-5",@"7-6",@"7-7",@"7-8",@"7-9",@"7-10",@"7-11",@"7-12",@"7-13",@"7-14",@"7-15",@"7-16",@"7-17",@"7-18",@"7-19",@"7-20",@"7-21",@"7-22",@"7-23",])//图表横轴的内容
.seriesSet(@[
AAObject(AASeriesElement)
.nameSet(@"Battery")
.dataSet(@[@50, @80,@77,@57,@64,@33,@99,@26,@40,@45,@34,@66,@75,@46,@85,@55,@69,@38,@19,@40,@24,@89,@89])
]);
你试试不用 contentWidth, 改用 AAChartModel 的 AAScrollablePlotArea 属性来为图表添加滑动效果
@implementation AAScrollablePlotArea
AAPropSetFuncImplementation(AAScrollablePlotArea, NSNumber *, minHeight)
AAPropSetFuncImplementation(AAScrollablePlotArea, NSNumber *, minWidth)
AAPropSetFuncImplementation(AAScrollablePlotArea, NSNumber *, opacity)
AAPropSetFuncImplementation(AAScrollablePlotArea, NSNumber *, scrollPositionX)
AAPropSetFuncImplementation(AAScrollablePlotArea, NSNumber *, scrollPositionY)
@end
Refer to online API document: https://api.highcharts.com/highcharts/chart.scrollablePlotArea
不好意思,我看了highcharts的文档,但还是不太明白怎么调用它的api,我想在aachartmodel里面写.AAScrollablePlotArea/.AAScrollablePlotAreaSet(),但我不太明白()中该怎么写上面你给出的这些minHeight的属性
demo 中有使用示例, 你全局搜索一下
这个问题可以解决的,因为它是集成wkwebview的,需要设置一个属性才可以生效。
_aaChartView.isClearBackgroundColor = NO; _aaChartView.opaque = NO;//必须设置这个值才能生效wkview的背景颜色 _aaChartView.scrollView.backgroundColor = KAPP_subViewBgColor;