JqPlot Custom Label Tags

I have data with X values ​​from 0 to 55. I would like to see these values ​​as custom text in tick marks. Ideally, I want to specify some callback like

function tickLabel(tickValue) { return "This is " + tickValue; } 

Is it possible?

+6
source share
2 answers

I have found a solution.

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

Use something like:

 var line1 = [['This is '.$value, $value], ...] 

And name 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 } } }); 
+2
source

Source: https://habr.com/ru/post/908340/


All Articles