From 12d6db5780d8a2121a3bef2d58bf897b24ff552a Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 12 六月 2024 15:54:29 +0800 Subject: [PATCH] Merge branch 'dev' --- app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/CustomStyleChartComposer.java | 2106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 2,106 insertions(+), 0 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/CustomStyleChartComposer.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/CustomStyleChartComposer.java new file mode 100644 index 0000000..5cc68c7 --- /dev/null +++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/CustomStyleChartComposer.java @@ -0,0 +1,2106 @@ +package com.hdl.photovoltaic.ui.home.aachart; + +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.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(String tipSuspendName, String[] categories, Object[] data) { + Object[][] stopsArr = { + {1.00, "#38C494"}, + };//棰滆壊瀛楃涓茶缃敮鎸佸崄鍏繘鍒剁被鍨嬪拰 rgba 绫诲瀷 + + Map<String, Object> linearGradientColor = AAGradientColor.linearGradient( + AALinearGradientDirection.ToBottom, + stopsArr + ); + AATooltip aaTooltip = new AATooltip() + .enabled(true) + .valueDecimals(2); + return new AAChartModel() + .chartType(AAChartType.Column) + .backgroundColor("#EDEFF2") + .colorsTheme(new String[]{"#38C494",}) + .categories(categories) + .xAxisLabelsEnabled(true) + .zoomType(AAChartZoomType.None) + .legendEnabled(false) + .series(new AASeriesElement[]{ + new AASeriesElement() +// .color(linearGradientColor) + .name(tipSuspendName) + .data(data) +// .colorByPoint(true) + .tooltip(aaTooltip) + + }); + } + + 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(AAChartSymbolConst.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(AAChartSymbolConst.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(AAChartSymbolConst.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(AAChartSymbolConst.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 + }), + }); + + + } + +} -- Gitblit v1.8.0