【问题标题】:Flot:how to align xaxis labels center over the tick line, and put labels in the plot area instead of outside spaceFlot:如何在刻度线上对齐 xaxis 标签中心,并将标签放在绘图区域而不是外部空间
【发布时间】:2011-05-09 01:55:40
【问题描述】:

我想知道是否有将轴刻度“中心”放在刻度线上的配置?并把它们放在情节区域而不是外部空间?

对于后一个问题,我在网格选项中使用了“labelMargin:-30”,虽然它比不设置这个有所不同,但是,如果我设置“labelMargin:-50”或使用另一个更大的负数,则没有进一步的区别数字。有人知道如何处理吗?

提前致谢!

【问题讨论】:

  • 您能否通过将轴刻度“居中”放在刻度线上来解释一下您的意思?我不确定轴刻度是什么...

标签: alignment axis flot


【解决方案1】:

我缩小了直方图上的条形,并将条形下方的标签居中,将条形格式化为:

series: {

      bars: {'show': 'true', 'align': "center", 'barWidth':0.7}

       }

【讨论】:

    【解决方案2】:

    我有同样的要求,最后我决定为特定于图形的 tickLabel 类设置样式

    例如

    #myGraph .tickLabel {
        margin-left: 2em;
    }
    

    这对我有用,因为我的 x 轴有固定的最小值和最大值 - 不理想,但成功了!

    【讨论】:

    • 如果有两个轴怎么办。我正在使用以下内容,但它不起作用:#myGraph .tickLabel .y2axis { margin-left: 2em; } #myGraph .tickLabel .yaxis { margin-left: 2em; }
    • 如何在 options 中添加该代码?在 CSS 中它不起作用
    【解决方案3】:

    即使我也有类似的东西,但对于 y 轴,我也有两个 y 轴,所以我执行了以下操作并且它起作用了:

     #graph_label .tickLabel {
               margin-left: 0em;
               margin-right:0em;
          } 
    

    #graph_label .yAxis .tickLabel {
               margin-left: 0em;
               margin-right:0em;
          } 
    
    #graph_label .y2Axis .tickLabel {
               margin-left: 0em;
               margin-right:0em;
          } 
    

    【讨论】:

      猜你喜欢
      • 2021-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多