标签未正确放置在浮动条形图上 [英] Labels not getting placed properly over flot bar chart
问题描述
我正在使用jquery mobile和flot图表开发应用程序.
I am developing an application using jquery mobile and flot charts.
在那我有3个标签. 我在第一个选项卡上显示图表,但是发生的奇怪的是,如果我在第一个选项卡上绘制图形,则标签会放错地方./coderslay/Sp8MP/"rel =" nofollow> jsFiddle代码
In That i have 3 tabs. I am displaying my chart on the first tab.But the weird thing which is happening is that if i plot the graph in the first tab then my labels get misplaced.Here is the fiddle jsFiddle code
但是,如果假设我在第二个或第三个选项卡中绘制图形,那么我的图表是正确的.我的代码在这里 jsfiddle代码
But if suppose i plot my graph in second or third tab then my charts are correct. My code is here jsfiddle code
为什么会这样?
推荐答案
我明白了.
我只需要将plot.Offset()
更改为plot.getPlotOffset()
然后它可以正常工作.
I got it.
I just need to change plot.Offset()
to plot.getPlotOffset()
Then its working correctly.
offset()- 返回相对于网格内部的绘图区域的偏移量 到文档,例如用于计算鼠标 位置(event.pageX/Y减去此偏移量即为像素位置 在图内).
offset() -- Returns the offset of the plotting area inside the grid relative to the document, useful for instance for calculating mouse positions (event.pageX/Y minus this offset is the pixel position inside the plot).
getPlotOffset()- 获取网格在画布中作为对象的偏移量 与画布边缘的距离为左",右",上", 底部".也就是说,如果您在画布上以中心画一个圆 放置在(左,上),其中心将在最左上 网格的角.
getPlotOffset() -- Gets the offset that the grid has within the canvas as an object with distances from the canvas edges as "left", "right", "top", "bottom". I.e., if you draw a circle on the canvas with the center placed at (left, top), its center will be at the top-most, left corner of the grid.
这篇关于标签未正确放置在浮动条形图上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!