首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在flotr2栏堆栈上添加标记(标签)?

如何在flotr2栏堆栈上添加标记(标签)?
EN

Stack Overflow用户
提问于 2012-04-23 18:15:17
回答 2查看 2.7K关注 0票数 1

我使用flotr2,我在这里写了一个测试。http://jsfiddle.net/yKqXM/

如果我想在每个条形堆栈上显示标签,我应该使用"marker“类型吗?我该如何使用它。我是flotr2的新手,你能给我一篇好的学习文章或文档吗?这样我就可以学习它了。如果这个问题很愚蠢,我很抱歉,但我对寻找示例感到沮丧。

哑光

EN

回答 2

Stack Overflow用户

发布于 2012-09-04 10:48:32

是的,你可以使用'markers‘属性。实际上,您只需将此片段放在bar类型之后(您可以同时使用两者):

代码语言:javascript
复制
markers: {
  show: true,
  position: 'ct',
},

然而,这有一个小问题。Flotr2不考虑标记的堆叠位置,因此标记标签最终会出现错误的位置。

为了解决这个问题,创建一些虚拟数据集,它们是堆栈的总和,并移动“条”和“标记”,以便在单独的数据源上直接指定。列出数据后的位只是每个数据源的“默认”模式。

票数 2
EN

Stack Overflow用户

发布于 2015-08-14 20:39:09

有许多非常有用的标记选项。请参阅库源代码。

代码语言:javascript
复制
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)
  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10278628

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档