Great work Mark
As the ticks of Y axis in Logarithmic graphs are in the format of power of 10,
I would like to share enhancement in Y axis ticks, Here it is.s
$(function () {
// setup plot
function sampleFunction(x1, x2, func) {
var d = [ ];
var step = (x2-x1)/300;
for (var i = x1; i < x2; i += step )
d.push([i, func( i ) ]);
return d;
}
var options1 = {
lines: { show: true },
xaxis: { ticks: 4 },
yaxis: { ticks: [0.001,0.01,0.1,1,10,100],
transform: function(v) {return Math.log(v+0.0001); /*move away from zero*/} , tickDecimals: 3 ,
tickFormatter: function (v, axis) {return "10" + (Math.round( Math.log(v)/Math.LN10)).toString().sup();}
},
grid: { hoverable: true, clickable: true , color: "#999"}
};
var data1 = sampleFunction( 0, 5, function(x){ return Math.exp(x)*Math.sin(x)*Math.sin(x) } );
var plot1 = $.plot($("#chart1"), [ { label: "exp(x)sin(x)" + "2".sup(), data: data1} ], options1);
});
Please let me know if there is any better way.
Thanks.