wjc
2025-05-07 b9cc7390e8e8ce64c41c26fb369c98ce669d660c
app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java
@@ -72,18 +72,19 @@
                "rgba(56,196,148,0.5)",//深粉色, alpha 透明度1
                "rgba(255,255,255,0)"//热情的粉红, alpha 透明度 0.1
        );
//        try {
//            if (data.length > 0) {
//                for (int i = data.length - 1; i >= 0; i--) {
//                    if (!(Double.parseDouble(data[i].toString()) == 0)) {
//                        break;
//                    }
//                    data[i] = null;
//                }
//            }
//        } catch (Exception ignored) {
//
//        }
        boolean isValue = false;
        try {
            if (data.length > 0) {
                for (int i = data.length - 1; i >= 0; i--) {
                    if (!(Double.parseDouble(data[i].toString()) == 0)) {
                        isValue = true;
                        break;
                    }
                }
            }
        } catch (Exception ignored) {
            isValue = true;
        }
        //颜色字符串设置支持十六进制类型和 rgba 类型
        AAStyle aaStyle = new AAStyle();
@@ -109,24 +110,46 @@
//        AASeriesElement element2 = new AASeriesElement();
//                .name("NewYork")
//                .data(new Object[]{0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36});
        return configureBasicOptions()
                .backgroundColor("#1C1C1E")
                .legendEnabled(false)
                .markerRadius(0)
        if (isValue) {
            return configureBasicOptions()
                    .backgroundColor("#1C1C1E")
                    .legendEnabled(false)
                    .markerRadius(0)
//                .markerSymbol(AAChartSymbolType.Circle)
//                .markerSymbolStyle(AAChartSymbolStyleType.Normal)
                .chartType(AAChartType.Area)
                .categories(categories)
                .zoomType(AAChartZoomType.None)//手势缩放
                .yAxisGridLineWidth(0.10)
                .yAxisAllowDecimals(true)
                .xAxisVisible(true)
                .xAxisLineWidth(0)
//                .yAxisMax(100)
                .yAxisMin(0)
                .titleStyle(aaStyle)//坐标轴字体颜色
                    .chartType(AAChartType.Area)
                    .categories(categories)
                    .zoomType(AAChartZoomType.None)//手势缩放
                    .yAxisGridLineWidth(0.10)
                    .yAxisAllowDecimals(true)
                    .xAxisVisible(true)
                    .xAxisLineWidth(0)
//                    .yAxisMax(10)
                    .yAxisMin(0)
                    .titleStyle(aaStyle)//坐标轴字体颜色
//                .axesTextColor("#FFFFFF")//背景颜色
                .series(new AASeriesElement[]{element1});
                    .series(new AASeriesElement[]{element1});
        } else {
            return configureBasicOptions()
                    .backgroundColor("#1C1C1E")
                    .legendEnabled(false)
                    .markerRadius(0)
//                .markerSymbol(AAChartSymbolType.Circle)
//                .markerSymbolStyle(AAChartSymbolStyleType.Normal)
                    .chartType(AAChartType.Area)
                    .categories(categories)
                    .zoomType(AAChartZoomType.None)//手势缩放
                    .yAxisGridLineWidth(0.10)
                    .yAxisAllowDecimals(true)
                    .xAxisVisible(true)
                    .xAxisLineWidth(0)
                    .yAxisMax(10)//都是0时,为了和ios样式统一
                    .yAxisMin(0)
                    .titleStyle(aaStyle)//坐标轴字体颜色
//                .axesTextColor("#FFFFFF")//背景颜色
                    .series(new AASeriesElement[]{element1});
        }
    }