How do I make the Fl_Chart in Flutter have permanently visible and horizontal Indicator?

  Kiến thức lập trình

I have been trying to create an horizontal TouchedSpotIndicator on my FlChart in flutter and I want it to stay permanently(not just to be visible when chart is touched)
Similar to the effect of the current price in trading apps like the in the MT4 app as seen below;

Below is my code but this only shows the default vertical line and it also disappears after touching the chart;

        getTouchedSpotIndicator: (LineChartBarData barData, List<int> spotIndexes) {
          return spotIndexes.map((spotIndex) {
            final FlSpot spot = barData.spots[spotIndex];
            if (spot.x == 0 || spot.x == 6) {
              return null;
            }
            return TouchedSpotIndicatorData(

              FlLine(color: Color(0xFFFFAB56), strokeWidth: 2.5, dashArray: [7]),

              FlDotData(
                  show: true,
                  getDotPainter: (aa, bb, cc, dd) {

                    return FlDotCirclePainter(
                        color: Color(0xFFFFAB56),
                        radius: 7.5,
                        strokeWidth: 3.5,
                        strokeColor: Colors.white.withOpacity(0.5)
                    );
                  }
              ),
            );
          }).toList();
        },

I have searched the FLChart API and couldn’t get any solution to make the indicator;
(1) permanently visible
(2) to make the indicator an horizontal one.

Please suggest any help as it would be appreciated. Thank you for your time

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT