4

I have my jqplot with log scale axis which is look like this:

my log graph

And here is my x and y axis setting for my jqplot:

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

But I would like to show the minor grids which is looks exactly like this:

log graph I want

How could I do this?

jhyap
  • 3,779
  • 6
  • 27
  • 47
  • The dashed grids are awful. Their rhythm dominates the chart, hiding whatever data you might want to show. In Excel prefer something like the second gray (=15%), 50% transparent, 0.25pt thick, no dashing. Which is less fussy, and slightly darker than too-faint-to-see. Other applications will have equivalents. – jdaw1 May 03 '18 at 07:45

2 Answers2

3
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};
}

this will create major ticks with 1.0 , 10.0, 100.0, 1000.0, and show only gridline without minor ticks since the respective value of showLabel and showMark is set to false

jhyap
  • 3,779
  • 6
  • 27
  • 47
tcboy88
  • 1,063
  • 1
  • 9
  • 23
1

Any answer better than mine?

    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
                ];
jhyap
  • 3,779
  • 6
  • 27
  • 47