rrag/react-stockcharts-examples2

Logarithmic scale

0x-General opened this issue · 1 comments

Is it possible to use a logarithmic price scale?

Yes.

Since react-stockcharts are based on d3, you can use any scales from d3-scale library. For example, to use logarithmic scale, simply pass it to Chart component in the next way:

import { scaleLog } from 'd3-scale';

<ChartCanvas {...canvasProps}>
   <ChartCanvas yScale={scaleLog()} {...moreChartProps}>
       {/* ... axis, series, tooltips and other components */}
   </Chart>
</ChartCanvas>

Make sure that you have a call scaleLog(). Simply putting scaleLog won't work.

Disclaimer: I am not affiliated with this project in any way, just a random person who spotted your question.