Giter VIP home page Giter VIP logo

Comments (4)

AAChartModel avatar AAChartModel commented on June 2, 2024

参考:

from aachartcore.

AAChartModel avatar AAChartModel commented on June 2, 2024

其中主要的参考示例:

此示例的 Java 版本的配置方式如下:

    //https://github.com/AAChartModel/AAChartKit/issues/1324
    //https://github.com/AAChartModel/AAChartKit/issues/1330
    public static AAOptions configureTheAxesLabelsFormattersOfDoubleYAxesChart3() {
        AAChart aaChart = new AAChart()
                .backgroundColor(AAColor.White);

        AATitle aaTitle = new AATitle()
                .text("");

        AAXAxis aaXAxis = new AAXAxis()
                .visible(true)
                .min(0)
                .categories(new String[]{
                        "Java", "Swift", "Python", "Ruby", "PHP", "Go","C",
                        "C#", "C++", "Perl", "R", "MATLAB", "SQL"
                });

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

        AAYAxis yAxis1 = new AAYAxis()
                .visible(true)
                .lineWidth(1)
                .tickPositions(new Object[]{0, 50, 100, 150, 200})
                .labels(new AALabels()
                        .enabled(true)
                        .style(new AAStyle()
                                .color("DodgerBlue"))
                        .formatter("function () {\n" +
                                "       var yValue = this.value;\n" +
                                "       var unitStr = \"\";\n" +
                                "       if (yValue == 0) {\n" +
                                "           unitStr = \"\";\n" +
                                "       }\n" +
                                "       var formattedYValue = (yValue / 1000).toFixed(3) + unitStr;\n" +
                                "       return formattedYValue;\n" +
                                "   }"))//Y轴文字数值为 0 的时候, 不显示单位
                .gridLineWidth(0)
                .title(new AATitle()
                        .text("以「千」为单位")
                        .style(AAStyle.style("DodgerBlue", 14, AAChartFontWeightType.Bold)));

        AAYAxis yAxis2 = new AAYAxis()
                .visible(true)
                .lineWidth(1)
                .tickPositions(new Object[]{0, 50, 100, 150, 200})
                .labels(new AALabels()
                        .enabled(true)
                        .style(new AAStyle()
                                .color(AAColor.Red))
                        .formatter("function () {\n" +
                                "       var yValue = this.value;\n" +
                                "       var unitStr = \"\";\n" +
                                "       if (yValue == 0) {\n" +
                                "           unitStr = \"\";\n" +
                                "       }\n" +
                                "       var formattedYValue = (yValue / 10000).toFixed(4) + unitStr;\n" +
                                "       return formattedYValue;\n" +
                                "   }"))//Y轴文字数值为 0 的时候, 不显示单位
                .gridLineWidth(0)
                .title(new AATitle()
                        .text("以『万』为单位")
                        .style(AAStyle.style(AAColor.Red, 14, AAChartFontWeightType.Bold)))
                .opposite(true)
                ;

        AATooltip aaTooltip = new AATooltip()
                .enabled(true)
                .shared(true);

        AASeriesElement[] seriesArr = {
                new AASeriesElement()
                        .name("2020")
                        .type(AAChartType.Spline)
                        .lineWidth(7)
                        .color(AAGradientColor.DeepSea)
                        .borderRadius(4)
                        .yAxis(1)
                        .data(new Object[]{
                        0, 71.5, 106.4, 129.2, 144.0, 176.0,
                        135.6, 148.5, 216.4, 194.1, 95.6, 54.4
                }),
                new AASeriesElement()
                        .name("2021")
                        .type(AAChartType.Spline)
                        .lineWidth(7)
                        .color(AAGradientColor.Sanguine)
                        .yAxis(0)
                        .data(new Object[]{
                        135.6, 148.5, 216.4, 194.1, 95.6, 54.4,
                        0, 71.5, 106.4, 129.2, 144.0, 176.0
                })
        };

        AAOptions aaOptions = new AAOptions()
                .chart(aaChart)
                .title(aaTitle)
                .plotOptions(aaPlotOptions)
                .xAxis(aaXAxis)
                .yAxisArray(new AAYAxis[]{yAxis1, yAxis2})
                .tooltip(aaTooltip)
                .series(seriesArr);

        return aaOptions;
    }

demo 中有此示例, 下载运行查看即可.

from aachartcore.

AAChartModel avatar AAChartModel commented on June 2, 2024
//https://github.com/AAChartModel/AAChartKit/issues/901
//https://github.com/AAChartModel/AAChartKit/issues/952
public static AAOptions configureTheAxesLabelsFormattersOfDoubleYAxesChart() {
    ...
    ...
}

//https://github.com/AAChartModel/AAChartKit/issues/1324
public static AAOptions configureTheAxesLabelsFormattersOfDoubleYAxesChart2() {
    ...
    ...
}

//https://github.com/AAChartModel/AAChartKit/issues/1324
//https://github.com/AAChartModel/AAChartKit/issues/1330
public static AAOptions configureTheAxesLabelsFormattersOfDoubleYAxesChart3() {
    ...
    ...
}

Java 版本的 demo 中, 这三个是相似关联的双 Y 轴示例, 可对比参考查看.

from aachartcore.

AAChartModel avatar AAChartModel commented on June 2, 2024

2.如何去掉X轴基线

设置 Y 轴轴线的宽度为 0 即可.

from aachartcore.

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.