Skip to main content

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;

}







Is it possible?


Comments

  1. Use something like:

    var 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
    }
    }
    });

    ReplyDelete
  2. I've found a solution.

    xaxis: {
    tickRenderer: $.jqplot.AxisTickRenderer,
    tickOptions: {
    formatter: function(format, value) { return "This is " + value; }
    }
    }

    ReplyDelete
  3. Hey, I almost tweaked the renderer plugin to have the custom ticks implemented for the category axis. Tips For All, Your comment saved my life :-)

    Love,
    Kiran

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?