Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whether to support dual Y axis #51

Closed
byron-xie opened this issue Jan 25, 2021 · 3 comments
Closed

Whether to support dual Y axis #51

byron-xie opened this issue Jan 25, 2021 · 3 comments
Labels

Comments

@byron-xie
Copy link

No description provided.

@AAChartModel
Copy link
Owner

refer to AAChartModel/AAChartKit#759

@AAChartModel
Copy link
Owner

refer to AAChartModel/AAChartKit#763

@AAChartModel
Copy link
Owner

Kotlin Version

configure chart options

   fun configureDoubleYAxisChartOptions(): AAOptions {
            val aaTitle = AATitle()
                .text("")

            val aaXAxis = AAXAxis()
                .visible(true)
                .min(0f)
                .categories(arrayOf("Java", "Swift", "Python", "Ruby", "PHP", "Go","C",
                        "C#", "C++", "Perl", "R", "MATLAB", "SQL"))

            val aaYAxisTitleStyle = AAStyle()
                .color("#1e90ff")//Title font color
                .fontSize(14f)//Title font size
                .fontWeight(AAChartFontWeightType.Bold)//Title font weight
                .textOutline("0px 0px contrast")

            val aaYAxisLabels = AALabels()
                .enabled(true)//设置 y 轴是否显示数字
                .style(AAStyle()
                        .color("#ff0000")//yAxis Label font color
                        .fontSize(15f)//yAxis Label font size
                        .fontWeight(AAChartFontWeightType.Bold))//yAxis Label font weight


            val yAxisOne = AAYAxis()
                .visible(true)
                .labels(aaYAxisLabels)
                .title(AATitle()
                        .text("冬季降雨量")
                        .style(aaYAxisTitleStyle))
                .opposite(true)


            val yAxisTwo = AAYAxis()
                .visible(true)
                .labels(aaYAxisLabels)
                .title(AATitle()
                        .text("夏季降雨量")
                        .style(aaYAxisTitleStyle))

            val aaTooltip = AATooltip()
                .enabled(true)
                .shared(true)

            val gradientColorDic1 = AAGradientColor.linearGradient(
                AALinearGradientDirection.ToTop,
                "#f54ea2",
                "#ff7676"//颜色字符串设置支持十六进制类型和 rgba 类型
            )

            val gradientColorDic2 = AAGradientColor.linearGradient(
                AALinearGradientDirection.ToTop,
                "#17ead9",
                "#6078ea"//颜色字符串设置支持十六进制类型和 rgba 类型
            )

            val aaMarker = AAMarker()
                .radius(7f)//曲线连接点半径,默认是4
                .symbol(AAChartSymbolType.Circle.value)//曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
                .fillColor("#ffffff")//点的填充色(用来设置折线连接点的填充色)
                .lineWidth(3f)//外沿线的宽度(用来设置折线连接点的轮廓描边的宽度)
                .lineColor("")//外沿线的颜色(用来设置折线连接点的轮廓描边颜色,当值为空字符串时,默认取数据点或数据列的颜色)

            val element1 = AASeriesElement()
                .name("2017")
                .type(AAChartType.Areaspline)
                //          .borderRadius(4)
                .color(gradientColorDic1)
                .marker(aaMarker)
                .yAxis(1)
                .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))

            val element2 = AASeriesElement()
                .name("2018")
                .type(AAChartType.Column)
                .color(gradientColorDic2)
                .yAxis(0)
                .data(arrayOf(7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6))


            return AAOptions()
                .title(aaTitle)
                .xAxis(aaXAxis)
                .yAxisArray(arrayOf(yAxisOne, yAxisTwo))
                .tooltip(aaTooltip)
                .series(arrayOf(element1, element2))
        }

final chart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants