GithubHelp home page GithubHelp logo

Comments (3)

AAChartModel avatar AAChartModel commented on May 22, 2024

refer to AAChartModel/AAChartKit#759

from aachartcore-kotlin.

AAChartModel avatar AAChartModel commented on May 22, 2024

refer to AAChartModel/AAChartKit#763

from aachartcore-kotlin.

AAChartModel avatar AAChartModel commented on May 22, 2024

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

from aachartcore-kotlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.