1

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

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

马特

4

2 回答 2

2

是的,您可以使用“标记”属性。您实际上可以将此片段放置在条类型之后(您可以同时使用两者):

markers: {
  show: true,
  position: 'ct',
},

但是,这有一个小问题。Flotr2 不尊重标记的堆叠位置,因此标记标签最终会出现在错误的位置。

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

于 2012-09-04T02:48:32.073 回答
0

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

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)
  }
于 2015-08-14T12:39:08.570 回答