Pregunta

Tengo mi jqploto con eje de escala de registro que se parece a esto:

My Log Graph

y aquí está mi configuración de eje X e Y para mi JQPLOT:

            axes : {
            xaxis : {
                renderer : $j.jqplot.LogAxisRenderer,
                ticks : [0.1, 1, 10, 100],
            },
            yaxis : {
                renderer : $j.jqplot.LogAxisRenderer,           
                ticks : [0.1, 1, 10, 100],
            },
        }

Pero me gustaría mostrar las redes menores que se ve exactamente como esta:

log gráfico que quiero

¿Cómo podría hacer esto?

¿Fue útil?

Solución

max = 100;
min = 1;

// calculate the power of 10 of max value
var dcmMax = Math.floor(Math.log(max)/Math.log(10));

// calculate the power of 10 of min value
var dcmMin = Math.floor(Math.log(min)/Math.log(10));

var ticks = [];
var tick, f;

for (var i = dcmMin ; i <= dcmMax ; i++){

    tick = Math.floor(Math.log(i)/Math.log(10));

    if (i == dcmMin){
       ticks.push(tick.toFixed(1));
    }

    f = tick;

    for (var j = 0; j < 8; j++){
        tick = tick + f;
        ticks.push(myTick(tick.toFixed(1)));
    }

    if (i == dcmMax){
        ticks.push(tick.toFixed(1));
    }
}

function myTick(value){
return {value:value, showLabel:false, showMark:false};
}

Esto creará garrapatas principales con 1.0, 10.0, 100.0, 1000.0, y mostrará solo la línea de cuadrícula sin garrapatas menores, ya que el valor respectivo de ShowLabel y ShowMark se establece en FALSO

Otros consejos

¿Alguna respuesta mejor que la mía?

    majorTicks = [      
                    1,
                    {value:2, showLabel:false, showMark:false},
                    {value:3, showLabel:false, showMark:false},
                    {value:4, showLabel:false, showMark:false},
                    {value:5, showLabel:false, showMark:false},
                    {value:6, showLabel:false, showMark:false},
                    {value:7, showLabel:false, showMark:false},
                    {value:8, showLabel:false, showMark:false},
                    {value:9, showLabel:false, showMark:false},
                    10,
                    {value:20, showLabel:false, showMark:false},
                    {value:30, showLabel:false, showMark:false},    
                    {value:40, showLabel:false, showMark:false},    
                    {value:50, showLabel:false, showMark:false},    
                    {value:60, showLabel:false, showMark:false},    
                    {value:70, showLabel:false, showMark:false},    
                    {value:80, showLabel:false, showMark:false},
                    {value:90, showLabel:false, showMark:false},    
                    100
                ];

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top