Format jqPlot point labels like: number (percent)
javascript, jqplot, jquery, jquery-plugins
Solution
You can probably implement a function which returns a proper format string instead of setting the format explicitly. Something like this:
formatString: function(){return '%s (100%)';}()
You can do your calculations inside that function to come up with the appropriate string.
Problem
this is my first question. I need to format a jqPlot chart point labels like this: 50 (100%) Formating number and show percentage. ``` var s1 = [32, 28, 18, 6]; var ticks = ['0-20 kph', '21-40 kph', '41-60 kph', '61+ kph']; plot1 = $.jqplot('bar-graph', [s1], { animate: !$.jqplot.use_excanvas, title: 'Gráficos de velocidade', captureRightClick: true, seriesColors: ['green', 'yellow', 'orange', 'red'], seriesDefaults: { renderer: $.jqplot.BarRenderer, pointLabels: { show: true, formatString: '%s (?%%)' }, rendererOptions: { varyBarColor: true } }, axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks } }, highlighter: { show: false } }); ``` On jsFinddle: http://jsfiddle.net/evandroprogram/r3PUE/10/ Thanks.