AAChartCore icon indicating copy to clipboard operation
AAChartCore copied to clipboard

Android版本中,可滚动的图表且添加值域分割颜色线,折线只绘制了部分,虽然点击可以看到有数据,但线段没有绘制出来

Open chugengdu opened this issue 3 years ago • 2 comments

void setUpAAPlotLinesChartView() {
        AAChartView aaChartView = findViewById(R.id.aa_chart_view);
        AASeriesElement[] configurePlotLinesChartSeriesArray = configurePlotLinesChartSeriesArray();

        AAChartModel aaChartModel = new AAChartModel()
                .chartType(AAChartType.Line)
                .title("流式荧光检测")
                .subtitle("实验数据")
                .backgroundColor("#ffffff")
                .categories(new String[]{})
                .dataLabelsEnabled(false)
                .yAxisGridLineWidth(0f)
                .yAxisTitle("电压值(V)")
                .zoomType(AAChartZoomType.X)
                .scrollablePlotArea(new AAScrollablePlotArea()
                        .minWidth(8000)
                        .scrollPositionX(0f))
                .series(configurePlotLinesChartSeriesArray);




        AAPlotLinesElement[] aaPlotLinesElementsArr = {
                new AAPlotLinesElement()
                        .color("#1e90ff")//颜色值(16进制)
                        .dashStyle(AAChartLineDashStyleType.LongDashDotDot)//样式:Dash,Dot,Solid等,默认Solid
                        .width((1f)) //标示线粗细
                        .value((1.4f)) //所在位置
                        .zIndex((1)) //层叠,标示线在图表中显示的层叠级别,值越大,显示越向前
                        .label(new AALabel()
                        .useHTML(true)
                        .text("分割线1")
                        .style(new AAStyle()
                                .color("#FFD700")
                                .backgroundColor("black")
                                .borderRadius(5)
                                .border("3px solid #000000")
                                .opacity(1.0)
                                .fontWeight(AAChartFontWeightType.Bold)
                        )
                )
                ,
                new AAPlotLinesElement()
                        .color("#ef476f")//颜色值(16进制)
                        .dashStyle(AAChartLineDashStyleType.LongDashDot)//样式:Dash,Dot,Solid等,默认Solid
                        .width((1f)) //标示线粗细
                        .value((2.2f)) //所在位置
                        .zIndex((1)) //层叠,标示线在图表中显示的层叠级别,值越大,显示越向前
                        .label(new AALabel()
                        .useHTML(true)
                        .text("分割线2")
                        .style(new AAStyle()
                                .color("red")
                                .backgroundColor("black")
                                .borderRadius(5)
                                .border("3px solid red")
                                .opacity(1.0)
                                .fontWeight(AAChartFontWeightType.Bold)))
        };

        AAOptions aaOptions = AAOptionsConstructor.INSTANCE.configureChartOptions(aaChartModel);
        AAYAxis aaYAxis = aaOptions.getYAxis();

        assert aaYAxis != null;
        aaYAxis.plotLines(aaPlotLinesElementsArr);

        aaChartView.aa_drawChartWithChartOptions(aaOptions);
//        aaChartView.aa_drawChartWithChartModel(aaChartModel);
    }

    private AASeriesElement[] configurePlotLinesChartSeriesArray() {
        Map map1 = new HashMap();
        map1.put("value", 1.4);
        map1.put("color", "#1e90ff");
        Map map2 = new HashMap();
        map2.put("value", 2.2);
        map2.put("color", "#ef476f");
        Map map3 = new HashMap();
        map3.put("color", "#ffd066");
        Map[] zonesArr = new Map[]{map1, map2, map3};
        return new AASeriesElement[]{
                new AASeriesElement()
                        .name("第一次数据")
                        .data(InputFileReader.toArrayByInputStreamReader(this, R.raw.b))
//                        .fillOpacity(0.5f)
//                        .lineWidth(2f)
                        .zones(zonesArr)
        };
    }

上面是我的代码,下面是运行的截图 Screenshot_20220504_194248 InputFileReader.toArrayByInputStreamReader(this, R.raw.b)函数是读取我本地的txt处理后返回double数组

求帮助!

chugengdu avatar May 04 '22 11:05 chugengdu

尴尬了, 这貌似是 Highcharts 自身的一个 bug, 官方至今也没有及时修复.

参考Highcharts 官方仓库的这个相同问题:

  • https://github.com/highcharts/highcharts/issues/14541

AAChartModel avatar May 04 '22 12:05 AAChartModel

Run the demo: https://jsfiddle.net/BlackLabel/f91Lam5b/show (iOS 14+ and Chrome (86.0.4240.93) browser)

看官方回复, iOS 14 + and Chrome (86.0.4240.93) 应该都有这个问题. 我提了这个问题已经两年了, 也没有解决 🤷🏻‍♀️

AAChartModel avatar May 04 '22 12:05 AAChartModel