javascript - Flot: Show a minimum amount of ticks -


using flot charts specify minimum of ticks show on y-axis. in case show @ least 10 ticks (values 1-10), if y-axis max exceeds 10 flot draw chart normal tick algorithm. have sort of working specifying function ticks paramater.

ticks: function(axis){            var ticks = [];            if(axis.max < 10){                 ticks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];            }            else{              for(var = 1; < axis.max; i++){                  ticks.push(i);              }            }            return ticks; },  

the problem lot more ticks want when axis.max greater 10. there way avoid this?

i thought return null, flot expecting array returned. :(

if want default functionality tick generation can call tickgenerator function of axes. cleaner working piece of code don't maintain. in case, this:

ticks: function(axis){    return axis.max < 10 ? [1,2,3,4,5,6,7,8,9,10] : axis.tickgenerator(axis);  } 

Comments