-4

I am new to JavaScript. Here I am plotting a graph. Since the values are very high the graph looks mess. So I would like to take logarithmic scale in x axis and y axis. Could you please advice me how to do that in JavaScript? Thanks in advance.

Raghavi
  • 321
  • 2
  • 4
  • 19

1 Answers1

0

Try using Math.log() method to calculate the log base e of a number. I am assuming that you have an array of numbers for X axis and Y axis. Call Math.log() method in a for loop for all the elements present in the array for X and Y axis and plot them in a graph. I believe you already have code for plotting arrays on a graph. For more information on Math.log() method, refer to this document: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log

Raman
  • 44
  • 7