From a5e2676c2d9888adab490fc5bbaa0e74a712d90a Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 24 四月 2024 18:28:49 +0800 Subject: [PATCH] 2024年04月24日18:28:38 --- app/src/main/res/drawable/home_page_unselected.png | 0 app/src/main/res/drawable/add.png | 0 app/src/main/res/drawable/power_station_selected.png | 0 app/src/main/res/values/styles.xml | 21 app/src/main/res/drawable/station_status_no_ffffff.xml | 5 app/src/main/res/drawable/message_selected.png | 0 app/src/main/java/com/hdl/photovoltaic/ui/home/CustomStyleChartComposer.java | 2106 ++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/com/hdl/photovoltaic/ui/home/AAChartSymbolConst.java | 11 app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java | 224 ++++ app/src/main/res/drawable/home_page_selected.png | 0 app/src/main/res/layout/fragment_home_page.xml | 300 +++++ app/src/main/java/com/hdl/photovoltaic/ui/home/BasicChartComposer.java | 72 + app/src/main/res/drawable/power_station_unselected.png | 0 app/build.gradle | 2 app/src/main/res/layout/item_station.xml | 34 app/src/main/res/drawable/info_1.png | 0 app/src/main/res/drawable/me_selected.png | 0 app/src/main/res/drawable/me_unselected.png | 0 app/src/main/java/com/hdl/photovoltaic/HDLApp.java | 43 app/src/main/res/drawable/message_unselected.png | 0 app/src/main/res/drawable/disc.png | 0 app/src/main/res/drawable/bj_13_ffffff.xml | 8 app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java | 24 app/src/main/res/layout/item_data.xml | 28 app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java | 7 app/src/main/java/com/hdl/photovoltaic/base/CustomBaseActivity.java | 7 app/src/main/res/drawable/station_status_sele_38c494.xml | 5 27 files changed, 2,824 insertions(+), 73 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dbad74c..b3cb011 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -141,7 +141,7 @@ //Eventbus浜嬩欢鍙戝竷涓庢帴鏀� implementation 'org.greenrobot:eventbus:3.3.1' - //灞忓箷閫傞厤 + //灞忓箷閫傞厤搴� implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1' //鍥剧墖鍔犺浇搴� diff --git a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java index 3011dbc..592295c 100644 --- a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java +++ b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java @@ -1,10 +1,13 @@ package com.hdl.photovoltaic; +import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.os.SystemClock; import android.text.TextUtils; +import android.util.Log; import androidx.multidex.MultiDex; @@ -46,6 +49,9 @@ import cn.jpush.android.api.JPushInterface; import io.dcloud.common.util.RuningAcitvityUtil; +import me.jessyan.autosize.AutoSizeConfig; +import me.jessyan.autosize.onAdaptListener; +import me.jessyan.autosize.utils.ScreenUtils; import okhttp3.logging.HttpLoggingInterceptor; public class HDLApp extends Application { @@ -67,11 +73,12 @@ @Override public void onCreate() { super.onCreate(); - + // 鑾峰彇褰撳墠杩涚▼鐨凱ID + Log.d("杩涚▼===", android.os.Process.myPid() + ""); mHDLApp = this; SharedPreUtils.init(this); getAppLanguage(); - initThirdSDK(); + init(); // appLocationInfo(); } @@ -117,7 +124,7 @@ /** * 鍒濆鍖栦笁鏂圭浉鍏砈DK */ - public void initThirdSDK() { + public void init() { // 灏忕▼搴忚繘绋� if (RuningAcitvityUtil.getAppName(getBaseContext()).contains(":")) { return; @@ -137,6 +144,7 @@ // TypeUtils.compatibleWithFieldName = true; // //9.鍒濆鍖栫綉缁滃伐鍏� // NetWorkUtil.init(this); + initAutoSize(); //鍒濆鍖栨瀬鍏夋帹閫� initJPush(); initHDLLinkPMSdk(); @@ -210,7 +218,7 @@ SystemClock.sleep(200); initDCUniMPSDK(); Intent intent = new Intent(getInstance(), HomeLoginActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); if (type == 1) { intent.putExtra("isJpush", true); } @@ -299,6 +307,33 @@ } + /** + * 钃濇箹涓� 淇敼瀹藉害 640dp 瀹藉害鎸夌収dp銆乻p鏉ラ�傞厤 + * 鏃嬭浆鍚庨珮鍙樺,鎸夋棆杞悗楂樺害閫傞厤,鎵�浠ュ搴︿笉鍐欐 + */ + private void initAutoSize() { + boolean isBaseOnWidth = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; + AutoSizeConfig.getInstance() + .setBaseOnWidth(isBaseOnWidth) + .setUseDeviceSize(false) + .setDesignWidthInDp(isBaseOnWidth ? 375 : 812) + .setDesignHeightInDp(isBaseOnWidth ? 812 : 375) + .setOnAdaptListener(new onAdaptListener() { + @Override + public void onAdaptBefore(Object target, Activity activity) { + + AutoSizeConfig.getInstance().setScreenWidth(ScreenUtils.getScreenSize(activity)[0]); + AutoSizeConfig.getInstance().setScreenHeight(ScreenUtils.getScreenSize(activity)[1] + + ScreenUtils.getHeightOfNavigationBar(activity) + ScreenUtils.getStatusBarHeight()); + + } + + @Override + public void onAdaptAfter(Object target, Activity activity) { + + } + }); + } /** * 鍒濆鍖杣ni app mqtt diff --git a/app/src/main/java/com/hdl/photovoltaic/base/CustomBaseActivity.java b/app/src/main/java/com/hdl/photovoltaic/base/CustomBaseActivity.java index 47d5c03..abecc76 100644 --- a/app/src/main/java/com/hdl/photovoltaic/base/CustomBaseActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/base/CustomBaseActivity.java @@ -9,6 +9,7 @@ import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.utils.LocalManageUtil; +import com.jaeger.library.StatusBarUtil; import java.util.Locale; @@ -23,6 +24,12 @@ } + // 灏哠tatusBar璁剧疆涓洪�忔槑 + public void setStatusBarTranslucent() { + StatusBarUtil.setTranslucentForImageViewInFragment(this, + 0, null); + StatusBarUtil.setLightMode(this); + } /** * 淇敼鐘舵�佹爮瀛椾綋棰滆壊锛堥粦鑹诧級 diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java index 93216ae..511cd4e 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java @@ -564,12 +564,7 @@ viewBinding.homeLoginPasswordEt.removeTextChangedListener(passwordTextWatcher); } - // 灏哠tatusBar璁剧疆涓洪�忔槑 - public void setStatusBarTranslucent() { - StatusBarUtil.setTranslucentForImageViewInFragment(this, - 0, null); - StatusBarUtil.setLightMode(this); - } + } \ No newline at end of file diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java index b2418b9..2e3cb7c 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java @@ -263,52 +263,52 @@ viewBinding.myPowerStationFcv1.setVisibility(View.GONE);//鏄剧ず鐢电珯鐣岄潰 viewBinding.myMessageFcv2.setVisibility(View.GONE);//闅愯棌娑堟伅鐣岄潰 viewBinding.myMeFcv3.setVisibility(View.GONE);//闅愯棌鎴戠殑鐣岄潰 - viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.selectedpowerstation)); + viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.home_page_selected)); viewBinding.myPowerStationBottomIl0.titleTv.setTextColor(getColor(R.color.text_90000000)); - viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedpowerstation)); + viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.power_station_unselected)); viewBinding.myPowerStationBottomIl1.titleTv.setTextColor(getColor(R.color.text_65000000)); viewBinding.myMessageBottomIl2.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.message_unselected)); viewBinding.myMessageBottomIl2.titleTv.setTextColor(getColor(R.color.text_65000000)); - viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedme)); + viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.me_unselected)); viewBinding.myMeBottomIl3.titleTv.setTextColor(getColor(R.color.text_65000000)); } else if (this.currentFragmentIndex == 1) { viewBinding.myHomePageFcv0.setVisibility(View.GONE);//闅愯棌棣栭〉鐣岄潰 viewBinding.myPowerStationFcv1.setVisibility(View.VISIBLE);//鏄剧ず鐢电珯鐣岄潰 viewBinding.myMessageFcv2.setVisibility(View.GONE);//闅愯棌娑堟伅鐣岄潰 viewBinding.myMeFcv3.setVisibility(View.GONE);//闅愯棌鎴戠殑鐣岄潰 - viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedpowerstation)); + viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.home_page_unselected)); viewBinding.myPowerStationBottomIl0.titleTv.setTextColor(getColor(R.color.text_65000000)); - viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.selectedpowerstation)); + viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.power_station_selected)); viewBinding.myPowerStationBottomIl1.titleTv.setTextColor(getColor(R.color.text_90000000)); viewBinding.myMessageBottomIl2.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.message_unselected)); viewBinding.myMessageBottomIl2.titleTv.setTextColor(getColor(R.color.text_65000000)); - viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedme)); + viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.me_unselected)); viewBinding.myMeBottomIl3.titleTv.setTextColor(getColor(R.color.text_65000000)); } else if (this.currentFragmentIndex == 2) { viewBinding.myHomePageFcv0.setVisibility(View.GONE);//闅愯棌棣栭〉鐣岄潰 viewBinding.myPowerStationFcv1.setVisibility(View.GONE);//闅愯棌鐢电珯鐣岄潰 viewBinding.myMessageFcv2.setVisibility(View.VISIBLE);//鏄剧ず娑堟伅鐣岄潰 viewBinding.myMeFcv3.setVisibility(View.GONE);//闅愯棌鎴戠殑鐣岄潰 - viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedpowerstation)); + viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.home_page_unselected)); viewBinding.myPowerStationBottomIl0.titleTv.setTextColor(getColor(R.color.text_65000000)); - viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedpowerstation)); + viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.power_station_unselected)); viewBinding.myPowerStationBottomIl1.titleTv.setTextColor(getColor(R.color.text_65000000)); viewBinding.myMessageBottomIl2.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.message_select)); viewBinding.myMessageBottomIl2.titleTv.setTextColor(getColor(R.color.text_90000000)); - viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedme)); + viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.me_unselected)); viewBinding.myMeBottomIl3.titleTv.setTextColor(getColor(R.color.text_65000000)); } else if (this.currentFragmentIndex == 3) { viewBinding.myHomePageFcv0.setVisibility(View.GONE);//闅愯棌棣栭〉鐣岄潰 viewBinding.myPowerStationFcv1.setVisibility(View.GONE);//闅愯棌鐢电珯鐣岄潰 viewBinding.myMessageFcv2.setVisibility(View.GONE);//闅愯棌娑堟伅鐣岄潰 viewBinding.myMeFcv3.setVisibility(View.VISIBLE);//鏄剧ず鎴戠殑鐣岄潰 - viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedpowerstation)); + viewBinding.myPowerStationBottomIl0.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.home_page_unselected)); viewBinding.myPowerStationBottomIl0.titleTv.setTextColor(getColor(R.color.text_65000000)); - viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.unselectedpowerstation)); + viewBinding.myPowerStationBottomIl1.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.power_station_unselected)); viewBinding.myPowerStationBottomIl1.titleTv.setTextColor(getColor(R.color.text_65000000)); viewBinding.myMessageBottomIl2.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.message_unselected)); viewBinding.myMessageBottomIl2.titleTv.setTextColor(getColor(R.color.text_65000000)); - viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.selectedme)); + viewBinding.myMeBottomIl3.iconIv.setImageDrawable(AppCompatResources.getDrawable(_mActivity, R.drawable.me_selected)); viewBinding.myMeBottomIl3.titleTv.setTextColor(getColor(R.color.text_90000000)); } } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/AAChartSymbolConst.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/AAChartSymbolConst.java new file mode 100644 index 0000000..de81366 --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/AAChartSymbolConst.java @@ -0,0 +1,11 @@ +package com.hdl.photovoltaic.ui.home; + +import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartSymbolType; + +public class AAChartSymbolConst { + public static final String predefinedSymbol1 = AAChartSymbolType.Triangle; + public static final String predefinedSymbol2 = AAChartSymbolType.Circle; + public static final String imageSymbol = "url(https://www.highcharts.com/samples/graphics/sun.png)"; + public static final String base64Symbol = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5Si +ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVi +pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+ 1dT1gvWd+ 1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx+ 1/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb+ 16EHTh0kX/i +c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAVVJREFUeNpi/P37NwOxYM2pHtm7lw8uYmBgYGAiVtPC3RWh+88vuneT474Dv4DkcUZibJy8PG72le/nkn+zMzAaMhnNyY1clMpCjKbz/86lMLAzMMA0MTAwMOC1Ea6JgYFB9pPwncbMg6owOaY1p3pk15zqkcWnie8j63ddY18nZHmWI2eW3vzN/Jf168c3UfGuHathAXHl+7lkBnYGBtafDP8NVd3jQ8xKHiNrZMyeqPPtE/9vTgYGBgb1H4oHlHXt43ZfWfDwNzsDIwMDA4POX831RXGrg9BdxLhob63VgTurjsAUsv5k+A9jC3/g/NCdfVoQm/+ZIu3qjhnyW3XABJANMNL19cYVcPBQrZpq9eyFwCdJmIT6D8UD5cmbHXFphKccI9Mgc84vTH9goYhPE4rGELOSx0bSjsUMDAwMunJ2FQST0+/fv1Hw5BWJbehi2DBgAHTKsWmiz+rJAAAAAElFTkSuQmCC)"; + +} 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..dfd7cfc 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,42 @@ public class BasicChartComposer { public static AAChartModel configureBasicOptions() { return new AAChartModel() - .backgroundColor("#ffffff")//#4b2b7f + .backgroundColor("#ffffff") +// .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() .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 configureStepAreaChartAndStepLineChart() { @@ -68,18 +84,38 @@ "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( diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/CustomStyleChartComposer.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/CustomStyleChartComposer.java new file mode 100644 index 0000000..035b4fd --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/CustomStyleChartComposer.java @@ -0,0 +1,2106 @@ +package com.hdl.photovoltaic.ui.home; + +import static com.github.AAChartModel.AAChartCore.AATools.AAColor.AARgba; +import static com.hdl.photovoltaic.ui.home.AAChartSymbolConst.base64Symbol; +import static com.hdl.photovoltaic.ui.home.AAChartSymbolConst.imageSymbol; +import static com.hdl.photovoltaic.ui.home.AAChartSymbolConst.predefinedSymbol1; +import static com.hdl.photovoltaic.ui.home.AAChartSymbolConst.predefinedSymbol2; + +import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel; +import com.github.AAChartModel.AAChartCore.AAChartCreator.AASeriesElement; +import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartAlignType; +import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartAnimationType; +import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartFontWeightType; +import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartStackingType; +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.AAChartEnum.AAChartVerticalAlignType; +import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartZoomType; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAColumn; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AADataElement; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AADataLabels; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAHalo; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAHover; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAInactive; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAMarker; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAMarkerHover; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAMarkerStates; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AASVGAttributes; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AASelect; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAShadow; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStates; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStyle; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AATooltip; +import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAZonesElement; +import com.github.AAChartModel.AAChartCore.AATools.AAColor; +import com.github.AAChartModel.AAChartCore.AATools.AAGradientColor; +import com.github.AAChartModel.AAChartCore.AATools.AALinearGradientDirection; + +import java.util.ArrayList; +import java.util.Map; + +public class CustomStyleChartComposer { + + public static AAChartModel configureColorfulChart() { + String[] colorsNameArr = { + "red", + "orange", + "yellow", + "green", + "cyan", + "blue", + "purple", + "gray", + "darkGray", + "lightGray", + "magenta", + "brown", + "black" + }; + + String[] colorsArr = { + AAColor.Red, + AAColor.Orange, + AAColor.Yellow, + AAColor.Green, + AAColor.Cyan, + AAColor.Blue, + AAColor.Purple, + AAColor.Gray, + AAColor.DarkGray, + AAColor.LightGray, + AAColor.Magenta, + AAColor.Brown, + AAColor.Black, + }; + + return new AAChartModel() + .chartType(AAChartType.Bar) + .animationType(AAChartAnimationType.Bounce) + .title("Colorful Chart") + .subtitle("use AAColor to get color string") + .dataLabelsEnabled(false) + .categories(colorsNameArr) + .colorsTheme(colorsArr) + .stacking(AAChartStackingType.Percent) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo") + .data(new Object[]{ + 149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4}) + .colorByPoint(true) + }); + + } + + public static AAChartModel configureColorfulGradientColorChart() { + String[] gradientColorNamesArr = { + "oceanBlue", + "sanguine", + "lusciousLime", + "purpleLake", + "freshPapaya", + "ultramarine", + "pinkSugar", + "lemonDrizzle", + "victoriaPurple", + "springGreens", + "mysticMauve", + "reflexSilver", + "newLeaf", + "cottonCandy", + "pixieDust", + "fizzyPeach", + "sweetDream", + "firebrick", + "wroughtIron", + "deepSea", + "coastalBreeze", + "eveningDelight", + "neonGlowColor", + "berrySmoothieColor" + }; + + Map[] gradientColorArr = { + AAGradientColor.OceanBlue, + AAGradientColor.Sanguine, + AAGradientColor.LusciousLime, + AAGradientColor.PurpleLake, + AAGradientColor.FreshPapaya, + AAGradientColor.Ultramarine, + AAGradientColor.PinkSugar, + AAGradientColor.LemonDrizzle, + AAGradientColor.VictoriaPurple, + AAGradientColor.SpringGreens, + AAGradientColor.MysticMauve, + AAGradientColor.ReflexSilver, + AAGradientColor.NewLeaf, + AAGradientColor.CottonCandy, + AAGradientColor.PixieDust, + AAGradientColor.FizzyPeach, + AAGradientColor.SweetDream, + AAGradientColor.Firebrick, + AAGradientColor.WroughtIron, + AAGradientColor.DeepSea, + AAGradientColor.CoastalBreeze, + AAGradientColor.EveningDelight, + AAGradientColor.NeonGlow, + AAGradientColor.BerrySmoothie + }; + + return new AAChartModel() + .chartType(AAChartType.Bar) + .title("Colorful Column Chart") + .subtitle("single data array colorful column chart") + .categories(gradientColorNamesArr) + .colorsTheme(gradientColorArr) + .yAxisTitle("gradient color") + .stacking(AAChartStackingType.Percent) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo") + .data(new Object[]{ + 149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4, + 149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4}) + .colorByPoint(true) + }); + + } + + public static AAChartModel configureDiscontinuousDataChart() { + return new AAChartModel() + .chartType(AAChartType.Column) + .title("Discontinuous Data Chart") + .dataLabelsEnabled(true) + .tooltipEnabled(true) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo") + .data(new Object[]{6.9, 9.5, 14.5, 18.2, 21.5, null, null, null, null, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6}) + .color(AAGradientColor.DeepSea) + + }); + + } + + public static AAChartModel configureColorfulColumnChart() { + Object[][] stopsArr = { + {1.00, "#38C494"}, + };//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + Map<String, Object> linearGradientColor = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + stopsArr + ); + return new AAChartModel() + .chartType(AAChartType.Column) + .title("Colorful Column Chart") + .subtitle("single data array colorful column chart") + .colorsTheme(new String[]{"#38C494",}) + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�", "鍗佷簩鏈�",}) + .xAxisLabelsEnabled(true) + .zoomType(AAChartZoomType.XY) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() +// .color(linearGradientColor) + .name("涓滀含") + .data(new Object[]{149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 54.4, 149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6, 149.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 188.5, 276.4, 214.1, 95.6}) +// .colorByPoint(true) + .tooltip(new AATooltip().style(new AAStyle().backgroundColor("#FFFFFF").fontSize(25))) + + }); + } + + public static AAChartModel configureNightingaleRoseChart() { + return new AAChartModel() + .title("鍗椾竵鏍煎皵鐜懓鍥�") + .subtitle("鏋佸湴鍥句腑鐨勪竴绉�") + .yAxisTitle("cm") + .chartType(AAChartType.Column) + .xAxisVisible(false)//鏄惁鏄剧ず鏈�澶栦竴灞傚渾鐜� + .yAxisVisible(true)//鏄惁鏄剧ず涓棿鐨勫涓渾鐜� + .legendEnabled(false)//闅愯棌鍥句緥(搴曢儴鍙偣鎸夌殑灏忓渾鐐�) + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .dataLabelsEnabled(true) + .polar(true)//鏋佸湴鍖栧浘褰� + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("涓滀含") + .data(new Object[]{7.0, 6.9, 9.5, 9.6, 13.9, 14.5, 18.3, 18.2, 21.5, 25.2, 26.5, 23.3}), + } + ) + ; + } + + public static AAChartModel configureChartWithShadowStyle() { + return new AAChartModel() + .chartType(AAChartType.Spline) + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(0) + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(8.0) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}) + .shadow(new AAShadow() + .offsetX(15.0) + .offsetY(15.0) + .opacity(0.2f) + .width(8.0) + .color(AAColor.Red)) + }); + } + + public static AAChartModel configureColorfulGradientAreaChart() { + Object[][] stopsArr = { + {0.00, "#febc0f"}, + {0.50, "#FF14d4"}, + {1.00, "#0bf8f5"}, + };//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + Map<String, Object> linearGradientColor = AAGradientColor.linearGradient( + AALinearGradientDirection.ToLeft, + stopsArr + );//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(0) + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(3) + .color(linearGradientColor) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}), + } + ); + } + + + public static AAChartModel configureColorfulGradientSplineChart() { + Object[][] stopsArr = { + {0.00, "#febc0f"}, + {0.25, "#FF14d4"}, + {0.50, "#0bf8f5"}, + {0.75, "#F33c52"}, + {1.00, "#1904dd"}, + };//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + Map<String, Object> linearGradientColor = AAGradientColor.linearGradient( + AALinearGradientDirection.ToLeft, + stopsArr + );//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + return new AAChartModel() + .chartType(AAChartType.Spline) + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(0) + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(15.0) + .color(linearGradientColor) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}), + } + ); + } + + + public static AAChartModel configureGradientColorAreasplineChart() { + Map<String, Object> linearGradientColor = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + "rgba(2255,20,147,1)",//娣辩矇鑹�, alpha 閫忔槑搴� 1 + "rgba(255,105,180,0.1)"//鐑儏鐨勭矇绾�, alpha 閫忔槑搴� 0.1 + );//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(8)//marker鐐瑰崐寰勪负8涓儚绱� + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)//marker鐐逛负绌哄績鏁堟灉 + .markerSymbol(AAChartSymbolType.Circle)//marker鐐逛负鍦嗗舰鐐光棆 + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(5.0) + .color(AARgba(220, 20, 60, 1.0f))//鐚╃孩鑹�, alpha 閫忔槑搴� 1 + .fillColor(linearGradientColor) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}), + } + ); + } + + + public static AAChartModel configureSpecialStyleMarkerOfSingleDataElementChart() { + Object[][] stopsArr = { + {0.00, "#febc0f"}, + {0.25, "#FF14d4"}, + {0.50, "#0bf8f5"}, + {0.75, "#F33c52"}, + {1.00, "#1904dd"}, + };//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + Map<String, Object> gradientColorDic1 = AAGradientColor.linearGradient( + AALinearGradientDirection.ToRight, + stopsArr + ); + + AADataElement singleSpecialData = new AADataElement() + .marker(new AAMarker() + .radius(8)//鏇茬嚎杩炴帴鐐瑰崐寰� + .symbol(AAChartSymbolType.Circle)//鏇茬嚎鐐圭被鍨嬶細"circle", "square", "diamond", "triangle","triangle-down"锛岄粯璁ゆ槸"circle" + .fillColor("#FFFFFF")//鐐圭殑濉厖鑹�(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑濉厖鑹�) + .lineWidth(5)//澶栨部绾跨殑瀹藉害(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑杞粨鎻忚竟鐨勫搴�) + .lineColor("#FF0000")//澶栨部绾跨殑棰滆壊(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑杞粨鎻忚竟棰滆壊锛屽綋鍊间负绌哄瓧绗︿覆鏃讹紝榛樿鍙栨暟鎹偣鎴栨暟鎹垪鐨勯鑹�) + ) + .y(26.5); + + return new AAChartModel() + .chartType(AAChartType.Spline) + .backgroundColor("#4b2b7f") + .dataLabelsEnabled(false)//鏄惁鏄剧ず鍊� + .tooltipEnabled(true) + .markerRadius(0) + .xAxisVisible(false) + .yAxisVisible(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Virtual Data") + .lineWidth(6) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, singleSpecialData, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}) + .color(gradientColorDic1) + }); + } + + public static AAChartModel configureSpecialStyleColumnOfSingleDataElementChart() { + AADataElement singleSpecialData = new AADataElement() + .color(AAGradientColor.FreshPapaya) + .y(49.5); + + return new AAChartModel() + .chartType(AAChartType.Column) + .dataLabelsEnabled(false)//鏄惁鏄剧ず鍊� + .tooltipEnabled(false) + .markerRadius(0) + .xAxisVisible(false) + .yAxisVisible(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Virtual Data") + .lineWidth(6) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, singleSpecialData, 5.2, 26.5, 23.3, 26.5, 13.9, 9.6}) + .color(AAGradientColor.OceanBlue) + }); + } + + public static AAChartModel configureAreaChartThreshold() { + Map<String, Object> gradientColorDic1 = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + "rgba(30, 144, 255,1)",//DodgerBlue, alpha 閫忔槑搴� 1 + "rgba(30, 144, 255,0.1)"//DodgerBlue, alpha 閫忔槑搴� 0.1 + ); + + return new AAChartModel() + .chartType(AAChartType.Area) + .yAxisGridLineWidth(0) + .categories(new String[]{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Spe", "Oct", "Nov", "Dec"}) + .dataLabelsEnabled(false)//鏄惁鏄剧ず鍊� + .markerRadius(8) + .markerSymbol(AAChartSymbolType.Circle) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .threshold((-200)) + .data(new Object[]{106.4, 129.2, 269.9, -100.5, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4}) + .lineWidth(6) + .color("rgba(30, 144, 255,1)") + .fillColor(gradientColorDic1) + }); + } + + //refer to online sample https://jshare.com.cn/github/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-marker-symbol/ + public static AAChartModel customScatterChartMarkerSymbolContent() { + AASeriesElement element1 = new AASeriesElement() + .name("Predefined symbol") + .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}) + .marker(new AAMarker() + .symbol(predefinedSymbol1)); + + AASeriesElement element2 = new AASeriesElement() + .name("Image symbol") + .data(new Object[]{0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67}) + .marker(new AAMarker() + .symbol(imageSymbol)); + + AASeriesElement element3 = new AASeriesElement() + .name("Base64 symbol (*)") + .data(new Object[]{0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60, 0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64}) + .marker(new AAMarker() + .symbol(base64Symbol)); + + AASeriesElement element4 = new AASeriesElement() + .name("Custom symbol") + .data(new Object[]{0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65, 0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53}) + .marker(new AAMarker() + .symbol(predefinedSymbol2)); + + return new AAChartModel() + .chartType(AAChartType.Scatter) + .yAxisMax(3.5) + .yAxisGridLineWidth(0) + .stacking(AAChartStackingType.Normal) + .markerRadius(8) + .series(new AASeriesElement[]{element1, element2, element3, element4}); + } + + //refer to online sample https://jshare.com.cn/github/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-marker-symbol/ + public static AAChartModel customLineChartMarkerSymbolContent() { + AAChartModel aaChartModel = customScatterChartMarkerSymbolContent(); + aaChartModel.chartType = AAChartType.Line; + return aaChartModel; + } + + //涓夎褰㈤浄杈惧浘 + public static AAChartModel configureTriangleRadarChart() { + return new AAChartModel() + .chartType(AAChartType.Area) + .yAxisMax(15.0) + .yAxisGridLineWidth(0) + .xAxisVisible(false) + .markerRadius(0) + .polar(true)//鏄惁鏋佸寲鍥惧舰 + .series(new AASeriesElement[]{ + new AASeriesElement() + .data(new Object[]{15.0, 15.0, 15.0,}), + new AASeriesElement() + .data(new Object[]{9.0, 9.0, 9.0,}), + new AASeriesElement() + .data(new Object[]{6.0, 6.0, 6.0,}), + new AASeriesElement() + .data(new Object[]{3.0, 3.0, 3.0,}), + }); + } + + //鍥涜竟褰㈤浄杈惧浘 + public static AAChartModel configureQuadrangleRadarChart() { + return new AAChartModel() + .chartType(AAChartType.Area) + .yAxisMax(15.0) + .yAxisGridLineWidth(0) + .xAxisVisible(false) + .markerRadius(0) + .polar(true)//鏄惁鏋佸寲鍥惧舰 + .series(new AASeriesElement[]{ + new AASeriesElement() + .data(new Object[]{15.0, 15.0, 15.0, 15.0,}), + new AASeriesElement() + .data(new Object[]{9.0, 9.0, 9.0, 9.0,}), + new AASeriesElement() + .data(new Object[]{6.0, 6.0, 6.0, 6.0,}), + new AASeriesElement() + .data(new Object[]{3.0, 3.0, 3.0, 3.0,}), + }); + } + + //浜旇竟褰㈤浄杈惧浘 + public static AAChartModel configurePentagonRadarChart() { + return new AAChartModel() + .chartType(AAChartType.Area) + .yAxisMax(15.0) + .yAxisGridLineWidth(0) + .xAxisVisible(false) + .markerRadius(0) + .polar(true)//鏄惁鏋佸寲鍥惧舰 + .series(new AASeriesElement[]{ + new AASeriesElement() + .data(new Object[]{15.0, 15.0, 15.0, 15.0, 15.0,}), + new AASeriesElement() + .data(new Object[]{9.0, 9.0, 9.0, 9.0, 9.0,}), + new AASeriesElement() + .data(new Object[]{6.0, 6.0, 6.0, 6.0, 6.0,}), + new AASeriesElement() + .data(new Object[]{3.0, 3.0, 3.0, 3.0, 3.0,}), + }); + } + + //鍏竟褰㈤浄杈惧浘 + public static AAChartModel configureHexagonRadarChart() { + return new AAChartModel() + .chartType(AAChartType.Area) + .yAxisMax(15.0) + .yAxisGridLineWidth(0) + .xAxisVisible(false) + .markerRadius(0) + .polar(true)//鏄惁鏋佸寲鍥惧舰 + .series(new AASeriesElement[]{ + new AASeriesElement() + .data(new Object[]{15.0, 15.0, 15.0, 15.0, 15.0, 15.0,}), + new AASeriesElement() + .data(new Object[]{9.0, 9.0, 9.0, 9.0, 9.0, 9.0,}), + new AASeriesElement() + .data(new Object[]{6.0, 6.0, 6.0, 6.0, 6.0, 6.0,}), + new AASeriesElement() + .data(new Object[]{3.0, 3.0, 3.0, 3.0, 3.0, 3.0,}), + }); + } + + public static AAChartModel adjustYAxisMaxAndMinValues() { + String[] categoriesArr = { + "瀛ゅ矝鍗辨満", + "浣垮懡鍙敜", + "鑽h獕鍕嬬珷", + "鐙欏嚮绮捐嫳", + "绁炵娴峰煙", + "鏈�鍚庣敓杩樿��", + "宸笀3鐙傜寧", + "瀵归┈涔嬮瓊", + "铦欒潬渚犻樋鐢橀獞澹�", + "鍦扮嫳杈瑰", + "闂", + "蹇嶈�呬箣鍗�", + }; + + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .legendEnabled(false) + .yAxisVisible(true) + .markerRadius(6) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .zoomType(AAChartZoomType.XY) + .categories(categoriesArr) + .yAxisMin(2.0) + .yAxisMax(45.4) + .xAxisTickInterval(2) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("浣撻噸") + .color("#2494F3") + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}) + }) + ; + } + + public static AAChartModel customSpecialStyleDataLabelOfSingleDataElementChart() { + Object[][] redStopsArr = new Object[][]{ + new Object[]{0.0, AARgba(255, 0, 0, 0.6f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + new Object[]{0.5, AARgba(255, 0, 0, 0.0f)}, + new Object[]{1.0, AARgba(255, 0, 0, 0.0f)} + }; + + Map<String, Object> gradientColorDic1 = AAGradientColor.linearGradient( + AALinearGradientDirection.ToTop, + AARgba(255, 215, 0, 0.1f), + AARgba(255, 215, 0, 0.6f) + ); + + String formatStr = + "<img src=\"https://www.highcharts.com/samples/graphics/sun.png\">" + + "<span style=\"color:#FFFFFF;font-weight:thin;font-size:25px\">{y}</span>" + + "<span style=\"color:#FFFFFF;font-weight:thin;font-size:17px\"> m</span>"; + + + AADataElement singleSpecialData = new AADataElement() + .dataLabels(new AADataLabels() + .enabled(true) + .useHTML(true) + .format(formatStr) + .style(new AAStyle() + .fontWeight(AAChartFontWeightType.Bold) + .color(AAColor.White) + .fontSize(16)) + .y((-35)) + .align(AAChartAlignType.Center) + .verticalAlign(AAChartVerticalAlignType.Top) + .overflow("none") + .crop(false) + ) + .y(26.5); + + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .backgroundColor("#4b2b7f") + .dataLabelsEnabled(false)//鏄惁鏄剧ず鍊� + .tooltipEnabled(true) + .markerRadius(0) + .xAxisVisible(false) + .yAxisVisible(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Virtual Data") + .lineWidth(6) + .color("rgba(255,215,0,1)") + .fillColor(gradientColorDic1)// gold color, alpha: 1.0 + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, singleSpecialData, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}) + }); + } + + public static AAChartModel customBarChartHoverColorAndSelectColor() { + return new AAChartModel() + .chartType(AAChartType.Bar) + .title("Custom Bar Chart select color") + .yAxisReversed(true) + .xAxisReversed(true) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("ElementOne") + .data(new Object[]{211, 183, 157, 133, 111, 91, 73, 57, 43, 31, 21, 13, 7, 3}) + .allowPointSelect(true) + .states( + new AAStates() + .hover(new AAHover() + .color("rgba(220,20,60,1)"))//鐚╃孩鑹�, alpha 閫忔槑搴� 1 + .select(new AASelect() + .color(AAColor.Red))) + }); + } + + public static AAChartModel customChartHoverAndSelectHaloStyle() { + return new AAChartModel() + .chartType(AAChartType.Line) + .title("Custom Chart Hover And Select Halo Style") + .colorsTheme(new Object[]{AAColor.Red}) + .yAxisReversed(true) + .xAxisReversed(true) + .markerRadius(20) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("ElementOne") + .data(new Object[]{211, 183, 157, 133, 111, 91, 73, 57, 43, 31, 21, 13, 7, 3}) + .allowPointSelect(true) + .states( + new AAStates() + .hover(new AAHover() + .halo(new AAHalo() + .size(130) + .opacity(0.8) + .attributes(new AASVGAttributes() + .strokeWidth(50) + .fill("#00BFFF") + .stroke("#00FA9A")))) + .select(new AASelect() + .halo(new AAHalo() + .size(130) + .opacity(1.0) + .attributes(new AASVGAttributes() + .strokeWidth(150) + .fill(AARgba(138, 43, 226, 1f)) + .stroke(AARgba(30, 144, 255, 1f))))) + )}); + } + + public static AAChartModel customSplineChartMarkerStatesHoverStyle() { + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .title("Custom Spline Chart Marker States Hover Style") + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(8.0)//marker鐐瑰崐寰勪负8涓儚绱� + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(5.0) + .color("rgba(220,20,60,1)")//鐚╃孩鑹�, alpha 閫忔槑搴� 1 + .marker(new AAMarker() + .states(new AAMarkerStates() + .hover(new AAMarkerHover() + .fillColor(AAColor.White) + .radius(40) + .lineColor(AAColor.Green) + .lineWidth(20)))) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}), + }); + } + + //Issue: https://github.com/AAChartModel/AAChartKit/issues/948 + public static AAChartModel splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle() { + return new AAChartModel() + .chartType(AAChartType.Spline) + .title("Spline Chart Hover Line Width No Change && Custom Marker States Hover Style") + .categories(new String[]{"涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(8.0)//marker鐐瑰崐寰勪负8涓儚绱� + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(5.0) + .color(AAColor.Red) + .states(new AAStates() + .hover(new AAHover() + .enabled(true) + //鎵嬫寚鐩樻棆鎴栭�変腑鍥捐〃鏃�,绂佹绾挎潯鍙樼矖 + .lineWidthPlus(0))) + .marker(new AAMarker() + .states(new AAMarkerStates() + .hover(new AAMarkerHover() + .fillColor(AAColor.Red)//璁剧疆鎵嬫寚閫変腑鐐圭殑棰滆壊涓虹孩鑹� + .radius(40)))) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}), + }); + } + + //Issue: https://github.com/AAChartModel/AAChartKit/issues/827 + public static AAChartModel customNormalStackingChartDataLabelsContentAndStyle() { + String[] categories = { + "瀛ゅ矝鍗辨満", + "浣垮懡鍙敜", + "鑽h獕鍕嬬珷", + "鐙欏嚮绮捐嫳", + "绁炵娴峰煙", + "鏈�鍚庣敓杩樿��", + "宸笀3鐙傜寧", + "瀵归┈涔嬮瓊", + "姝讳骸鎼佹祬", + "鍦扮嫳杈瑰", + "闂", + "蹇嶈�呬箣鍗�" + }; + + String[] colorsTheme = { + "#fe117c", + "#ffc069", + "#06caf4", + "#7dffc0" + }; + + AASeriesElement element1 = new AASeriesElement() + .name("2017") + .dataLabels(new AADataLabels() + .enabled(true) + .y(-10) + .format("{total} mm") + .color(AAColor.Red) + .shape("callout") + .backgroundColor(AAColor.White) + .borderColor(AAColor.Red) + .borderRadius(1) + .borderWidth(1) + ) + .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("2018") + .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("2019") + .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("2020") + .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}); + + AASeriesElement[] series = {element1, element2, element3, element4}; + + return new AAChartModel() + .chartType(AAChartType.Column) + .stacking(AAChartStackingType.Normal) + .yAxisGridLineWidth(0) + .markerRadius(0) + .categories(categories) + .colorsTheme(colorsTheme) + .series(series); + } + + //Issue: https://github.com/AAChartModel/AAChartKit-Swift/issues/190 +//API Doc: https://api.highcharts.com.cn/highcharts#series%3Cpyramid%3E.reversed + public static AAChartModel upsideDownPyramidChart() { + return new AAChartModel() + .chartType(AAChartType.Pyramid) + .yAxisTitle("鎽勬皬搴�") + .inverted(true) + .legendEnabled(true) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2020") + .reversed(true) + .data(new Object[][]{ + {"Swift", 15654}, + {"Objective-C", 4064}, + {"JavaScript", 1987}, + {"GO", 976}, + {"Python", 846} + }) + }); + } + + //Issue: https://github.com/AAChartModel/AAChartKit/issues/888 + public static AAChartModel doubleLayerPieChart() { + return new AAChartModel() + .chartType(AAChartType.Pie) + .title("娴忚鍣ㄥ競鍦哄崰姣斿巻鍙插姣�") + .subtitle("鏃犱换浣曞彲闈犱緷鎹殑铏氭嫙鏁版嵁") + .dataLabelsEnabled(true)//鏄惁鐩存帴鏄剧ず鎵囧舰鍥炬暟鎹� + .yAxisTitle("鎽勬皬搴�") + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Past") + .size("40%")//灏哄澶у皬 + .innerSize("30%")//鍐呴儴鍦嗙幆鍗婂緞澶у皬鍗犳瘮 + .borderWidth(0)//鎻忚竟鐨勫搴� + .allowPointSelect(false)//鏄惁鍏佽鍦ㄧ偣鍑绘暟鎹偣鏍囪(鎵囧舰鍥剧偣鍑婚�変腑鐨勫潡鍙戠敓浣嶇Щ) + .data(new Object[][]{ + {"Firefox Past", 3336.2}, + {"Chrome Past", 26.8}, + {"Safari Past", 88.5}, + {"Opera Past", 46.0}, + {"Others Past", 223.0}, + }), + + new AASeriesElement() + .name("Now") + .size("80%")//灏哄澶у皬 + .innerSize("70%")//鍐呴儴鍦嗙幆鍗婂緞澶у皬鍗犳瘮 + .borderWidth(0)//鎻忚竟鐨勫搴� + .allowPointSelect(false)//鏄惁鍏佽鍦ㄧ偣鍑绘暟鎹偣鏍囪(鎵囧舰鍥剧偣鍑婚�変腑鐨勫潡鍙戠敓浣嶇Щ) + .data(new Object[][]{ + {"Firefox Now", 336.2}, + {"Chrome Now", 6926.8}, + {"Safari Now", 388.5}, + {"Opera Now", 446.0}, + {"Others Now", 223.0}, + }) + }); + } + + //GitHub issue https://github.com/AAChartModel/AAChartKit/issues/903 + public static AAChartModel disableSomeOfLinesMouseTrackingEffect() { + return new AAChartModel() + .chartType(AAChartType.Line)//鍥捐〃绫诲瀷 + .tooltipValueSuffix("涓囧厓")//璁剧疆娴姩鎻愮ず妗嗗崟浣嶅悗缂� + .yAxisTitle("涓囧厓")//璁剧疆 Y 杞存爣棰� + .categories(new String[]{ + "涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�" + }) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .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}), + new AASeriesElement() + .name("2018") + .enableMouseTracking(false) + .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}), + new AASeriesElement() + .name("2019") + .enableMouseTracking(false) + .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}), + new AASeriesElement() + .name("2020") + .enableMouseTracking(false) + .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}), + }); + } + + + // GitHub issue https://github.com/AAChartModel/AAChartKit/issues/904 + public static AAChartModel configureColorfulShadowSplineChart() { + return new AAChartModel() + .chartType(AAChartType.Spline) + .yAxisVisible(false) + .stacking(AAChartStackingType.Normal) + .colorsTheme(new String[]{"#1e90ff", "#ef476f", "#ffd066", "#04d69f"}) + .markerSymbol(AAChartSymbolType.Circle) + .markerRadius(8.0) + .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .lineWidth(5) + .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}) + .shadow( + new AAShadow() + .offsetX(15.0) + .offsetY(15.0) + .opacity(0.2f) + .width(8.0) + .color("#1e90ff")), + new AASeriesElement() + .name("2018") + .lineWidth(5) + .data(new Object[]{0.38, 0.31, 0.32, 0.32, 0.64, 0.66, 0.86, 0.47, 0.52, 0.75, 0.52, 0.56, 0.54, 0.60, 0.46, 0.63, 0.54, 0.51, 0.58, 0.64, 0.60, 0.45, 0.36, 0.67}) + .shadow( + new AAShadow() + .offsetX(15.0) + .offsetY(15.0) + .opacity(0.2f) + .width(8.0) + .color("#ef476f")), + new AASeriesElement() + .name("2019") + .lineWidth(5) + .data(new Object[]{0.46, 0.32, 0.53, 0.58, 0.86, 0.68, 0.85, 0.73, 0.69, 0.71, 0.91, 0.74, 0.60, 0.50, 0.39, 0.67, 0.55, 0.49, 0.65, 0.45, 0.64, 0.47, 0.63, 0.64}) + .shadow( + new AAShadow() + .offsetX(15.0) + .offsetY(15.0) + .opacity(0.2f) + .width(8.0) + .color("#ffd066")), + new AASeriesElement() + .name("2020") + .lineWidth(5) + .data(new Object[]{0.60, 0.51, 0.52, 0.53, 0.64, 0.84, 0.65, 0.68, 0.63, 0.47, 0.72, 0.60, 0.65, 0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53}) + .shadow( + new AAShadow() + .offsetX(15.0) + .offsetY(15.0) + .opacity(0.2f) + .width(8.0) + .color("#04d69f")), + }); + } + + // GitHub issue https://github.com/AAChartModel/AAChartKit/issues/905 + public static AAChartModel configureColorfulDataLabelsStepLineChart() { + return new AAChartModel() + .chartType(AAChartType.Line) + .yAxisVisible(false) + .stacking(AAChartStackingType.Normal) + .colorsTheme(new String[]{"#1e90ff", "#ef476f", "#ffd066", "#04d69f"}) + .markerSymbol(AAChartSymbolType.Circle) + .markerRadius(8.0) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .step((true)) + .dataLabels(new AADataLabels() + .style(new AAStyle() + .color("#1e90ff") + .fontSize(11))) + .data(new Object[]{2.10, 2.54, 2.78, 3.62, 4.41, 4.09, 3.83, 4.47, 4.20, 3.94, 3.80, 3.58, 3.19, 4.30, 3.69, 3.52, 3.02, 3.30}), + new AASeriesElement() + .name("2018") + .step((true)) + .dataLabels(new AADataLabels() + .style(new AAStyle() + .color("#ef476f") + .fontSize(11))) + .data(new Object[]{1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28}), + new AASeriesElement() + .name("2019") + .step((true)) + .dataLabels(new AADataLabels() + .style(new AAStyle() + .color("#ffd066") + .fontSize(11))) + .data(new Object[]{1.16, 1.67, 2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05, 2.18, 3.24}), + new AASeriesElement() + .name("2020") + .step((true)) + .dataLabels(new AADataLabels() + .style(new AAStyle() + .color("#04d69f") + .fontSize(11))) + .data(new Object[]{5.59, 3.09, 4.09, 6.14, 5.33, 6.05, 5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.22, 5.77, 6.19, 5.68, 4.33, 5.48}), + }); + } + + + // GitHub issue https://github.com/AAChartModel/AAChartKit-Swift/issues/223 + public static AAChartModel configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart() { + Object[][] blueStopsArr = new Object[][]{ + {0.0, AARgba(30, 144, 255, 1.0f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + {0.5, AARgba(30, 144, 255, 0.2f)}, + {1.0, AARgba(30, 144, 255, 0.0f)} + }; + Map<String, Object> gradientBlueColorDic = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + blueStopsArr + ); + + Object[][] redStopsArr = new Object[][]{ + {0.0, AARgba(255, 0, 0, 1.0f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + {0.5, AARgba(255, 0, 0, 0.2f)}, + {1.0, AARgba(255, 0, 0, 0.0f)} + }; + Map<String, Object> gradientRedColorDic = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + redStopsArr + ); + + Object[][] goldStopsArr = new Object[][]{ + {0.0, AARgba(255, 215, 0, 1.0f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + {0.5, AARgba(255, 215, 0, 0.2f)}, + {1.0, AARgba(255, 215, 0, 0.0f)} + }; + Map<String, Object> gradientGoldColorDic = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + goldStopsArr + ); + + Object[][] greenStopsArr = new Object[][]{ + {0.0, AARgba(50, 205, 50, 1.0f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + {0.5, AARgba(50, 205, 50, 0.2f)}, + {1.0, AARgba(50, 205, 50, 0.0f)} + }; + Map<String, Object> gradientGreenColorDic = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + greenStopsArr + ); + + return new AAChartModel() + .chartType(AAChartType.Area) + .yAxisVisible(false) + .stacking(AAChartStackingType.Normal) + .colorsTheme(new String[]{"#1e90ff", "#ef476f", "#ffd066", "#04d69f"}) + .markerSymbol(AAChartSymbolType.Circle) + .markerRadius(5) + .dataLabelsEnabled(true) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .fillColor(gradientBlueColorDic) + .lineWidth(6) + .step((true)) + .dataLabels(new AADataLabels() + .style(AAStyle.style("#1e90ff", 11))) + .data(new Object[]{2.10, 2.54, 2.78, 3.62, 4.41, 4.09, 3.83, 4.47, 4.20, 3.94, 3.80, 3.58, 3.19, 4.30, 3.69, 3.52, 3.02, 3.30}), + new AASeriesElement() + .name("2018") + .fillColor(gradientRedColorDic) + .lineWidth(6) + .step((true)) + .dataLabels(new AADataLabels() + .style(AAStyle.style("#ef476f", 11)) + ) + .data(new Object[]{1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28}), + new AASeriesElement() + .name("2019") + .fillColor(gradientGoldColorDic) + .lineWidth(6) + .step((true)) + .dataLabels(new AADataLabels() + .style(AAStyle.style("#ffd066", 11))) + .data(new Object[]{1.16, 1.67, 2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05, 2.18, 3.24}), + new AASeriesElement() + .name("2020") + .fillColor(gradientGreenColorDic) + .lineWidth(6) + .step((true)) + .dataLabels(new AADataLabels() + .style(AAStyle.style("#04d69f", 11))) + .data(new Object[]{5.59, 3.09, 4.09, 6.14, 5.33, 6.05, 5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.22, 5.77, 6.19, 5.68, 4.33, 5.48}), + }); + } + + // Refer to https://api.highcharts.com.cn/highcharts#plotOptions.spline.marker.states.hover.enabled + public static AAChartModel disableSplineChartMarkerHoverEffect() { + return new AAChartModel() + .chartType(AAChartType.Spline) + .title("Disable Spline Chart Marker Hover Effect") + .categories(new String[]{ + "涓�鏈�", "浜屾湀", "涓夋湀", "鍥涙湀", "浜旀湀", "鍏湀", + "涓冩湀", "鍏湀", "涔濇湀", "鍗佹湀", "鍗佷竴鏈�", "鍗佷簩鏈�"}) + .markerRadius(0)//marker鐐瑰崐寰勪负0涓儚绱� + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(5.0) + .color("rgba(220,20,60,1)")//鐚╃孩鑹�, alpha 閫忔槑搴� 1 + .marker(new AAMarker() + .states(new AAMarkerStates() + .hover(new AAMarkerHover() + .enabled(false)))) + .data(new Object[]{7.0, 6.9, 2.5, 14.5, 18.2, 21.5, 5.2, 26.5, 23.3, 45.3, 13.9, 9.6}), + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1203 + public static AAChartModel configureMaxAndMinDataLabelsForChart() { + AADataLabels aaDataLabels = new AADataLabels() + .enabled(true) + .format("{y} 缇庡厓") + .shape("callout") + .style(AAStyle.style(AAColor.Red, 15f, AAChartFontWeightType.Bold)) + .backgroundColor(AAColor.White)// white color + .borderColor(AAColor.Red)// red color + .borderRadius(1.5) + .borderWidth(1.3); + + AADataElement minData = new AADataElement() + .dataLabels(aaDataLabels) + .y(2.5); + + AADataElement maxData = new AADataElement() + .dataLabels(aaDataLabels) + .y(49.5); + + return new AAChartModel() + .chartType(AAChartType.Spline) + .dataLabelsEnabled(false)//鏄惁鏄剧ず鍊� + .tooltipEnabled(false) + .markerRadius(0) + .xAxisVisible(false) + .yAxisVisible(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Show The Max and Min values Data Labels") + .lineWidth(7) + .data(new Object[]{7.0, 6.9, minData, 14.5, 18.2, maxData, 5.2, 26.5, 23.3, 26.5, 13.9, 9.6}) + .color(AAGradientColor.OceanBlue) + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1201 + public static AAChartModel customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag() { + return new AAChartModel() + .chartType(AAChartType.Area) + .categories(new String[]{ + "瀛�<br>宀�<br>鍗�<br>鏈�", + "浣�<br>鍛�<br>鍙�<br>鍞�", + "鑽�<br>瑾�<br>鍕�<br>绔�", + "鐙�<br>鍑�<br>绮�<br>鑻�", + "绁�<br>绉�<br>娴�<br>鍩�", + "鏈�<br>鍚�<br>鐢�<br>杩�<br>鑰�", + "宸�<br>甯�<br>3<br>鐙�<br>鐚�", + "瀵�<br>椹�<br>涔�<br>榄�", + "铦�<br>铦�<br>渚�<br>闃�<br>鐢�<br>楠�<br>澹�<br>", + "鍦�<br>鐙�<br>杈�<br>澧�", + "闂�<br>瀹�", + "蹇�<br>鑰�<br>涔�<br>鍗�" + }) + .tooltipEnabled(false) + .borderRadius(3) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .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}), + new AASeriesElement() + .name("2018") + .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}), + new AASeriesElement() + .name("2019") + .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}), + new AASeriesElement() + .name("2020") + .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}), + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1269 + public static AAChartModel noMoreGroupingAndOverlapEachOtherColumnChart() { + return new AAChartModel() + .chartType(AAChartType.Column) + .categories(new String[]{"11/23", "11/24", "11/25", "11/26", "11/27", "11/28", "11/29"}) +// .yAxisTickPositions([0, 10, 20, 30, 40, 50]) + .yAxisMax(50) + .yAxisMin(0) + .borderRadius(5) + .series(new AAColumn[]{ + new AAColumn() + .name("鎬诲仛棰�") + .color("#D8D8D8") + .data(new Object[]{30, 20, 28, 40, 42, 48, 50}) + .grouping(false) + , + new AAColumn() + .name("姝g‘鍋氶") + .color("#00D9CD") + .data(new Object[]{28, 18, 26, 40, 40, 46, 39}) + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1271 + public static AAChartModel noMoreGroupingAndNestedColumnChart() { + return new AAChartModel() + .chartType(AAChartType.Column) + .categories(new String[]{"11/23", "11/24", "11/25", "11/26", "11/27", "11/28", "11/29"}) +// .yAxisTickPositions([0, 10, 20, 30, 40, 50]) + .yAxisMax(50) + .yAxisMin(0) + .borderRadius(5) + .series(new Object[]{ + new AAColumn() + .name("鎬荤洰鏍�") + .color("DeepSkyBlue") + .data(new Object[]{30, 20, 28, 40, 42, 48, 50}) + .grouping(false) + .pointPadding(0.05f) + , + new AAColumn() + .name("瀹屾垚搴�") + .color("#FF3030") //Firebrick1 color + .data(new Object[]{28, 18, 26, 40, 40, 46, 39}) + .grouping(false) + .pointPadding(0.2f) + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/842 + public static AAChartModel topRoundedCornersStackingColumnChart() { + return new AAChartModel() + .chartType(AAChartType.Column) + .stacking(AAChartStackingType.Normal) + .title("Top Rounded Corners Stacking Column Chart") + .colorsTheme(new String[]{"#fe117c", "#ffc069", "#06caf4",}) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .borderRadiusTopLeft("50%") + .borderRadiusTopRight("50%") + .data(new Object[]{2.10, 2.54, 2.78, 3.62, 4.41, 4.09, 3.83, 4.47, 4.20, 3.94, 3.80, 3.58, 3.19, 4.30, 3.69, 3.52, 3.02, 3.30}), + + new AASeriesElement() + .name("Berlin Hot") + .data(new Object[]{1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28}), + + new AASeriesElement() + .name("Beijing Hot") + .data(new Object[]{1.16, 1.67, 2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05, 2.18, 3.24}), + }); + } + + //https://github.com/AAChartModel/AAChartKit-Swift/issues/323 + //https://github.com/AAChartModel/AAChartKit-Swift/issues/346 + //https://github.com/highcharts/rounded-corners + public static AAChartModel freeStyleRoundedCornersStackingColumnChart() { + return new AAChartModel() + .chartType(AAChartType.Column) + .stacking(AAChartStackingType.Percent) + .title("Free-Style Rounded Corners Stacking Column Chart") + .xAxisVisible(false) + .yAxisGridLineWidth(0) + .colorsTheme(new Object[]{ + AAGradientColor.linearGradient(AAColor.rgbColor(128, 255, 165), AAColor.rgbColor(1, 191, 236)), + AAGradientColor.linearGradient(AAColor.rgbColor(0, 221, 255), AAColor.rgbColor(77, 119, 255)), + AAGradientColor.linearGradient(AAColor.rgbColor(55, 162, 255), AAColor.rgbColor(116, 21, 219)), + AAGradientColor.linearGradient(AAColor.rgbColor(255, 0, 135), AAColor.rgbColor(135, 0, 157)), + AAGradientColor.linearGradient(AAColor.rgbColor(255, 191, 0), AAColor.rgbColor(224, 62, 76)), + AAGradientColor.PixieDust, + AAGradientColor.SweetDream, + AAGradientColor.LusciousLime, + AAGradientColor.WroughtIron, + }) + .series(new AASeriesElement[]{ + new AASeriesElement() + .borderRadiusTopLeft("50%") + .borderRadiusTopRight("50%") + .data(new Object[]{2.10, 2.54, 2.78, 3.62, 4.41, 4.09, 3.83, 4.47, 4.20, 3.94, 3.80, 3.58, 3.19, 4.30, 3.69, 3.52, 3.02, 3.30}), + + new AASeriesElement() + .borderRadiusBottomLeft("50%") + .borderRadiusBottomRight("50%") + .data(new Object[]{1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28}), + + new AASeriesElement() + .borderRadiusTopLeft("50%") + .borderRadiusBottomRight("50%") + .data(new Object[]{1.16, 1.67, 2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05, 2.18, 3.24}), + + new AASeriesElement() + .borderRadiusTopRight("50%") + .borderRadiusBottomRight("50%") + .data(new Object[]{5.59, 3.09, 4.09, 6.14, 5.33, 6.05, 5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.22, 5.77, 6.19, 5.68, 4.33, 5.48}), + + new AASeriesElement() + .borderRadius(20) + .data(new Object[]{2.10, 2.54, 2.78, 3.62, 4.41, 4.09, 3.83, 4.47, 4.20, 3.94, 3.80, 3.58, 3.19, 4.30, 3.69, 3.52, 3.02, 3.30}), + + new AASeriesElement() + .borderRadiusTopLeft("50%") + .borderRadiusBottomLeft("50%") + .data(new Object[]{5.59, 3.09, 4.09, 6.14, 5.33, 6.05, 5.71, 6.22, 6.56, 4.75, 5.27, 6.02, 5.22, 5.77, 6.19, 5.68, 4.33, 5.48}), + + new AASeriesElement() + .borderRadiusTopRight("50%") + .borderRadiusBottomLeft("50%") + .data(new Object[]{1.16, 1.67, 2.64, 2.86, 3.00, 3.21, 4.14, 4.07, 3.68, 3.11, 3.41, 3.25, 3.32, 3.07, 3.92, 3.05, 2.18, 3.24}), + + new AASeriesElement() + .borderRadiusBottomLeft("50%") + .borderRadiusBottomRight("50%") + .data(new Object[]{2.10, 2.54, 2.78, 3.62, 4.41, 4.09, 3.83, 4.47, 4.20, 3.94, 3.80, 3.58, 3.19, 4.30, 3.69, 3.52, 3.02, 3.30}), + + new AASeriesElement() + .borderRadiusTopLeft("50%") + .borderRadiusTopRight("50%") + .data(new Object[]{1.56, 1.91, 2.45, 3.87, 3.24, 4.90, 4.61, 4.10, 4.17, 3.85, 4.17, 3.46, 3.46, 3.55, 3.50, 4.13, 2.58, 2.28}), + }); + } + + //https://github.com/AAChartModel/AAChartKit-Swift/issues/365 + public static AAChartModel customColumnChartBorderStyleAndStatesHoverColor() { + return new AAChartModel() + .chartType(AAChartType.Column) + .stacking(AAChartStackingType.Normal) + .colorsTheme(new Object[]{AAColor.DarkGray, AAColor.LightGray})//Colors theme + .categories(new String[]{ + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + }) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Berlin Hot") + .borderColor(AAColor.White) + .borderWidth(3) + .borderRadius(10) + .states(new AAStates() + .hover(new AAHover() + .color(AAColor.Red))) + .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}), + + new AASeriesElement() + .name("Beijing Hot") + .borderColor(AAColor.White) + .borderWidth(3) + .borderRadius(10) + .states(new AAStates() + .hover(new AAHover() + .color("dodgerblue")))// Dodgerblue锛忛亾濂囪棈锛�#1e90ff鍗佸叚杩涘埗棰滆壊浠g爜 + .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}), + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1291 + public static AAChartModel customLineChartWithColorfulMarkersAndLines() { + return new AAChartModel() + .chartType(AAChartType.Line) + .title("Custom Line Chart With Colorful Markers And Lines") + .markerRadius(18.0)//marker鐐瑰崐寰勪负8涓儚绱� + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Tokyo Hot") + .lineWidth(5.0) + .marker(new AAMarker() + .states(new AAMarkerStates() + .hover(new AAMarkerHover() + .radius(40) + .lineWidth(5)))) + .data(new Object[]{ + 2, 4, 8, 16, 32, 64, 128, + new AADataElement() + .y(256.0) + .color(AAColor.Red) + }) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(1) + .color(AAColor.Red), + new AAZonesElement() + .value(2) + .color(AAColor.Orange), + new AAZonesElement() + .value(3) + .color(AAColor.Yellow), + new AAZonesElement() + .value(4) + .color(AAColor.Green), + new AAZonesElement() + .value(5) + .color(AAColor.Cyan), + new AAZonesElement() + .value(6) + .color(AAColor.Blue), + new AAZonesElement() + .value(7) + .color(AAColor.Purple), + }) + , + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1291 + //https://github.com/AAChartModel/AAChartKit/issues/1293 + public static AAChartModel customLineChartWithColorfulMarkersAndLines2() { + return new AAChartModel() + .chartType(AAChartType.Line) + .title("Custom Line Chart With Colorful Markers And Lines") + .markerRadius(25.0)//marker鐐瑰崐寰勪负8涓儚绱� + .markerSymbol(AAChartSymbolType.Circle) + .yAxisLineWidth(0) + .yAxisGridLineWidth(0) + .legendEnabled(true) + .stacking(AAChartStackingType.Normal) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name(AAColor.Blue) + .lineWidth(20.0) + .data(new Object[]{ + 2048, 1024, 1024, 1024, 1024, + new AADataElement() + .y(2048) + .color(AARgba(30, 144, 255, 1.0f)), + }) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(1) + .color(AARgba(30, 144, 255, 1.0f)), + new AAZonesElement() + .value(2) + .color(AARgba(30, 144, 255, 0.8f)), + new AAZonesElement() + .value(3) + .color(AARgba(30, 144, 255, 0.6f)), + new AAZonesElement() + .value(4) + .color(AARgba(30, 144, 255, 0.4f)), + new AAZonesElement() + .value(5) + .color(AARgba(30, 144, 255, 0.2f)), + }) + , + new AASeriesElement() + .name(AAColor.Red) + .lineWidth(20.0) + .data(new Object[]{ + 2048, 1024, 1024, 1024, 1024, + new AADataElement() + .y(2048) + .color(AARgba(255, 0, 0, 1.0f)), + }) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(1) + .color(AARgba(255, 0, 0, 1.0f)), + new AAZonesElement() + .value(2) + .color(AARgba(255, 0, 0, 0.8f)), + new AAZonesElement() + .value(3) + .color(AARgba(255, 0, 0, 0.6f)), + new AAZonesElement() + .value(4) + .color(AARgba(255, 0, 0, 0.4f)), + new AAZonesElement() + .value(5) + .color(AARgba(255, 0, 0, 0.2f)), + }) + , + new AASeriesElement() + .name(AAColor.Yellow) + .lineWidth(20.0) + .data(new Object[]{ + 2048, 1024, 1024, 1024, 1024, + new AADataElement() + .y(2048) + .color(AARgba(255, 215, 0, 1.0f)), + }) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(1) + .color(AARgba(255, 215, 0, 1.0f)), + new AAZonesElement() + .value(2) + .color(AARgba(255, 215, 0, 0.8f)), + new AAZonesElement() + .value(3) + .color(AARgba(255, 215, 0, 0.6f)), + new AAZonesElement() + .value(4) + .color(AARgba(255, 215, 0, 0.4f)), + new AAZonesElement() + .value(5) + .color(AARgba(255, 215, 0, 0.2f)), + }) + , + new AASeriesElement() + .name(AAColor.Green) + .lineWidth(20.0) + .data(new Object[]{ + 2048, 1024, 1024, 1024, 1024, + new AADataElement() + .y(2048) + .color(AARgba(50, 205, 50, 1.0f)), + }) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(1) + .color(AARgba(50, 205, 50, 1.0f)), + new AAZonesElement() + .value(2) + .color(AARgba(50, 205, 50, 0.8f)), + new AAZonesElement() + .value(3) + .color(AARgba(50, 205, 50, 0.6f)), + new AAZonesElement() + .value(4) + .color(AARgba(50, 205, 50, 0.4f)), + new AAZonesElement() + .value(5) + .color(AARgba(50, 205, 50, 0.2f)), + }) + , + new AASeriesElement() + .name(AAColor.Purple) + .lineWidth(20.0) + .data(new Object[]{ + 2048, 1024, 1024, 1024, 1024, + new AADataElement() + .y(2048) + .color(AARgba(138, 43, 226, 1.0f)), + }) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(1) + .color(AARgba(138, 43, 226, 1.0f)), + new AAZonesElement() + .value(2) + .color(AARgba(138, 43, 226, 0.8f)), + new AAZonesElement() + .value(3) + .color(AARgba(138, 43, 226, 0.6f)), + new AAZonesElement() + .value(4) + .color(AARgba(138, 43, 226, 0.4f)), + new AAZonesElement() + .value(5) + .color(AARgba(138, 43, 226, 0.2f)), + }) + , + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1294 + public static AAChartModel drawLineChartWithPointsCoordinates() { + Object[][] dataArr = new Object[][]{ + {0, 200}, + {0, 300}, + {0, 400}, + {1, 100}, + {2, 120}, + {3, 130} + }; + + return new AAChartModel() + .chartType(AAChartType.Scatter) + .title("Draw Line Chart With Points Coordinates") + .markerSymbol(AAChartSymbolType.Circle) + .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank) + .markerRadius(8) + .colorsTheme(new String[]{AAColor.Red}) + .series(new AASeriesElement[]{ + new AASeriesElement() + .type(AAChartType.Line) + .enableMouseTracking(false) + .showInLegend(false) + .marker(new AAMarker() + .enabled(false)) + .states(new AAStates() + .inactive(new AAInactive() + .enabled(false))) + .data(dataArr), + new AASeriesElement() + .name("Red Dot") + .type(AAChartType.Scatter) + .data(dataArr), + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1351 + public static AAChartModel configureSpecialStyleColumnForNegativeDataMixedPositiveData() { + String[] categoriesArr = new String[]{ + "绔嬫槬", "闆ㄦ按", "鎯婅洶", "鏄ュ垎", "娓呮槑", "璋烽洦", "绔嬪", "灏忔弧", "鑺掔", "澶忚嚦", "灏忔殤", "澶ф殤", + "绔嬬", "澶勬殤", "鐧介湶", "绉嬪垎", "瀵掗湶", "闇滈檷", "绔嬪啲", "灏忛洩", "澶ч洩", "鍐嚦", "灏忓瘨", "澶у瘨" + }; + + Integer[] dataArr = new Integer[]{ + -70, -69, -25, -145, -182, -215, -52, -265, -233, -453, -139, -96, + +70, +69, +25, +145, +182, +215, +52, +265, +233, +453, +139, +96, + }; + ArrayList<AADataElement> newDataArr = new ArrayList<>(); + + for (Integer dataElementValue : dataArr) { + AADataLabels aaDataLabels = new AADataLabels() + .enabled(true) + .verticalAlign(AAChartVerticalAlignType.Middle) + .x(0) + .y(-10); + + if (dataElementValue < 0) { + AADataElement negativeDataElement = new AADataElement() + .y((-dataElementValue)) + .color(AAColor.Green) + .dataLabels(aaDataLabels + .format("-{y} 缇庡厓") + .style(AAStyle.style(AAColor.Green, 11, AAChartFontWeightType.Thin))); + newDataArr.add(negativeDataElement); + } else { + AADataElement positiveDataElement = new AADataElement() + .y((dataElementValue)) + .color(AAColor.Red) + .dataLabels(aaDataLabels + .format("+{y} 缇庡厓") + .style(AAStyle.style(AAColor.Red, 11, AAChartFontWeightType.Thin))); + newDataArr.add(positiveDataElement); + } + } + + return new AAChartModel() + .chartType(AAChartType.Column) + .categories(categoriesArr) + .tooltipEnabled(false) + .yAxisVisible(false) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("铏氭瀯鏁版嵁") + .data(newDataArr.toArray()) + }); + } + + //https://github.com/AAChartModel/AAChartKit-Swift/issues/389 + public static AAChartModel configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart() { + ArrayList<Object> randomNumArrA = new ArrayList<>(); + ArrayList<Object> randomNumArrB = new ArrayList<>(); + double y1; + double y2; + int Q = (int) (Math.random() * 50); + int range = 129; + for (int x = 0; x < range; x++) { + y1 = Math.sin(Q * (x * Math.PI / 180)) + x * 2.0 * 0.01; + y2 = Math.cos(Q * (x * Math.PI / 180)) + x * 3.0 * 0.01; + randomNumArrA.add(y1); + randomNumArrB.add(y2); + } + + Object[][] redStopsArr = new Object[][]{ + {0.0, AARgba(255, 0, 0, 1.0f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + {0.2, AARgba(255, 0, 0, 0.2f)}, + {0.4, AARgba(255, 0, 0, 0.1f)}, + {0.6, AARgba(255, 0, 0, 0.05f)}, + {0.8, AARgba(255, 0, 0, 0.01f)}, + {1.0, AAColor.Clear} + }; + + Map<String, Object> gradientRedColorDic = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + redStopsArr + ); + + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .stacking(AAChartStackingType.Normal) + .backgroundColor(AAColor.Black) + .colorsTheme(new String[]{"#1e90ff", "#04d69f", "#ef476f", "#ffd066",}) + .dataLabelsEnabled(false) + .markerSymbol(AAChartSymbolType.Circle) + .markerRadius(5) + .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank) + .yAxisGridLineWidth(0.5f) + .xAxisGridLineWidth(0.5f) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .type(AAChartType.Spline) + .lineWidth(6f) + .data(randomNumArrA.toArray()), + new AASeriesElement() + .name("2018") + .type(AAChartType.Spline) + .lineWidth(6f) + .data(randomNumArrB.toArray()), + new AASeriesElement() + .name("2020") + .fillColor(gradientRedColorDic) + .lineWidth(6f) + .threshold(-4f) + .data(randomNumArrA.toArray()), + }); + } + + //https://github.com/AAChartModel/AAChartKit/issues/1401 + public static AAChartModel connectNullsForSingleAASeriesElement() { + Object[] dataArr = new Object[]{ + 0.45, null, null, + 0.55, 0.58, 0.62, null, null, + 0.56, 0.67, 0.50, 0.34, 0.50, null, null, null, null, + 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36, null, null, null, null, null, null, null, null, + 0.74, 0.66, 0.65, 0.71, 0.59, 0.65, 0.77, 0.52, 0.53, 0.58, 0.53, + }; + + return new AAChartModel() + .chartType(AAChartType.Spline) + .subtitle("铏氭嫙鏁版嵁") + .colorsTheme(new String[]{"#1e90ff", "#ef476f", "#ffd066", "#04d69f"}) + .yAxisTitle("鎽勬皬搴�") + .dataLabelsEnabled(false) + .yAxisGridLineWidth(0f) + .stacking(AAChartStackingType.Normal) + .markerRadius(8f) + .markerSymbolStyle(AAChartSymbolStyleType.BorderBlank) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("Do NOT Connect Nulls") + .lineWidth(5f) + .connectNulls(false) + .data(dataArr), + new AASeriesElement() + .name("Connect Nulls") + .lineWidth(5f) + .connectNulls(true) + .data(dataArr), + new AASeriesElement() + .name("Do NOT Connect Nulls") + .lineWidth(5f) + .connectNulls(false) + .data(dataArr), + new AASeriesElement() + .name("Connect Nulls") + .lineWidth(5f) + .connectNulls(true) + .data(dataArr) + }); + } + + +//- (NSArray *)generateRandomNumberArrayWithLength:(NSUInteger)length +// randomRange:(NSUInteger)randomRange +// minNum:(NSUInteger)minNum { +// NSMutableArray *randomNumArrA = [NSMutableArray array]; +// for (NSUInteger x = 0; x < length; x++) { +// NSUInteger randomNum = arc4random() % randomRange + minNum; +// [randomNumArrA addObject:@(randomNum)]; +// } +// return randomNumArrA; +// } + + public static ArrayList<Object> generateRandomNumberArrayWithLength(int length, int randomRange, int minNum) { + ArrayList<Object> randomNumArrA = new ArrayList<>(); + for (int x = 0; x < length; x++) { + int randomNum = (int) (Math.random() * randomRange + minNum); + randomNumArrA.add(randomNum); + } + return randomNumArrA; + } + + +// - (NSArray *)generateRandomNumberMixedNullArrayWithLength:(NSUInteger)length +// randomRange:(NSUInteger)randomRange +// minNum:(NSUInteger)minNum { +// NSMutableArray *randomNumArrA = [NSMutableArray array]; +// for (NSUInteger x = 0; x < length; x++) { +// if ((100 < x && x < 150) || (300 < x && x < 350)) { +// NSUInteger randomNum = arc4random() % randomRange + minNum; +// [randomNumArrA addObject:@(randomNum)]; +// } else { +// [randomNumArrA addObject:NSNull.null]; +// } +// } +// return randomNumArrA; +// } + + public static ArrayList<Object> generateRandomNumberMixedNullArrayWithLength(int length, int randomRange, int minNum) { + ArrayList<Object> randomNumArrA = new ArrayList<>(); + for (int x = 0; x < length; x++) { + if ((100 < x && x < 150) || (300 < x && x < 350)) { + int randomNum = (int) (Math.random() * randomRange + minNum); + randomNumArrA.add(randomNum); + } else { + randomNumArrA.add(null); + } + } + return randomNumArrA; + } + + +////https://github.com/AAChartModel/AAChartKit/issues/1419 +//- (AAChartModel *)lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement { +// return AAChartModel.new +// .chartTypeSet(AAChartTypeLine) +// .backgroundColorSet(AAColor.blackColor) +// .colorsThemeSet(@[@"#1e90ff",@"#04d69f",@"#ef476f",@"#ffd066",]) +// .dataLabelsEnabledSet(false) +// .markerRadiusSet(@0) +// .seriesSet(@[ +// AASeriesElement.new +// .nameSet(@"2017") +// .lineWidthSet(@6) +// .dataSet([self generateRandomNumberMixedNullArrayWithLength:3550 randomRange:5 minNum:100]), +// AASeriesElement.new +// .nameSet(@"2018") +// .lineWidthSet(@6) +// .dataSet([self generateRandomNumberArrayWithLength:3550 randomRange:100 minNum:200]), +// AASeriesElement.new +// .nameSet(@"2019") +// .lineWidthSet(@6) +// .dataSet([self generateRandomNumberArrayWithLength:3550 randomRange:150 minNum:400]), +// AASeriesElement.new +// .nameSet(@"2020") +// .lineWidthSet(@6) +// .dataSet([self generateRandomNumberArrayWithLength:3550 randomRange:150 minNum:600]), +// ]); +//} + + //https://github.com/AAChartModel/AAChartKit/issues/1419 + public static AAChartModel lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement() { + return new AAChartModel() + .chartType(AAChartType.Line) + .backgroundColor("#000000") + .colorsTheme(new String[]{"#1e90ff", "#04d69f", "#ef476f", "#ffd066"}) + .dataLabelsEnabled(false) + .markerRadius(0f) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2017") + .lineWidth(6f) + .data(generateRandomNumberMixedNullArrayWithLength(3550, 5, 100).toArray()), + new AASeriesElement() + .name("2018") + .lineWidth(6f) + .data(generateRandomNumberArrayWithLength(3550, 100, 200).toArray()), + new AASeriesElement() + .name("2019") + .lineWidth(6f) + .data(generateRandomNumberArrayWithLength(3550, 150, 400).toArray()), + new AASeriesElement() + .name("2020") + .lineWidth(6f) + .data(generateRandomNumberArrayWithLength(3550, 150, 600).toArray()), + }); + } + + public static AAChartModel largeDataStackingColumnChart() { + return new AAChartModel() + .chartType(AAChartType.Column) + .backgroundColor("#000000") + .colorsTheme(new String[]{"#1e90ff", "#04d69f", "#ef476f", "#ffd066"}) + .dataLabelsEnabled(false) + .stacking(AAChartStackingType.Normal) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("2018") + .lineWidth(6f) + .data(generateRandomNumberArrayWithLength(3550, 100, 200).toArray()), + new AASeriesElement() + .name("2019") + .lineWidth(6f) + .data(generateRandomNumberArrayWithLength(3550, 150, 400).toArray()), + new AASeriesElement() + .name("2020") + .lineWidth(6f) + .data(generateRandomNumberArrayWithLength(3550, 150, 600).toArray()), + }); + } + + ////https://github.com/AAChartModel/AAChartCore-Kotlin/issues/149 + //- (AAChartModel *)customAreasplineChartWithColorfulGradientColorZones { + // NSArray *redStopsArr = @[ + // @[@0.0, AARgbaColor(255, 0, 0, 1.0)],//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + // @[@1.0, AAColor.clearColor] + // ]; + // + // NSArray *greenStopsArr = @[ + // @[@0.0, AARgbaColor(0, 255, 0, 1.0)],//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + // @[@1.0, AAColor.clearColor] + // ]; + // + // NSArray *blueStopsArr = @[ + // @[@0.0, AARgbaColor(0, 0, 255, 1.0)],//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + // @[@1.0, AAColor.clearColor] + // ]; + // + // NSDictionary *redGradientColorDic = [AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToBottom stopsArray:redStopsArr]; + // NSDictionary *greenGradientColorDic = [AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToBottom stopsArray:greenStopsArr]; + // NSDictionary *blueGradientColorDic = [AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToBottom stopsArray:blueStopsArr]; + // + // AADataElement *singleSpecialData = AADataElement.new + // .markerSet(AAMarker.new + // .radiusSet(@8)//鏇茬嚎杩炴帴鐐瑰崐寰� + // .symbolSet(AAChartSymbolTypeCircle)//鏇茬嚎鐐圭被鍨嬶細"circle", "square", "diamond", "triangle","triangle-down"锛岄粯璁ゆ槸"circle" + // .fillColorSet(AAColor.whiteColor)//鐐圭殑濉厖鑹�(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑濉厖鑹�) + // .lineWidthSet(@5)//澶栨部绾跨殑瀹藉害(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑杞粨鎻忚竟鐨勫搴�) + // //澶栨部绾跨殑棰滆壊(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑杞粨鎻忚竟棰滆壊锛屽綋鍊间负绌哄瓧绗︿覆鏃讹紝榛樿鍙栨暟鎹偣鎴栨暟鎹垪鐨勯鑹�) + // .lineColorSet(@"#1E90FF")//閬撳钃� + // ) + // .dataLabelsSet(AADataLabels.new + // .enabledSet(true) + // .allowOverlapSet(true) + // .useHTMLSet(true) + // .backgroundColorSet(AARgbaColor(65, 111, 166, 1.0)) + // .borderRadiusSet(@10) + // .shapeSet(@"callout") + // .formatSet(@"{point.category}<br>{series.name}: {point.y} %") + // .styleSet(AAStyleColorSizeWeight(AAColor.whiteColor, 12, AAChartFontWeightTypeBold)) + // .xSet(@-80).ySet(@(5)) + // .alignSet(AAChartAlignTypeCenter) + // .verticalAlignSet(AAChartVerticalAlignTypeTop) + // .overflowSet(@"none") + // .cropSet(false) + // ) + // .ySet(@85.3); + // + // AAStyle *axisLabelsStyle = AAStyleColorSizeWeight(AAColor.whiteColor, 12, AAChartFontWeightTypeBold); + // + // return AAChartModel.new + // .chartTypeSet(AAChartTypeAreaspline) + // .backgroundColorSet(AAColor.blackColor) + // .categoriesSet(@[ + // @"Jan", @"Feb", @"Mar", @"Apr", @"May", @"Jun", + // @"Jul", @"Aug", @"Sep", @"Oct", @"Nov", @"Dec" + // ]) + // .dataLabelsEnabledSet(false) + // .legendEnabledSet(false) + // .markerRadiusSet(@0) + // .xAxisLabelsStyleSet(axisLabelsStyle) + // .yAxisLabelsStyleSet(axisLabelsStyle) + // .xAxisGridLineStyleSet([AALineStyle styleWithColor:AAColor.whiteColor dashStyle:AAChartLineDashStyleTypeLongDashDotDot width:@0.5]) + // .yAxisGridLineStyleSet([AALineStyle styleWithWidth:@0]) + // .seriesSet(@[ + // AASeriesElement.new + // .nameSet(@"绌烘皵婀垮害") + // .lineWidthSet(@6) + // .zoneAxisSet(@"x") + // .zonesSet(@[ + // AAZonesElement.new + // .valueSet(@2) + // .colorSet(AAColor.redColor) + // .fillColorSet((id)redGradientColorDic ), + // AAZonesElement.new + // .valueSet(@5) + // .colorSet(AAColor.greenColor) + // .fillColorSet((id)greenGradientColorDic), + // AAZonesElement.new + // .colorSet(AAColor.blueColor) + // .fillColorSet((id)blueGradientColorDic), + // ]) + // .dataSet(@[@56.5, @33.3, @85.3, @23.9, @29.6, @34.5, @28.2, @26.5, @15.2, @56.5, @33.3, singleSpecialData]), + // ]); + //} + + //https://github.com/AAChartModel/AAChartCore-Kotlin/issues/149 + public static AAChartModel customAreasplineChartWithColorfulGradientColorZones() { + Object[][] redStopsArr = new Object[][]{ + new Object[]{0.0f, AARgba(255, 0, 0, 1.0f)},//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + new Object[]{1.0f, AAColor.Clear} + }; + + Object[][] greenStopsArr = new Object[][]{ + new Object[]{0.0f, AARgba(0, 255, 0, 1.0f)}, + new Object[]{1.0f, AAColor.Clear} + }; + + Object[][] blueStopsArr = new Object[][]{ + new Object[]{0.0f, AARgba(0, 0, 255, 1.0f)}, + new Object[]{1.0f, AAColor.Clear} + }; + + Map<String, Object> redGradientColorDic = AAGradientColor.linearGradient(AALinearGradientDirection.ToBottom, redStopsArr); + Map<String, Object> greenGradientColorDic = AAGradientColor.linearGradient(AALinearGradientDirection.ToBottom, greenStopsArr); + Map<String, Object> blueGradientColorDic = AAGradientColor.linearGradient(AALinearGradientDirection.ToBottom, blueStopsArr); + + AADataElement singleSpecialData = new AADataElement() + .marker(new AAMarker() + .radius(8f)//鏇茬嚎杩炴帴鐐瑰崐寰� + .symbol(AAChartSymbolType.Circle)//鏇茬嚎鐐圭被鍨嬶細"circle", "square", "diamond", "triangle","triangle-down"锛岄粯璁ゆ槸"circle" + .fillColor(AAColor.White)//鐐圭殑濉厖鑹�(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑濉厖鑹�) + .lineWidth(5f)//澶栨部绾跨殑瀹藉害(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑杞粨鎻忚竟鐨勫搴�) + //澶栨部绾跨殑棰滆壊(鐢ㄦ潵璁剧疆鎶樼嚎杩炴帴鐐圭殑杞粨鎻忚竟棰滆壊锛屽綋鍊间负绌哄瓧绗︿覆鏃讹紝榛樿鍙栨暟鎹偣鎴栨暟鎹垪鐨勯鑹�) + .lineColor(AAColor.Red) + ) + .dataLabels(new AADataLabels() + .enabled(true) + .allowOverlap(true) + .useHTML(true) + .backgroundColor(AARgba(65, 111, 166, 1.0f)) + .borderRadius(10f) + .shape("callout") + .format("{point.category}<br>{series.name}: {point.y} %") + .style(new AAStyle() + .color(AAColor.White) + .fontSize(12f) + .fontWeight(AAChartFontWeightType.Bold) + ) + .x(-80f) + .y(5f) + .align(AAChartAlignType.Center) + .verticalAlign(AAChartVerticalAlignType.Top) + .overflow("none") + .crop(false) + ) + .y(85.3f); + + AAStyle axisLabelsStyle = new AAStyle() + .color(AAColor.White) + .fontSize(12f) + .fontWeight(AAChartFontWeightType.Bold); + + return new AAChartModel() + .chartType(AAChartType.Areaspline) + .backgroundColor(AAColor.Black) + .categories(new String[]{ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }) + .dataLabelsEnabled(false) + .legendEnabled(false) + .markerRadius(0f) +// .xAxisLabelsStyle(axisLabelsStyle) +// .yAxisLabelsStyle(axisLabelsStyle) +// .xAxisGridLineStyle(new AALineStyle() +// .color(AAColor.White) +// .dashStyle(AAChartLineDashStyleType.LongDashDotDot) +// .width(0.5f) +// ) +// .yAxisGridLineStyle(new AALineStyle() +// .width(0f) +// ) + .series(new AASeriesElement[]{ + new AASeriesElement() + .name("绌烘皵婀垮害") + .lineWidth(6f) + .zoneAxis("x") + .zones(new AAZonesElement[]{ + new AAZonesElement() + .value(2) + .color(AAColor.Red) + .fillColor(redGradientColorDic), + new AAZonesElement() + .value(5) + .color(AAColor.Green) + .fillColor(greenGradientColorDic), + new AAZonesElement() + .color(AAColor.Blue) + .fillColor(blueGradientColorDic), + }) + .data(new Object[]{ + 56.5f, 33.3f, 85.3f, 23.9f, 29.6f, 34.5f, 28.2f, 26.5f, 15.2f, 56.5f, 33.3f, singleSpecialData + }), + }); + + + } + +} 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..691f49c 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,6 +1,55 @@ 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; @@ -28,9 +77,15 @@ FragmentHomePageBinding viewBinding; - AAChartView aaChartView; + AAChartView aaChartView1; - AAChartModel aaChartModel; + AAChartModel aaChartModel1; + AAChartView aaChartView2; + + AAChartModel aaChartModel2; + AAChartView aaChartView3; + + AAChartModel aaChartModel3; @Override @@ -41,47 +96,172 @@ @Override public void onBindView(Bundle savedInstanceState) { - setUpAAChartView(); - viewBinding.test.setOnClickListener(new View.OnClickListener() { + 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() { - aaChartView = viewBinding.AAChartView; - aaChartView.callBack = this; - aaChartModel = configureAAChartModel(); - aaChartView.aa_drawChartWithChartModel(aaChartModel); + 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 = 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 diff --git a/app/src/main/res/drawable/add.png b/app/src/main/res/drawable/add.png index 2ab7acb..5e82768 100644 --- a/app/src/main/res/drawable/add.png +++ b/app/src/main/res/drawable/add.png Binary files differ diff --git a/app/src/main/res/drawable/bj_13_ffffff.xml b/app/src/main/res/drawable/bj_13_ffffff.xml new file mode 100644 index 0000000..6fb80d7 --- /dev/null +++ b/app/src/main/res/drawable/bj_13_ffffff.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="@dimen/dp_13" /> + <gradient + android:angle="315" + android:endColor="#00FFECD9" + android:startColor="#FFE2C6" /> +</shape> \ No newline at end of file diff --git a/app/src/main/res/drawable/disc.png b/app/src/main/res/drawable/disc.png new file mode 100644 index 0000000..fd23fba --- /dev/null +++ b/app/src/main/res/drawable/disc.png Binary files differ diff --git a/app/src/main/res/drawable/home_page_selected.png b/app/src/main/res/drawable/home_page_selected.png new file mode 100644 index 0000000..63c8549 --- /dev/null +++ b/app/src/main/res/drawable/home_page_selected.png Binary files differ diff --git a/app/src/main/res/drawable/home_page_unselected.png b/app/src/main/res/drawable/home_page_unselected.png new file mode 100644 index 0000000..ddf808d --- /dev/null +++ b/app/src/main/res/drawable/home_page_unselected.png Binary files differ diff --git a/app/src/main/res/drawable/info_1.png b/app/src/main/res/drawable/info_1.png new file mode 100644 index 0000000..31d4755 --- /dev/null +++ b/app/src/main/res/drawable/info_1.png Binary files differ diff --git a/app/src/main/res/drawable/me_selected.png b/app/src/main/res/drawable/me_selected.png new file mode 100644 index 0000000..373d160 --- /dev/null +++ b/app/src/main/res/drawable/me_selected.png Binary files differ diff --git a/app/src/main/res/drawable/me_unselected.png b/app/src/main/res/drawable/me_unselected.png new file mode 100644 index 0000000..2832896 --- /dev/null +++ b/app/src/main/res/drawable/me_unselected.png Binary files differ diff --git a/app/src/main/res/drawable/message_selected.png b/app/src/main/res/drawable/message_selected.png new file mode 100644 index 0000000..baabed1 --- /dev/null +++ b/app/src/main/res/drawable/message_selected.png Binary files differ diff --git a/app/src/main/res/drawable/message_unselected.png b/app/src/main/res/drawable/message_unselected.png index f79a0d2..2832896 100644 --- a/app/src/main/res/drawable/message_unselected.png +++ b/app/src/main/res/drawable/message_unselected.png Binary files differ diff --git a/app/src/main/res/drawable/power_station_selected.png b/app/src/main/res/drawable/power_station_selected.png new file mode 100644 index 0000000..4d12406 --- /dev/null +++ b/app/src/main/res/drawable/power_station_selected.png Binary files differ diff --git a/app/src/main/res/drawable/power_station_unselected.png b/app/src/main/res/drawable/power_station_unselected.png new file mode 100644 index 0000000..3331876 --- /dev/null +++ b/app/src/main/res/drawable/power_station_unselected.png Binary files differ diff --git a/app/src/main/res/drawable/station_status_no_ffffff.xml b/app/src/main/res/drawable/station_status_no_ffffff.xml new file mode 100644 index 0000000..64bcd73 --- /dev/null +++ b/app/src/main/res/drawable/station_status_no_ffffff.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="@dimen/dp_8" /> + <solid android:color="#FFFFFF" /> +</shape> diff --git a/app/src/main/res/drawable/station_status_sele_38c494.xml b/app/src/main/res/drawable/station_status_sele_38c494.xml new file mode 100644 index 0000000..889a8bc --- /dev/null +++ b/app/src/main/res/drawable/station_status_sele_38c494.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="@dimen/dp_8" /> + <solid android:color="#38c494" /> +</shape> diff --git a/app/src/main/res/layout/fragment_home_page.xml b/app/src/main/res/layout/fragment_home_page.xml index 7fad83e..0eddf0e 100644 --- a/app/src/main/res/layout/fragment_home_page.xml +++ b/app/src/main/res/layout/fragment_home_page.xml @@ -7,25 +7,305 @@ tools:context=".ui.home.HomePageFragment"> <TextView - android:id="@+id/test" + android:id="@+id/home_page_title_tv" + style="@style/Text20Style" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鐐瑰嚮娴嬭瘯" - android:textSize="@dimen/dp_30" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" + android:layout_height="@dimen/dp_24" + android:layout_marginStart="@dimen/dp_16" + android:layout_marginTop="@dimen/dp_9" + android:text="@string/power_shome_page" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - <com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView - android:id="@+id/AAChartView" + <ImageView + android:id="@+id/home_page_station_add_iv" + android:layout_width="@dimen/dp_18" + android:layout_height="@dimen/dp_18" + android:layout_marginTop="@dimen/dp_9" + android:layout_marginEnd="@dimen/dp_24" + android:src="@drawable/add" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <LinearLayout + android:id="@+id/home_page_station_ll" + android:layout_width="0dp" + android:layout_height="@dimen/dp_56" + android:layout_marginTop="@dimen/dp_26" + android:layout_marginEnd="@dimen/dp_16" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@+id/home_page_title_tv" + app:layout_constraintTop_toBottomOf="@+id/home_page_title_tv"> + <!--鍏ㄩ儴--> + <include + android:id="@+id/home_page_station_all_ic" + layout="@layout/item_station" /> + + <View + android:layout_width="15.5dp" + android:layout_height="match_parent" /> + <!--鏁呴殰--> + <include + android:id="@+id/home_page_station_fault_ic" + layout="@layout/item_station" /> + + <View + android:layout_width="16dp" + android:layout_height="match_parent" /> + <!--绂荤嚎--> + <include + android:id="@+id/home_page_station_offline_ic" + layout="@layout/item_station" /> + + <View + android:layout_width="15.5dp" + android:layout_height="match_parent" /> + <!--寰呮帴鍏�--> + <include + android:id="@+id/home_page_station_connected_ic" + layout="@layout/item_station" /> + + + </LinearLayout> + + + <ScrollView android:layout_width="0dp" android:layout_height="0dp" - android:layout_marginTop="@dimen/dp_30" + android:layout_marginStart="@dimen/dp_16" + android:layout_marginEnd="@dimen/dp_16" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/test" /> + app:layout_constraintTop_toBottomOf="@+id/home_page_station_ll"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/home_page_station_info_cl" + android:layout_width="0dp" + android:layout_height="312dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <RelativeLayout + android:id="@+id/home_page_station_info_rl1" + android:layout_width="0dp" + android:layout_height="146dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <RelativeLayout + android:id="@+id/home_page_station_info_rl1_f" + android:layout_width="102dp" + android:layout_height="102dp" + android:layout_marginTop="@dimen/dp_22" + android:background="@drawable/disc"> + + <TextView + android:id="@+id/home_page_station_info_rl1_f_text1_tv" + android:layout_width="62dp" + android:layout_height="31.5dp" + android:layout_centerVertical="true" + android:gravity="end|center_vertical" + android:text="88" + android:textSize="@dimen/text_26" + android:textStyle="bold" /> + + <TextView + android:id="@+id/home_page_station_info_rl1_f_text2_tv" + android:layout_width="9dp" + android:layout_height="14.5dp" + android:layout_alignBottom="@+id/home_page_station_info_rl1_f_text1_tv" + android:layout_marginStart="2.5dp" + android:layout_marginBottom="4.5dp" + android:layout_toEndOf="@+id/home_page_station_info_rl1_f_text1_tv" + android:text="%" + android:textColor="@color/text_191919" + android:textSize="@dimen/text_12" /> + </RelativeLayout> + + + <TextView + android:id="@+id/home_page_station_info_rl1_text1_tv" + style="@style/Text20Style" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_24" + android:layout_marginStart="@dimen/dp_16" + android:layout_marginTop="@dimen/dp_21" + android:layout_toEndOf="@+id/home_page_station_info_rl1_f" + android:text="33333333" /> + + <TextView + android:id="@+id/home_page_station_info_rl1_text2_tv" + style="@style/Text14Style" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_17" + android:layout_below="@+id/home_page_station_info_rl1_text1_tv" + android:layout_alignStart="@+id/home_page_station_info_rl1_text1_tv" + android:layout_marginTop="3dp" + android:text="kw.h" /> + + <TextView + android:id="@+id/home_page_station_info_rl1_text3_tv" + style="@style/Text20Style" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_24" + android:layout_below="@+id/home_page_station_info_rl1_text2_tv" + android:layout_alignStart="@+id/home_page_station_info_rl1_text1_tv" + android:layout_marginTop="@dimen/dp_16" + android:text="33333" /> + + <TextView + android:id="@+id/home_page_station_info_rl1_text4_tv" + style="@style/Text14Style" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_17" + android:layout_below="@+id/home_page_station_info_rl1_text3_tv" + android:layout_alignStart="@+id/home_page_station_info_rl1_text1_tv" + android:layout_marginTop="3dp" + android:text="kw.h" /> + + </RelativeLayout> + + <RelativeLayout + android:id="@+id/home_page_station_info_rl2" + android:layout_width="match_parent" + android:layout_height="@dimen/dp_166" + android:background="@drawable/bj_13_ffffff" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/home_page_station_info_rl1"> + + <ImageView + android:layout_width="25dp" + android:layout_height="22dp" + android:layout_marginStart="15.5dp" + android:layout_marginTop="10.5dp" + android:src="@drawable/info_1" /> + + <TextView + android:id="@+id/home_page_station_info_rl1_title_tv" + android:layout_width="wrap_content" + android:layout_height="14.5dp" + android:layout_marginStart="@dimen/dp_47" + android:layout_marginTop="17dp" + android:text="Electricity /kw.h" + android:textColor="@color/text_191919" + android:textSize="@dimen/text_12" /> + + <include + android:id="@+id/home_page_station_info_rl2_day_ic" + layout="@layout/item_data" + android:layout_width="@dimen/dp_171" + android:layout_height="@dimen/dp_44" + android:layout_marginTop="47.5dp" /> + + <View + android:id="@+id/line1_v" + android:layout_width="0.5dp" + android:layout_height="37.5dp" + android:layout_marginTop="53dp" + android:layout_toEndOf="@+id/home_page_station_info_rl2_day_ic" + android:background="@color/text_E1E1E1" /> + + <include + android:id="@+id/home_page_station_info_rl2_mon_ic" + layout="@layout/item_data" + android:layout_width="@dimen/dp_171" + android:layout_height="@dimen/dp_44" + android:layout_marginTop="47.5dp" + android:layout_toEndOf="@+id/line1_v" /> + + <include + android:id="@+id/home_page_station_info_rl2_year_ic" + layout="@layout/item_data" + android:layout_width="@dimen/dp_171" + android:layout_height="@dimen/dp_44" + android:layout_marginTop="106dp" /> + + <View + android:id="@+id/line2_v" + android:layout_width="0.5dp" + android:layout_height="37.5dp" + android:layout_marginTop="109.5dp" + android:layout_toEndOf="@+id/home_page_station_info_rl2_year_ic" + android:background="@color/text_E1E1E1" /> + + <include + android:id="@+id/home_page_station_info_rl2_cumulative_ic" + layout="@layout/item_data" + android:layout_width="@dimen/dp_171" + android:layout_height="@dimen/dp_44" + android:layout_marginTop="106dp" + android:layout_toEndOf="@+id/line2_v" /> + + </RelativeLayout> + </androidx.constraintlayout.widget.ConstraintLayout> + + <TextView + android:id="@+id/test1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鐐瑰嚮娴嬭瘯1" + android:textSize="@dimen/text_30" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/home_page_station_info_cl" /> + + <com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView + android:id="@+id/AAChartView1" + android:layout_width="0dp" + android:layout_height="300dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/test1" /> + + <TextView + android:id="@+id/test2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鐐瑰嚮娴嬭瘯2" + android:textSize="@dimen/text_30" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/AAChartView1" /> + + <com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView + android:id="@+id/AAChartView2" + android:layout_width="0dp" + android:layout_height="300dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/test2" /> + + <TextView + android:id="@+id/test3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鐐瑰嚮娴嬭瘯3" + android:textSize="@dimen/text_30" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/AAChartView2" /> + + <com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView + android:id="@+id/AAChartView3" + android:layout_width="0dp" + android:layout_height="300dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/test3" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + + </ScrollView> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/item_data.xml b/app/src/main/res/layout/item_data.xml new file mode 100644 index 0000000..9c4c3ba --- /dev/null +++ b/app/src/main/res/layout/item_data.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="@dimen/dp_171" + android:layout_height="@dimen/dp_44"> + + <TextView + android:id="@+id/data_tv" + style="@style/Text20Style" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_24" + android:text="33333" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/data_type_tv" + style="@style/Text14Style" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_17" + android:layout_marginTop="3dp" + android:text="kw.h" + app:layout_constraintEnd_toEndOf="@+id/data_tv" + app:layout_constraintStart_toStartOf="@+id/data_tv" + app:layout_constraintTop_toBottomOf="@+id/data_tv" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/item_station.xml b/app/src/main/res/layout/item_station.xml new file mode 100644 index 0000000..845f2c1 --- /dev/null +++ b/app/src/main/res/layout/item_station.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/station_status_cl" + android:layout_width="@dimen/dp_74" + android:layout_height="@dimen/dp_56" + android:background="@drawable/station_status_no_ffffff"> + + <TextView + android:id="@+id/station_status_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_25" + android:layout_marginTop="7dp" + android:text="99" + android:textColor="@color/text_90000000" + android:textSize="@dimen/text_14" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/station_status_number_tv" + android:layout_width="wrap_content" + android:layout_height="@dimen/dp_17" + android:layout_marginTop="1dp" + android:text="state" + android:textColor="@color/text_40000000" + android:textSize="@dimen/text_14" + app:layout_constraintEnd_toEndOf="@+id/station_status_tv" + app:layout_constraintStart_toStartOf="@+id/station_status_tv" + app:layout_constraintTop_toBottomOf="@+id/station_status_tv" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 4fac929..7fe8ad5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -4,8 +4,29 @@ <item name="android:background">@color/black_overlay</item> <item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item> </style> + <style name="NoAnimationTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowAnimationStyle">@null</item> </style> + <!-- 鑷畾涔夊瓧浣撴牱寮� 椤甸潰涓�绾ф爣棰�--> + <style name="Text20Style"> + <item name="android:textSize">@dimen/text_20</item> + <item name="android:textStyle">bold</item> + <item name="android:textColor">@color/text_90000000</item> + + </style> + <!-- 鑷畾涔夊瓧浣撴牱寮� 鍐呭涓�绾ф爣棰�--> + <style name="Text21Style"> + <item name="android:textSize">@dimen/text_21</item> + <item name="android:textStyle">bold</item> + <item name="android:textColor">@color/text_90000000</item> + + </style> + <!-- 鑷畾涔夊瓧浣撴牱寮� --> + <style name="Text14Style"> + <item name="android:textSize">@dimen/text_14</item> + <item name="android:textColor">@color/text_40000000</item> + </style> + </resources> \ No newline at end of file -- Gitblit v1.8.0