Вопрос

I am using jquery.flot.js (v 1.1) for graphs and for tooltip jquery.flot.tooltip.js (version: 0.6.7)

I wanted to show percentage area covered by each stack in stacked graph. I have tried it using %p. But it's not working, it return "%p" in tooltip. Code snippet:

tooltip: true,
tooltipOpts: {
  content: "%s : %y : %p.1%"
}

My graph is-

enter image description here

Could any one help me please ?

Это было полезно?

Решение

You can use %p only if you also use pie charts plugin http://www.flotcharts.org/flot/examples/series-pie/index.html, that placeholder was introduced only to support that plugin. I see that is not clear in the documentation.

In your case you need to count percentage value by yourself. You may use callback function for that. The format is function(label, xval, yval, flotItem) and must return a string in correct format (needed by tooltip).

Hope it helps!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top