Browse Source

Fix #133 => Add splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle sample

An An 2 years ago
parent
commit
f77b07f080

+ 1 - 0
sample/src/main/java/com/github/aachartmodel/aainfographics/demo/basiccontent/CustomStyleChartActivity.kt

@@ -96,6 +96,7 @@ class CustomStyleChartActivity : AppCompatActivity() {
              "customBarChartHoverColorAndSelectColor"-> return CustomStyleChartComposer.customBarChartHoverColorAndSelectColor()
              "customChartHoverAndSelectHaloStyle"-> return CustomStyleChartComposer.customChartHoverAndSelectHaloStyle()
              "customSplineChartMarkerStatesHoverStyle"-> return CustomStyleChartComposer.customSplineChartMarkerStatesHoverStyle()
+            "splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle" -> return CustomStyleChartComposer.splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle()
              "customNormalStackingChartDataLabelsContentAndStyle"-> return CustomStyleChartComposer.customNormalStackingChartDataLabelsContentAndStyle()
              "upsideDownPyramidChart"-> return CustomStyleChartComposer.upsideDownPyramidChart()
              "doubleLayerPieChart"-> return CustomStyleChartComposer.doubleLayerPieChart()

+ 2 - 0
sample/src/main/java/com/github/aachartmodel/aainfographics/demo/basiccontent/MainActivity.kt

@@ -75,6 +75,7 @@ class MainActivity : AppCompatActivity() {
                 "custom Bar Chart Hover Color and Select Color---自定义条形图手指滑动颜色和单个长条被选中颜色",
                 "custom Line Chart Chart Hover And Select Halo Style---自定义直线图手指略过和选中的 Halo 样式",
                 "custom Spline Chart Marker States Hover Style---自定义曲线图手指略过时的 Marker 样式",
+                "splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle---曲线图手指掠过时的 Hover 线不变形,并且自定义 Marker 样式",
                 "customNormalStackingChartDataLabelsContentAndStyle---自定义堆积柱状图 DataLabels 的内容及样式",
                 "upsideDownPyramidChart---倒立的金字塔图",
                 "doubleLayerPieChart---双层嵌套扇形图",
@@ -230,6 +231,7 @@ class MainActivity : AppCompatActivity() {
                 "customBarChartHoverColorAndSelectColor",
                 "customChartHoverAndSelectHaloStyle",
                 "customSplineChartMarkerStatesHoverStyle",
+                "splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle",
                 "customNormalStackingChartDataLabelsContentAndStyle",
                 "upsideDownPyramidChart",
                 "doubleLayerPieChart",

+ 30 - 0
sample/src/main/java/com/github/aachartmodel/aainfographics/demo/chartcomposer/CustomStyleChartComposer.kt

@@ -683,6 +683,35 @@ object CustomStyleChartComposer  {
                     .data(arrayOf(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
+    fun splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle(): AAChartModel {
+        return AAChartModel()
+            .chartType(AAChartType.Spline)
+            .title("Spline Chart Hover Line Width No Change && Custom Marker States Hover Style")
+            .categories(arrayOf(
+                "一月", "二月", "三月", "四月", "五月", "六月",
+                "七月", "八月", "九月", "十月", "十一月", "十二月"))
+            .markerRadius(8.0) //marker点半径为8个像素
+            .yAxisLineWidth(0)
+            .yAxisGridLineWidth(0)
+            .legendEnabled(false)
+            .markerSymbolStyle(AAChartSymbolStyleType.InnerBlank)
+            .series(arrayOf(
+                AASeriesElement()
+                    .name("Tokyo Hot")
+                    .lineWidth(5.0)
+                    .color(AAColor.Red)
+                    .states(AAStates()
+                        .hover(AAHover()
+                            .enabled(true)
+                            .lineWidthPlus(0))) //手指盘旋或选中图表时,禁止线条变粗
+                    .marker(AAMarker()
+                        .states(AAMarkerStates()
+                            .hover(AAMarkerHover()
+                                .fillColor(AAColor.Red) //设置手指选中点的颜色为红色
+                                .radius(40))))
+                    .data(arrayOf(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
     fun customNormalStackingChartDataLabelsContentAndStyle(): AAChartModel {
@@ -708,6 +737,7 @@ object CustomStyleChartComposer  {
         )
 
         val aaDataLabels = AADataLabels()
+            .enabled(true)
             .y(-10)
             .format("{total} mm")
             .color(AAColor.Red)