【问题标题】:Hide axis tick values隐藏轴刻度值
【发布时间】:2014-05-28 10:06:46
【问题描述】:

有没有办法在 c3js(版本 0.1.42)中隐藏轴刻度值?在其中一张图中,我有带有长刻度值的分类轴。我想隐藏它们并仅在鼠标悬停时显示。我尝试了http://c3js.org/samples/axes_x_tick_culling.html 中提到的刻度剔除选项(通过将最大值设置为 0),但它不起作用。

【问题讨论】:

    标签: d3.js c3.js


    【解决方案1】:

    你可以试试这个:

    tick format()方法中返回空字符串如下图:-

    axis : {
        x : {
            type : 'categorized',
            tick: {
                format: function (x) { return ''; }
            }
        }
    }
    

    【讨论】:

      【解决方案2】:

      使用下一个代码,您可以隐藏所有 x 轴刻度

         .c3-axis-x .tick line {
            display: none;
          }
      

      示例:jsfiddle

      【讨论】:

        【解决方案3】:

        可能想试试css

        g.tick:hover text {
            fill: #000;
        }
        g.tick text {
            fill: none;
            pointer-events: all;
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2016-08-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-01-21
          • 1970-01-01
          相关资源
          最近更新 更多