我使用flotr2,我在这里写了一个测试。http://jsfiddle.net/yKqXM/
如果我想在每个条形堆栈上显示标签,我应该使用"marker“类型吗?我该如何使用它。我是flotr2的新手,你能给我一篇好的学习文章或文档吗?这样我就可以学习它了。如果这个问题很愚蠢,我很抱歉,但我对寻找示例感到沮丧。
哑光
发布于 2012-09-04 10:48:32
是的,你可以使用'markers‘属性。实际上,您只需将此片段放在bar类型之后(您可以同时使用两者):
markers: {
show: true,
position: 'ct',
},然而,这有一个小问题。Flotr2不考虑标记的堆叠位置,因此标记标签最终会出现错误的位置。
为了解决这个问题,创建一些虚拟数据集,它们是堆栈的总和,并移动“条”和“标记”,以便在单独的数据源上直接指定。列出数据后的位只是每个数据源的“默认”模式。
发布于 2015-08-14 20:39:09
有许多非常有用的标记选项。请参阅库源代码。
Flotr.addType('markers', {
options: {
show: false, // => setting to true will show markers, false will hide
lineWidth: 1, // => line width of the rectangle around the marker
color: '#000000', // => text color
fill: false, // => fill or not the marekers' rectangles
fillColor: "#FFFFFF", // => fill color
fillOpacity: 0.4, // => fill opacity
stroke: false, // => draw the rectangle around the markers
position: 'ct', // => the markers position (vertical align: b, m, t, horizontal align: l, c, r)
verticalMargin: 0, // => the margin between the point and the text.
labelFormatter: Flotr.defaultMarkerFormatter,
fontSize: Flotr.defaultOptions.fontSize,
stacked: false, // => true if markers should be stacked
stackingType: 'b', // => define staching behavior, (b- bars like, a - area like) (see Issue 125 for details)
horizontal: false // => true if markers should be horizontal (For now only in a case on horizontal stacked bars, stacks should be calculated horizontaly)
}https://stackoverflow.com/questions/10278628
复制相似问题