Skip to content

help - 曲线有点问题咨询处理 #550

Description

@chenzefu

大佬,有几个曲线图的问题想咨询啊

  1. 曲线是否能从纵轴开始画曲线过去啊?
  2. 曲线可以如图红色的线,可以从最顶部直接画线到第一个x轴的坐标呢?
  3. 当我设置最大值aaOptions.yAxis?.max = 100时,我这个顶部的曲线少了一半的高度私的。
    求教啊,下面是我的代码

Image

Image

Image

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)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions