AAChartKit-Swift
AAChartKit-Swift copied to clipboard
help - 曲线有点问题咨询处理
大佬,有几个曲线图的问题想咨询啊
- 曲线是否能从纵轴开始画曲线过去啊?
- 曲线可以如图红色的线,可以从最顶部直接画线到第一个x轴的坐标呢?
- 当我设置最大值aaOptions.yAxis?.max = 100时,我这个顶部的曲线少了一半的高度私的。 求教啊,下面是我的代码
private func drawChart() {
let gradientColor = AAGradientColor.linearGradient(
direction: .toBottom,
startColor: kHexColor("#00AEEF").toRGBAString(alpha: 0.4),
endColor: kHexColor("#00AEEF").toRGBAString(alpha: 0.0)
)
let chartModel = AAChartModel()
.chartType(.areaspline)
.backgroundColor("#FAFAFA")
// .animationDuration(0) .title("") .subtitle("") .categories(xArr) .xAxisLabelsStyle(AAStyle() .color(AAColor.black) .fontSize(10) .fontWeight(.bold))
.yAxisLabelsStyle(AAStyle()
.color(AAColor.black)
.fontSize(10)
.fontWeight(.bold)
)
.legendEnabled(false)
.tooltipValueSuffix("")
.series([
AASeriesElement()
.name("SOH(%)")
.color("#24C7C7")
.fillColor(gradientColor)
.lineWidth(2)
.marker(AAMarker()
.radius(2)
.symbol(.circle))
.data(yArr)
])
// 2. 转为 AAOptions,修改 tickAmount
let aaOptions = AAOptionsConstructor.configureChartOptions(chartModel)
aaOptions.yAxis?.tickAmount = 1
aaOptions.yAxis?.max = 100
aaOptions.yAxis?.min = 0
aaOptions.yAxis?.gridLineDashStyle(.dash)
aaOptions.yAxis?.lineWidth = 1
// 3. 渲染图表
chartView.scrollEnabled = false
chartView.aa_drawChartWithChartOptions(aaOptions)
}
曲线是否能从纵轴开始画曲线过去啊?
参考:
- https://github.com/AAChartModel/AAChartKit/issues/937
曲线可以如图红色的线,可以从最顶部直接画线到第一个x轴的坐标呢?
完成你前面说的第一步, 如果曲线从纵轴开始画曲线过去, 我怎么感觉你这个需求只是需要一个红色的 Y 轴轴线呢? 如果是这样的话, Y 轴轴线的粗细, 颜色都是可以自定义的, 你在 AAYAxis 这个文件当中可以找到对应的属性.
当我设置最大值aaOptions.yAxis?.max = 100时,我这个顶部的曲线少了一半的高度似的。
参考:
- https://github.com/AAChartModel/AAChartKit-Swift/issues/501
- https://github.com/AAChartModel/AAChartKit/issues/1571