From a034e242fe844a1ca45d2a28710cb7face1f8fe6 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期日, 28 四月 2024 19:07:56 +0800
Subject: [PATCH] 2024年04月28日19:07:49
---
app/src/main/java/com/hdl/photovoltaic/ui/home/BasicChartComposer.java | 114 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 96 insertions(+), 18 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/BasicChartComposer.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/BasicChartComposer.java
index f8ec05a..54fbb8a 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/home/BasicChartComposer.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/BasicChartComposer.java
@@ -1,11 +1,15 @@
package com.hdl.photovoltaic.ui.home;
+import static com.github.AAChartModel.AAChartCore.AATools.AAColor.AARgba;
+
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel;
import com.github.AAChartModel.AAChartCore.AAChartCreator.AASeriesElement;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartAnimationType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartSymbolStyleType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartSymbolType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
+import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStyle;
+import com.github.AAChartModel.AAChartCore.AATools.AAColor;
import com.github.AAChartModel.AAChartCore.AATools.AAGradientColor;
import com.github.AAChartModel.AAChartCore.AATools.AALinearGradientDirection;
@@ -14,30 +18,85 @@
public class BasicChartComposer {
public static AAChartModel configureBasicOptions() {
return new AAChartModel()
- .backgroundColor("#ffffff")//#4b2b7f
+ .backgroundColor("#EDEFF2")
+// .backgroundColor("#4b2b7f")
.dataLabelsEnabled(false)
- .yAxisGridLineWidth(0)
+ .yAxisGridLineWidth(1)
.touchEventEnabled(true);
}
public static AAChartModel configureAreaChart() {
+ Map<String, Object> linearGradientColor = AAGradientColor.linearGradient(
+ AALinearGradientDirection.ToBottom,
+ "rgba(56,196,148,0.5)",//娣辩矇鑹�, alpha 閫忔槑搴�1
+ "rgba(255,255,255,0)"//鐑儏鐨勭矇绾�, alpha 閫忔槑搴� 0.1
+ );//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷
AASeriesElement element1 = new AASeriesElement()
.name("Tokyo")
- .data(new Object[]{7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6});
- AASeriesElement element2 = new AASeriesElement()
- .name("NewYork")
- .data(new Object[]{0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5});
- AASeriesElement element3 = new AASeriesElement()
- .name("London")
- .data(new Object[]{0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0});
- AASeriesElement element4 = new AASeriesElement()
- .name("Berlin")
- .data(new Object[]{3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8});
+// .colorByPoint(true)
+ .color(AARgba(56, 196, 148, 1.0f))//鐚╃孩鑹�, alpha 閫忔槑搴� 1
+ .lineWidth(1.5)
+// .borderColor(AARgba(255,255,255,1.0f))
+ .fillColor(linearGradientColor)
+// .fillOpacity(0.5)//鍖哄煙鑳屾櫙閫忔槑搴︼紝璁剧疆0鐨勮瘽鐪嬩笉鍒板尯鍩熻儗鏅�
+ .data(new Object[]{0, 20, 30, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6});
+// AASeriesElement element2 = new AASeriesElement()
+// .name("NewYork")
+// .data(new Object[]{0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5});
+// AASeriesElement element3 = new AASeriesElement()
+// .name("London")
+// .data(new Object[]{0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0});
+// AASeriesElement element4 = new AASeriesElement()
+// .name("Berlin")
+// .data(new Object[]{3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8});
return configureBasicOptions()
+ .backgroundColor("#EDEFF2")
+ .legendEnabled(false)
+ .markerRadius(0)
+// .markerSymbol(AAChartSymbolType.Circle)
+// .markerSymbolStyle(AAChartSymbolStyleType.Normal)
.chartType(AAChartType.Area)
- .categories(new String[]{"Java","Swift","Python","Ruby", "PHP","Go","C","C#","C++"})
- .series(new AASeriesElement[]{element1, element2, element3, element4});
+ .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"})
+ .series(new AASeriesElement[]{element1});
+ }
+
+ public static AAChartModel configureAreaChart(String tipSuspendName, String[] categories, Object[] data) {
+ Map<String, Object> linearGradientColor = AAGradientColor.linearGradient(
+ AALinearGradientDirection.ToBottom,
+ "rgba(56,196,148,0.5)",//娣辩矇鑹�, alpha 閫忔槑搴�1
+ "rgba(255,255,255,0)"//鐑儏鐨勭矇绾�, alpha 閫忔槑搴� 0.1
+ );//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷
+ AASeriesElement element1 = new AASeriesElement()
+ .name(tipSuspendName)
+// .colorByPoint(true)
+ .color(AARgba(56, 196, 148, 1.0f))//鐚╃孩鑹�, alpha 閫忔槑搴� 1
+ .lineWidth(1.5)
+// .borderColor(AARgba(255,255,255,1.0f))
+ .fillColor(linearGradientColor)
+// .fillOpacity(0.5)//鍖哄煙鑳屾櫙閫忔槑搴︼紝璁剧疆0鐨勮瘽鐪嬩笉鍒板尯鍩熻儗鏅�
+ .data(data);
+// AASeriesElement element2 = new AASeriesElement()
+// .name("NewYork")
+// .data(new Object[]{0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5});
+// AASeriesElement element3 = new AASeriesElement()
+// .name("London")
+// .data(new Object[]{0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0});
+// AASeriesElement element4 = new AASeriesElement()
+// .name("Berlin")
+// .data(new Object[]{3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8});
+
+ return configureBasicOptions()
+ .backgroundColor("#EDEFF2")
+ .legendEnabled(false)
+ .markerRadius(0)
+// .markerSymbol(AAChartSymbolType.Circle)
+// .markerSymbolStyle(AAChartSymbolStyleType.Normal)
+ .chartType(AAChartType.Area)
+ .categories(categories)
+// .yAxisMax(500)
+ .yAxisMin(0)
+ .series(new AASeriesElement[]{element1});
}
public static AAChartModel configureStepAreaChartAndStepLineChart() {
@@ -68,18 +127,37 @@
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
})
.legendEnabled(true)
- .colorsTheme(new String[]{"#fe117c","#ffc069","#06caf4","#7dffc0"})
+ .colorsTheme(new String[]{"#fe117c", "#ffc069", "#06caf4", "#7dffc0"})
.animationType(AAChartAnimationType.EaseOutCubic)
.animationDuration(1200);
}
public static AAChartModel configureAreaChartAndAreasplineChartStyle(String chartType) {
+ String[] colorsArr = {
+ AAColor.Red,
+ AAColor.Orange,
+ AAColor.Red,
+ AAColor.Green,
+ AAColor.Red,
+ AAColor.Blue,
+ AAColor.Red,
+ AAColor.Gray,
+ AAColor.DarkGray,
+ AAColor.LightGray,
+ AAColor.Magenta,
+ AAColor.Brown,
+ AAColor.Black,
+ };
AAChartModel aaChartModel = configureAreaChart()
.animationType(AAChartAnimationType.EaseOutQuart)
.legendEnabled(true)
- .markerRadius(6)
- .markerSymbol(AAChartSymbolType.Circle)
- .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank);
+ .markerRadius(0)
+ .markerSymbolStyle(AAChartSymbolStyleType.Normal)
+// .markerSymbol(AAChartSymbolType.Circle)
+ .tooltipValueSuffix("Kw.h")
+// .colorsTheme(colorsArr)
+ .legendEnabled(false);
+
if (chartType.equals(AAChartType.Areaspline)) {
Map<String, Object> gradientColorDic = AAGradientColor.linearGradient(
--
Gitblit v1.8.0