Closed btxXiaoXiao closed 1 year ago
- (AAOptions *)configureComplicatedCustomAreasplineChart {
AAChart *aaChart = AAChart.new
.typeSet(AAChartTypeAreaspline)
.backgroundColorSet(AAColor.blackColor);
AATitle *aaTitle = AATitle.new
.textSet((id)NSNull.null);
AAXAxis *aaXAxis = AAXAxis.new
.categoriesSet(@[
@"一月", @"二月", @"三月", @"四月", @"五月", @"六月",
@"七月", @"八月"
])
.tickWidthSet(@0)//X轴刻度线宽度
.lineWidthSet(@1.5)//X轴轴线宽度
.lineColorSet(AAColor.whiteColor)//X轴轴线颜色
.gridLineColorSet(AAColor.whiteColor)
.gridLineWidthSet(@0)//X轴网格线宽度
.gridLineDashStyleSet(AAChartLineDashStyleTypeDash)
.labelsSet(AALabels.new
.styleSet(AAStyle.new
.colorSet(AAColor.whiteColor))//X轴文字颜色
);
AAYAxis *aaYAXis = AAYAxis.new
.titleSet(AAAxisTitle.new
.textSet((id)NSNull.null))
.tickPositionsSet(@[@0, @10, @20, @30, @40, @50, @60, @70, @80, @90, @100])
.lineWidthSet(@1.5)//Y轴轴线颜色
.lineColorSet(AAColor.whiteColor)//Y轴轴线颜色
.gridLineWidthSet(@0.5)//Y轴网格线宽度
.gridLineDashStyleSet(AAChartLineDashStyleTypeSolid)
.labelsSet(AALabels.new
.formatSet(@"{value}")//给y轴添加单位
.styleSet(AAStyle.new
.colorSet(AAColor.whiteColor))//Y轴文字颜色
);
AAPlotOptions *aaPlotOptions = AAPlotOptions.new
.seriesSet(AASeries.new
.markerSet(AAMarker.new
.symbolSet(AAChartSymbolTypeCircle)
.radiusSet(@0)));
aaPlotOptions.series.point.events = AAPointEvents.new
.legendItemClickSet(@AAJSFunc(function() {
return false;
}));
aaPlotOptions.series.events = AAEvents.new
.legendItemClickSet(@AAJSFunc(function() {
return false;
}));
AALegend *aaLegend = AALegend.new
.enabledSet(true)
.itemStyleSet(AAItemStyle.new
.colorSet(AAColor.whiteColor))
.alignSet(AAChartAlignTypeLeft)//设置图例位于水平方向上的右侧
.layoutSet(AAChartLayoutTypeHorizontal)//设置图例排列方式为垂直排布
.verticalAlignSet(AAChartVerticalAlignTypeTop)//设置图例位于竖直方向上的顶部
;
NSArray *blueStopsArr = @[
@[@0.0, AARgbaColor(30, 144, 255, 1.0)],//颜色字符串设置支持十六进制类型和 rgba 类型
@[@0.6, AARgbaColor(30, 144, 255, 0.2)],
@[@1.0, AARgbaColor(30, 144, 255, 0.0)]
];
NSDictionary *gradientBlueColorDic =
[AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToBottom
stopsArray:blueStopsArr];
NSArray *redStopsArr = @[
@[@0.0, AARgbaColor(255, 0, 0, 1.0)],//颜色字符串设置支持十六进制类型和 rgba 类型
@[@0.6, AARgbaColor(255, 0, 0, 0.2)],
@[@1.0, AARgbaColor(255, 0, 0, 0.0)]
];
NSDictionary *gradientRedColorDic =
[AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToBottom
stopsArray:redStopsArr];
AADataElement *singleSpecialData1 = AADataElement.new
.markerSet(AAMarker.new
.radiusSet(@0)//曲线连接点半径
.symbolSet(AAChartSymbolTypeCircle)//曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
.fillColorSet(AAColor.whiteColor)//点的填充色(用来设置折线连接点的填充色)
.lineWidthSet(@0)//外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
//外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)
.lineColorSet(@"#1e90ff")
)
.ySet(@51.5);
AADataElement *singleSpecialData2 = AADataElement.new
.markerSet(AAMarker.new
.radiusSet(@0)//曲线连接点半径
.symbolSet(AAChartSymbolTypeCircle)//曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
.fillColorSet(AAColor.whiteColor)//点的填充色(用来设置折线连接点的填充色)
.lineWidthSet(@0)//外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
//外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)
.lineColorSet(@"#ef476f")
)
.ySet(@26.5);
NSArray *aaSeriesArr = @[
AASeriesElement.new
.nameSet(@"空气湿度")
.fillColorSet((id)gradientBlueColorDic)
.lineWidthSet(@1)
.dataSet(@[@17.0, @16.9, @8.5, @34.5, @28.2, singleSpecialData1, @15.2, @56.5]),
AASeriesElement.new
.nameSet(@"土壤湿度")
.fillColorSet((id)gradientRedColorDic)
.lineWidthSet(@1)
.dataSet(@[@7.0, @6.9, @2.5, @14.5, @18.2, singleSpecialData2, @5.2, @100]),
];
AAOptions *aaOptions = AAOptions.new
.chartSet(aaChart)
.titleSet(aaTitle)
.colorsSet(@[@"#1e90ff",AAColor.redColor,])
.xAxisSet(aaXAxis)
.yAxisSet(aaYAXis)
.plotOptionsSet(aaPlotOptions)
.legendSet(aaLegend)
.seriesSet(aaSeriesArr)
;
return aaOptions;
}
这个是demo赋值。如何取消所有点击呢。纯显示
直接设置 AAChartView
的属性 isUserInteractionEnabled
为 NO
试试
这样写点击曲线图还是存在事件