Search code examples
cubism.js

D3: Cubism.js: Hiding Labels from Horizon Charts


Would anyone know how to hide the value label from a horizon chart?

enter image description here

The code is simply

d3.select("#graphs").selectAll(".horizon")
    .data(data)
    .enter().insert("div", ".bottom")
    .attr("class", "horizon")
    .call(context.horizon().height(25)
                           .colors(colors));

Solution

  • This can be solved by defining the following function

    function empty_label() {
      return "";
    } 
    

    and then using it here:

    d3.select("#..")
      .selectAll(".horizon")
      .data(data)
      .enter()
      .insert("div", ".bottom")
      .attr("class", "horizon")
      .call(context.horizon().format(empty_label()));