问题
I'm trying to replicate what Amazon, Trip Advisor etc are doing and showing a tooltip type interface when hovering over an average review score to show the breakdown of scores in bar chart format - on the qtip forums it's said to use Flot (my first time using it as normally use google charts) but whilst the graph renders fine on the page when I take it outside of the tooltip, as soon as I put the div within it it doesn't work.
My page is: http://solicitor.info/demo/solicitors/?id=15
Can anyone please see what I'm doing wrong?
回答1:
When I hit your page, I get a javascript error:
Uncaught Invalid dimensions for plot, width = null, height = null
I'm guessing it is trying to render the plot while the "placeholder" div is still hidden inside the qtip.
I would try moving the $.plot
call into a qtip onShow callback. That way you are sure the div is shown before trying to render the plot.
来源:https://stackoverflow.com/questions/11275481/flot-within-jquery-qtip