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.os.Bundle; import android.view.View; 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.base.CustomBaseFragment; import com.hdl.photovoltaic.config.ConstantManage; import com.hdl.photovoltaic.databinding.FragmentHomePageBinding; import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; /** * 首页模块 */ public class HomePageFragment extends CustomBaseFragment implements AAChartView.AAChartViewCallBack { FragmentHomePageBinding viewBinding; AAChartView aaChartView1; AAChartModel aaChartModel1; AAChartView aaChartView2; AAChartModel aaChartModel2; AAChartView aaChartView3; AAChartModel aaChartModel3; @Override public Object getContentView() { viewBinding = FragmentHomePageBinding.inflate(getLayoutInflater()); return viewBinding.getRoot(); } @Override public void onBindView(Bundle savedInstanceState) { viewBinding.test1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setUpAAChartView(1); } }); viewBinding.test2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setUpAAChartView(2); } }); viewBinding.test3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setUpAAChartView(3); } }); } private void setUpAAChartView(int value) { if (value == 1) { aaChartView1 = viewBinding.AAChartView1; 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); } else if (value == 3) { aaChartView3 = viewBinding.AAChartView3; aaChartView3.callBack = this; aaChartModel3 = configureAAChartModel(); aaChartView3.aa_drawChartWithChartModel(aaChartModel3); } } private AAChartModel configureAAChartModel() { // Intent intent = getIntent(); String chartType = AAChartType.Area; int position = 0; aaChartModel1 = BasicChartComposer.configureAreaChart(); configureTheStyleForDifferentTypeChart(chartType, position); // configureViewsVisibility(chartType); return aaChartModel1; } private void configureTheStyleForDifferentTypeChart(String chartType, int position) { if ((chartType.equals(AAChartType.Area) || chartType.equals(AAChartType.Line)) && (position == 4 || position == 5)) { aaChartModel1 = BasicChartComposer.configureStepAreaChartAndStepLineChart(); } else if (chartType.equals(AAChartType.Column) || chartType.equals(AAChartType.Bar)) { aaChartModel1 = BasicChartComposer.configureColumnChartAndBarChart(); } else if (chartType.equals(AAChartType.Area) || chartType.equals(AAChartType.Areaspline)) { aaChartModel1 = BasicChartComposer.configureAreaChartAndAreasplineChartStyle(chartType); } else if (chartType.equals(AAChartType.Line) || chartType.equals(AAChartType.Spline)) { aaChartModel1 = BasicChartComposer.configureLineChartAndSplineChartStyle(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 public void chartViewDidFinishLoad(AAChartView aaChartView) { } @Override public void chartViewMoveOverEventMessage(AAChartView aaChartView, AAMoveOverEventMessageModel messageModel) { } @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) public void onEventMessage(BaseEventBus eventBus) { super.onEventMessage(eventBus); if (eventBus == null) { return; } //接收外部点击事件 if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) { if (eventBus.getType().equals(HomepageTitleTabSwitch.homepage.toString())) { // 取消粘性事件 EventBus.getDefault().removeStickyEvent(eventBus); HdlLogLogic.print("正在点击【首页】"); } } } }