react-native-charts-wrapper icon indicating copy to clipboard operation
react-native-charts-wrapper copied to clipboard

How to set log scale?

Open otaviobonder-deel opened this issue 3 years ago • 0 comments

Do read files under lib/* before reporting issues, you can find all the config there, all of them are straightforward.

Expected Behavior

Right now my yAxis has a linear scale:

image

Actual Behavior

I want to set the yAxis to have a logarithmic scale.

Data and config

style={styles.chart}
        data={{
          dataSets: [
            {
              label: 'BTCUSD',
              values: data.candleOHLC.map((d) => ({
                open: parseFloat(d.open),
                close: parseFloat(d.close),
                shadowH: parseFloat(d.high),
                shadowL: parseFloat(d.low),
              })),
              config: {
                drawValues: false,
                increasingColor: processColor('green'),
                increasingPaintStyle: 'FILL',
                decreasingColor: processColor('red'),
                shadowColorSameAsCandle: true,
                shadowColor: processColor('black'),
              },
            },
          ],
        }}
        marker={{
          enabled: true,
          markerColor: processColor('#2c3e50'),
          textColor: processColor('white'),
        }}
        legend={{enabled: false}}
        yAxis={{
          left: {
            enabled: false,
          },
        }}
        xAxis={{
          position: 'BOTTOM',
          valueFormatter: data.candleOHLC.map((obj) =>
            dayjs(obj.timestamp).format(
              dayjs(obj.timestamp).hour() === 0 ? 'DD' : 'LT',
            ),
          ),
          labelCount: 5,
        }}
        autoScaleMinMaxEnabled
        pinchZoom
        drawBorders
        zoom={{
          scaleX: 10,
          scaleY: 1,
          xValue: data.candleOHLC.length,
          yValue: 0,
          axisDependency: 'RIGHT',
        }}

otaviobonder-deel avatar Mar 01 '21 12:03 otaviobonder-deel