Vertical bars valued with flot.js

2

Hello.

I use flot.js to plot a "Stacked Bars" chart example but I wanted to insert the values of the bars "inside" the bar, not simply the tooltip.

Does anyone know how to do it?

    
asked by anonymous 12.03.2014 / 05:04

1 answer

2

There is a plugin to do this. I gave him some time back when I was working on a adaptation I made from Flot to MooTools.

The plugin link is: link

The new part required for options is, for example:

series: {
    valueLabels: {
        show: true,
        showAsHtml: true,
        labelFormatter: function (v) {
            return v + '%';
        }
    },

You'll probably have to adapt with CSS the exact position of the value as I did in the example using margin-top: 20px; . This plugin also has the advantage of having a function to change the values, ie add the percentage symbol or run a function on the values it shows.

Note that there is still another plugin to stack the bars, the stack (which I added to my example as well). The graphic also works without it, but the bars stay behind each other instead of one on top of the other. p>

Example

    
12.03.2014 / 08:53