Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Friday, February 17, 2012
jqPlot custom tick labels
I've got data with X values from 0 to 55. I would like to see these values as a custom text in tick labels. Ideally, I want to specify some callback, like
function tickLabel(tickValue) {
return "This is " + tickValue;
}
Use something like:
ReplyDeletevar line1 = [['This is '.$value, $value], ...]
And call your plot as:
var plot1 = $.jqplot('chart1', [line1], {
title: 'Title of your plot',
series:[{renderer:$.jqplot.BarRenderer}],
axesDefaults: {
tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
tickOptions: {
angle: -30,
fontSize: '10pt'
}
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer
}
}
});
I've found a solution.
ReplyDeletexaxis: {
tickRenderer: $.jqplot.AxisTickRenderer,
tickOptions: {
formatter: function(format, value) { return "This is " + value; }
}
}