【问题标题】:Hide label x-axis but still keep vertical axis jquery flot隐藏标签x轴但仍保持垂直轴jquery flot
【发布时间】:2016-02-29 05:05:21
【问题描述】:

我正在寻找jquery flot。我想隐藏标签x-axis,但我想保留vertical axis

这里是我的演示代码:my demo

这是我所期望的照片(删除所有标签 x-axis)。

希望大家能帮帮我。非常感谢。

更新

我将代码更新为labelWidthlabelHeight,但它仍然出现。

xaxis: {
  mode: "time",
  timezone: "browser",
  ticks: 6,
  labelWidth: 0,
  labelHeight: 0,
  ticks: [
    now_hour,
    now_hour + 3600000*1,
    now_hour + 3600000*2,
    now_hour + 3600000*3,
    now_hour + 3600000*4,
    now_hour + 3600000*5,
    now_hour + 3600000*6 
  ],
  timeformat: "%H:%M"
}

更新:按照 Stargazer 的回答。效果也不错。

我们只是更新css

.tickLabels .xAxis { 
 color:transparent !important; 
}

【问题讨论】:

  • 查看 labelHeight 和 labelWidth 的文档,如果将它们设置为零,则它不应该出现。
  • 感谢您的回复,我根据您的建议进行了更新,但它仍然出现。

标签: javascript jquery graph charts flot


【解决方案1】:

添加到 .css 文件:

.tickLabels .xAxis { 
  color:transparent !important; 
}

jsFiddle

【讨论】:

  • 感谢您的回答,标签x-axis 没有出现,但vertical axis 没有出现。我想显示vertical axis
  • 然后使用css属性: .tickLabels .xAxis { color:transparent !important;我已经更新了一个小提琴。看link
  • 是的,您的解决方案很棒。我认为你应该更新你的答案,我会投票给你的答案,这很棒。再次感谢您。
【解决方案2】:

我不知道以前的版本,但 v3.0.0 可以:

  xaxis: {
    showTickLabels: 'none'
  }

查看本例源码https://www.flotcharts.org/flot/examples/axes-labels/index.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    • 1970-01-01
    • 2015-12-26
    • 2011-05-04
    相关资源
    最近更新 更多