【问题标题】:Show different colors for a line which lies in range in line chart in react native line chart wrapper在反应原生折线图包装器中为折线图中范围内的线显示不同的颜色
【发布时间】:2022-10-24 11:28:36
【问题描述】:

如果在某个范围内应该用不同的颜色显示,我需要在绘制时显示折线图。像这样的东西。但不知道如何展示。

直到现在我已经使用了这些 -

  <LineChart
          style={{flex:1}
          xAxis={{
            position: 'BOTTOM',
            drawGridLines: false,
            avoidFirstLastClipping: true,
            granularityEnabled: true,
            granularity: 1,
            valueFormatter: xAxisFormat,
            valueFormatterPattern: 'dd MMM',
            timeUnit: 'DAYS',
            axisLineWidth: 0,
            textColor: processColor(#ff6u79),
            textSize: 10,
          }}
          yAxis={{
            left: {
              textColor:processColor(#ff6u79,
              textSize: 10,
              axisLineWidth: 0,
              granularityEnabled: true,
              granularity: 1,
              axisMaximum: 120,
              axisMinimum: 80 
              gridDashedLine: { lineLength: 5, spaceLength: 5 },
              gridColor: processColor('#c1c9c4'),
            },
            right: { enabled: false }, 
          }}
          dragEnabled={false}
          drawBorders={false}
          data={data}
          animation={{ durationX: 1000 }}
          onSelect={() => console.log('on select')}
          onChange={(event) => console.log(event.nativeEvent)}
        />

我的数据集被用作 -

[{x: '08 Oct 2022 05:29', y: 78}, 
{x: '10 Oct 2022 05:29', y: 200},
{x: '10 Oct 2022 05:29', y: 80},
{x: '12 Oct 2022 05:29', y: 120},
{x: '18 Oct 2022 10:17', y: 90},
{x: '20 Oct 2022 11:37', y: 78}]

卡在这里。请帮忙。

请帮忙.. 在此也添加了详细信息

【问题讨论】:

    标签: android react-native charts react-native-charts-wrapper


    【解决方案1】:

    面临同样的问题。任何帮助,将不胜感激。

    【讨论】:

      猜你喜欢
      • 2022-01-21
      • 1970-01-01
      • 2014-08-27
      • 2019-07-16
      • 2013-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多