Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
Dynamic Gridlines calculation

The problem

Hello! I am creating a graphing application. Now I am creating the gridlines for the graphing calculator.

To manage to zoom, I have two variables; scale_x for the X-axis, and scale_y for the Y-axis. When I am zooming the gridlines has to change accordingly to the scaling.

I am trying to accomplish something like https://www.geogebra.org/calculator 's gridlines.

Their gridlines always space with a number that is either, a*10^b where a∈{1,2,5} and b is just which "step" you're at. Just try zooming out and look at the gridlines.

What I got

I am currently spacing the gridlines relative to the grids coordinate system, NOT the width and height of the screen.

var distance_x = 100 / (2**Math.floor((getBaseLog(2, scale_x))));
var distance_y = 100 / (2**Math.floor((getBaseLog(2, scale_y))));

This bit of code spaces the gridlines nicely but only with 2^something.

I'm not even sure why this is working, but I need it to work as GeoGebra's gridlines.

Anyone got an idea?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda