From bfc932a6348457a022269ea993117c41cc051fe5 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 29 八月 2025 17:47:35 +0800
Subject: [PATCH] 2025年08月29日17:47:33
---
app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java | 79 +++++++++++++++++++++++++++++----------
1 files changed, 59 insertions(+), 20 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java
index bc13392..52419e6 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java
@@ -10,6 +10,7 @@
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartZoomType;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAChart;
+import com.github.AAChartModel.AAChartCore.AAOptionsModel.AADataLabels;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStyle;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AATitle;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AATooltip;
@@ -22,7 +23,7 @@
public class BasicChartComposer {
public static AAChartModel configureBasicOptions() {
return new AAChartModel()
- .backgroundColor("#EDEFF2")
+ .backgroundColor("#1C1C1E")
// .backgroundColor("#4b2b7f")
.dataLabelsEnabled(false)
// .yAxisGridLineWidth(0.5)
@@ -71,12 +72,25 @@
"rgba(56,196,148,0.5)",//娣辩矇鑹�, alpha 閫忔槑搴�1
"rgba(255,255,255,0)"//鐑儏鐨勭矇绾�, alpha 閫忔槑搴� 0.1
);
+ 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();
-// aaStyle.color("#FFFFFFFF");
+ AAStyle aaStyle = new AAStyle();
+ aaStyle.color("#66FFFFFF");
// aaStyle.background("#FF555859");
-
-
+ aaStyle.fontSize(12);
AATooltip aaTooltip = new AATooltip()
.enabled(true)
.backgroundColor(AAColor.rgbaColor(51, 55, 56, 1f))
@@ -86,32 +100,57 @@
.name(tipSuspendName)
// .colorByPoint(true)
.color(AARgba(56, 196, 148, 1.0f))//鐚╃孩鑹�, alpha 閫忔槑搴� 1
-// .lineWidth(1.5)
+ .lineWidth(1.5)
// .borderColor(AARgba(255,255,255,1.0f))
.fillColor(linearGradientColor)
// .fillOpacity(0.5)//鍖哄煙鑳屾櫙閫忔槑搴︼紝璁剧疆0鐨勮瘽鐪嬩笉鍒板尯鍩熻儗鏅�
// .tooltip(aaTooltip)
.data(data);
-// AASeriesElement element2 = new AASeriesElement()
+// 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("#333738")
- .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.15)
- .xAxisVisible(false)
-// .yAxisMax(100)
- .yAxisMin(0)
- .titleStyle(AAStyle.style("#66FFFFFF", 12))//鍧愭爣杞村瓧浣撻鑹�
+ .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鏃讹紝涓轰簡鍜宨os鏍峰紡缁熶竴
+ .yAxisMin(0)
+ .titleStyle(aaStyle)//鍧愭爣杞村瓧浣撻鑹�
+// .axesTextColor("#FFFFFF")//鑳屾櫙棰滆壊
+ .series(new AASeriesElement[]{element1});
+ }
+
}
public static AAChartModel configureStepAreaChartAndStepLineChart() {
--
Gitblit v1.8.0