From 6e7ec3f7ffcab2fbfdf32778970cd72a6845e987 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 26 四月 2024 10:12:11 +0800
Subject: [PATCH] 2024年04月26日10:12:04

---
 app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java |  275 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 254 insertions(+), 21 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
index 3bc0fa3..283afbf 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
@@ -1,14 +1,71 @@
 package com.hdl.photovoltaic.ui.home;
 
 
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.adjustYAxisMaxAndMinValues;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureAreaChartThreshold;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureChartWithShadowStyle;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulColumnChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulDataLabelsStepLineChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulGradientAreaChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulGradientColorChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulGradientSplineChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulShadowSplineChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureDiscontinuousDataChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureGradientColorAreasplineChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureHexagonRadarChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureMaxAndMinDataLabelsForChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureNightingaleRoseChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configurePentagonRadarChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureQuadrangleRadarChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureSpecialStyleColumnForNegativeDataMixedPositiveData;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureSpecialStyleColumnOfSingleDataElementChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureSpecialStyleMarkerOfSingleDataElementChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureTriangleRadarChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.connectNullsForSingleAASeriesElement;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customAreasplineChartWithColorfulGradientColorZones;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customBarChartHoverColorAndSelectColor;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customChartHoverAndSelectHaloStyle;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customColumnChartBorderStyleAndStatesHoverColor;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customLineChartMarkerSymbolContent;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customLineChartWithColorfulMarkersAndLines;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customLineChartWithColorfulMarkersAndLines2;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customNormalStackingChartDataLabelsContentAndStyle;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customScatterChartMarkerSymbolContent;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customSpecialStyleDataLabelOfSingleDataElementChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customSplineChartMarkerStatesHoverStyle;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.disableSomeOfLinesMouseTrackingEffect;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.disableSplineChartMarkerHoverEffect;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.doubleLayerPieChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.drawLineChartWithPointsCoordinates;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.freeStyleRoundedCornersStackingColumnChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.largeDataStackingColumnChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.noMoreGroupingAndNestedColumnChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.noMoreGroupingAndOverlapEachOtherColumnChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.topRoundedCornersStackingColumnChart;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.upsideDownPyramidChart;
+
 import android.content.Intent;
+import android.graphics.Color;
 import android.os.Bundle;
 import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.Toast;
 
+import com.bigkoo.pickerview.builder.TimePickerBuilder;
+import com.bigkoo.pickerview.listener.OnTimeSelectListener;
+import com.bigkoo.pickerview.view.TimePickerView;
 import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel;
 import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView;
 import com.github.AAChartModel.AAChartCore.AAChartCreator.AAMoveOverEventMessageModel;
 import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
+import com.hdl.photovoltaic.R;
 import com.hdl.photovoltaic.base.CustomBaseFragment;
 import com.hdl.photovoltaic.config.ConstantManage;
 import com.hdl.photovoltaic.databinding.FragmentHomePageBinding;
@@ -20,6 +77,11 @@
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
 
+import java.util.Calendar;
+import java.util.Date;
+
+import io.dcloud.common.util.DensityUtils;
+
 /**
  * 棣栭〉妯″潡
  */
@@ -28,9 +90,12 @@
 
     FragmentHomePageBinding viewBinding;
 
-    AAChartView aaChartView;
+    AAChartView aaChartView1;
 
-    AAChartModel aaChartModel;
+    AAChartModel aaChartModel1;
+    AAChartView aaChartView2;
+
+    AAChartModel aaChartModel2;
 
 
     @Override
@@ -41,47 +106,215 @@
 
     @Override
     public void onBindView(Bundle savedInstanceState) {
-        setUpAAChartView();
-        viewBinding.test.setOnClickListener(new View.OnClickListener() {
+        viewBinding.homePageStationDataTitleTv.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                setUpAAChartView(1);
+            }
+        });
+        viewBinding.yearMonthDayTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                timeSelectedView();
 
             }
         });
+        timeSelectedView();
+//        viewBinding.test2.setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                setUpAAChartView(2);
+//            }
+//        });
+
     }
 
-    private void setUpAAChartView() {
-        aaChartView = viewBinding.AAChartView;
-        aaChartView.callBack = this;
-        aaChartModel = configureAAChartModel();
-        aaChartView.aa_drawChartWithChartModel(aaChartModel);
+    private  void timeSelectedView(){
+        //鏃堕棿閫夋嫨鍣�
+        Calendar selectedDate = Calendar.getInstance();
+        Calendar startDate = Calendar.getInstance();
+        //startDate.set(2013,1,1);
+        Calendar endDate = Calendar.getInstance();
+        //endDate.set(2020,1,1);
+
+        //姝g‘璁剧疆鏂瑰紡
+        startDate.set(2024, 1, 1);
+        endDate.set(2025, 4, 25);
+
+        TimePickerView pvTime = new TimePickerBuilder(_mActivity, new OnTimeSelectListener() {
+            @Override
+            public void onTimeSelect(Date date, View v) {//閫変腑浜嬩欢鍥炶皟
+//                        tvTime.setText(getTime(date));
+            }
+        })
+                .setType(new boolean[]{true, false, false, false, false, false})// 榛樿鍏ㄩ儴鏄剧ず
+                .setCancelText("鍙栨秷")//鍙栨秷鎸夐挳鏂囧瓧
+                .setSubmitText("纭畾")//纭鎸夐挳鏂囧瓧
+                .setContentTextSize(18)//婊氳疆鏂囧瓧澶у皬
+                .setTitleSize(18)//鏍囬鏂囧瓧澶у皬
+                .setTitleText("鏃堕棿閫夋嫨")//鏍囬鏂囧瓧
+                .setOutSideCancelable(true)//鐐瑰嚮灞忓箷锛岀偣鍦ㄦ帶浠跺閮ㄨ寖鍥存椂锛屾槸鍚﹀彇娑堟樉绀�
+                .isCyclic(false)//鏄惁寰幆婊氬姩
+                .setTitleColor(_mActivity.getColor(R.color.text_90000000))//鏍囬鏂囧瓧棰滆壊
+                .setSubmitColor(_mActivity.getColor(R.color.text_38C494))//纭畾鎸夐挳鏂囧瓧棰滆壊
+                .setCancelColor(_mActivity.getColor(R.color.text_40000000))//鍙栨秷鎸夐挳鏂囧瓧棰滆壊
+                .setTitleBgColor(_mActivity.getColor(R.color.text_FFFFFFFF))//鏍囬鑳屾櫙棰滆壊 Night mode
+                .setBgColor(_mActivity.getColor(R.color.text_FFFFFFFF))//婊氳疆鑳屾櫙棰滆壊 Night mode
+                .setTextColorCenter(_mActivity.getColor(R.color.text_90000000))
+                .setDate(selectedDate)// 濡傛灉涓嶈缃殑璇濓紝榛樿鏄郴缁熸椂闂�*/
+                .setRangDate(startDate, endDate)//璧峰缁堟骞存湀鏃ヨ瀹�
+                .setLabel("骞�", "鏈�", "鏃�", "鏃�", "鍒�", "绉�")//榛樿璁剧疆涓哄勾鏈堟棩鏃跺垎绉�
+                .isCenterLabel(false) //鏄惁鍙樉绀轰腑闂撮�変腑椤圭殑label鏂囧瓧锛宖alse鍒欐瘡椤筰tem鍏ㄩ儴閮藉甫鏈塴abel銆�
+                .isDialog(false)//鏄惁鏄剧ず涓哄璇濇鏍峰紡
+                .setItemVisibleCount(17)//瀵硅瘽妗嗛珮搴�
+                .setDividerColor(_mActivity.getColor(R.color.text_E1E1E1))
+                .setDecorView(viewBinding.wwwwww)
+//                        .setLineSpacingMultiplier(3f)//
+                .build();
+        pvTime.show();
+    }
+
+    private void setUpAAChartView(int value) {
+        if (value == 1) {
+            aaChartView1 = viewBinding.AAChartView;
+            aaChartView1.callBack = this;
+            aaChartModel1 = configureAAChartModel();
+            aaChartView1.aa_drawChartWithChartModel(aaChartModel1);
+        } else if (value == 2) {
+//            aaChartView2 = viewBinding.AAChartView2;
+            aaChartView2.callBack = this;
+            aaChartModel2 = configureColorfulColumnChart();// configureTheAAChartModel("colorfulColumnChart");
+            aaChartView2.aa_drawChartWithChartModel(aaChartModel2);
+        }
     }
 
     private AAChartModel configureAAChartModel() {
 //        Intent intent = getIntent();
-//        String chartType = intent.getStringExtra("chartType");
-//        int position = intent.getIntExtra("position", 0);
-
-        aaChartModel = BasicChartComposer.configureAreaChart();
-//        configureTheStyleForDifferentTypeChart(chartType, position);
+        String chartType = AAChartType.Area;
+        int position = 0;
+        aaChartModel1 = BasicChartComposer.configureAreaChart();
+        configureTheStyleForDifferentTypeChart(chartType, position);
 //        configureViewsVisibility(chartType);
-
-        return aaChartModel;
+        return aaChartModel1;
     }
 
     private void configureTheStyleForDifferentTypeChart(String chartType, int position) {
         if ((chartType.equals(AAChartType.Area) || chartType.equals(AAChartType.Line))
                 && (position == 4 || position == 5)) {
-            aaChartModel = BasicChartComposer.configureStepAreaChartAndStepLineChart();
+            aaChartModel1 = BasicChartComposer.configureStepAreaChartAndStepLineChart();
         } else if (chartType.equals(AAChartType.Column) || chartType.equals(AAChartType.Bar)) {
 
-            aaChartModel = BasicChartComposer.configureColumnChartAndBarChart();
+            aaChartModel1 = BasicChartComposer.configureColumnChartAndBarChart();
         } else if (chartType.equals(AAChartType.Area) || chartType.equals(AAChartType.Areaspline)) {
-            aaChartModel = BasicChartComposer.configureAreaChartAndAreasplineChartStyle(chartType);
+            aaChartModel1 = BasicChartComposer.configureAreaChartAndAreasplineChartStyle(chartType);
         } else if (chartType.equals(AAChartType.Line) || chartType.equals(AAChartType.Spline)) {
-            aaChartModel = BasicChartComposer.configureLineChartAndSplineChartStyle(chartType);
+            aaChartModel1 = BasicChartComposer.configureLineChartAndSplineChartStyle(chartType);
         }
-        aaChartModel.chartType = chartType;
+        aaChartModel1.chartType = chartType;
+    }
+
+    private AAChartModel configureTheAAChartModel(String chartType) {
+        switch (chartType) {
+            case "colorfulChart":
+                return configureColorfulChart();
+            case "gradientColorfulChart":
+                return configureColorfulGradientColorChart();
+            case "discontinuousDataChart":
+                return configureDiscontinuousDataChart();
+            case "colorfulColumnChart":
+                return configureColorfulColumnChart();
+            case "nightingaleRoseChart":
+                return configureNightingaleRoseChart();
+            case "chartWithShadowStyle":
+                return configureChartWithShadowStyle();
+            case "colorfulGradientAreaChart":
+                return configureColorfulGradientAreaChart();
+            case "colorfulGradientSplineChart":
+                return configureColorfulGradientSplineChart();
+            case "gradientColorAreasplineChart":
+                return configureGradientColorAreasplineChart();
+            case "SpecialStyleMarkerOfSingleDataElementChart":
+                return configureSpecialStyleMarkerOfSingleDataElementChart();
+            case "SpecialStyleColumnOfSingleDataElementChart":
+                return configureSpecialStyleColumnOfSingleDataElementChart();
+            case "AreaChartThreshold":
+                return configureAreaChartThreshold();
+            case "customScatterChartMarkerSymbolContent":
+                return customScatterChartMarkerSymbolContent();
+            case "customLineChartMarkerSymbolContent":
+                return customLineChartMarkerSymbolContent();
+            case "TriangleRadarChart":
+                return configureTriangleRadarChart();
+            case "QuadrangleRadarChart":
+                return configureQuadrangleRadarChart();
+            case "PentagonRadarChart":
+                return configurePentagonRadarChart();
+            case "HexagonRadarChart":
+                return configureHexagonRadarChart();
+            case "adjustYAxisMaxAndMinValues":
+                return adjustYAxisMaxAndMinValues();
+            case "customSpecialStyleDataLabelOfSingleDataElementChart":
+                return customSpecialStyleDataLabelOfSingleDataElementChart();
+            case "customBarChartHoverColorAndSelectColor":
+                return customBarChartHoverColorAndSelectColor();
+            case "customChartHoverAndSelectHaloStyle":
+                return customChartHoverAndSelectHaloStyle();
+            case "customSplineChartMarkerStatesHoverStyle":
+                return customSplineChartMarkerStatesHoverStyle();
+            case "splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle":
+                return splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle();
+            case "customNormalStackingChartDataLabelsContentAndStyle":
+                return customNormalStackingChartDataLabelsContentAndStyle();
+            case "upsideDownPyramidChart":
+                return upsideDownPyramidChart();
+            case "doubleLayerPieChart":
+                return doubleLayerPieChart();
+            case "disableSomeOfLinesMouseTrackingEffect":
+                return disableSomeOfLinesMouseTrackingEffect();
+            case "configureColorfulShadowSplineChart":
+                return configureColorfulShadowSplineChart();
+            case "configureColorfulDataLabelsStepLineChart":
+                return configureColorfulDataLabelsStepLineChart();
+            case "configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart":
+                return configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart();
+            case "disableSplineChartMarkerHoverEffect":
+                return disableSplineChartMarkerHoverEffect();
+            case "configureMaxAndMinDataLabelsForChart":
+                return configureMaxAndMinDataLabelsForChart();
+            case "customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag":
+                return customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag();
+            case "noMoreGroupingAndOverlapEachOtherColumnChart":
+                return noMoreGroupingAndOverlapEachOtherColumnChart();
+            case "noMoreGroupingAndNestedColumnChart":
+                return noMoreGroupingAndNestedColumnChart();
+            case "topRoundedCornersStackingColumnChart":
+                return topRoundedCornersStackingColumnChart();
+            case "freeStyleRoundedCornersStackingColumnChart":
+                return freeStyleRoundedCornersStackingColumnChart();
+            case "customColumnChartBorderStyleAndStatesHoverColor":
+                return customColumnChartBorderStyleAndStatesHoverColor();
+            case "customLineChartWithColorfulMarkersAndLines":
+                return customLineChartWithColorfulMarkersAndLines();
+            case "customLineChartWithColorfulMarkersAndLines2":
+                return customLineChartWithColorfulMarkersAndLines2();
+            case "drawLineChartWithPointsCoordinates":
+                return drawLineChartWithPointsCoordinates();
+            case "configureSpecialStyleColumnForNegativeDataMixedPositiveData":
+                return configureSpecialStyleColumnForNegativeDataMixedPositiveData();
+            case "configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart":
+                return configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart();
+            case "connectNullsForSingleAASeriesElement":
+                return connectNullsForSingleAASeriesElement();
+            case "lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement":
+                return lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement();
+            case "customAreasplineChartWithColorfulGradientColorZones":
+                return customAreasplineChartWithColorfulGradientColorZones();
+            case "largeDataStackingColumnChart":
+                return largeDataStackingColumnChart();
+
+
+        }
+        return configureColorfulChart();
     }
 
     @Override

--
Gitblit v1.8.0