Giter Site home page Giter Site logo

Comments (4)

netil avatar netil commented on July 20, 2024 1

well, I think this issue isn't really attached on chart functionality.
To make as you want, there're a lot of approaches to make it.

Just one of the way will be defining viewBox attribute to the svg element to crop the viewport.
I'm not give example with your code for the complexity.

bb.generate({
  data: {
    columns: [
      ["data1", 5, 10, 15],
      ["data2", 20, 3, 8]
    ],
    type: "bar"
  },
  axis: {
    x: {
      show: false
    },
    y: {
      show: false
    }
  },
  legend: {
    show: false
  }
});

// to get the chart area size
var rect = d3.select(".bb-zoom-rect");

// set viewBox attribute
d3.select("#chart svg").attr("viewBox", [
    0,0,rect.attr("width"), rect.attr("height")
  ].join(" "))

This example will make chart element to fit on exact svg viewport.

from billboard.js.

netil avatar netil commented on July 20, 2024

Good point!
Even though you set not showing, the corresponding node for axis still remains.

If you need to get rid axis nodes, just simply remove nodes

// in case of x axis
d3.selectAll(".bb-axis.bb-axis-x").remove();

// in case of y axis
d3.selectAll(".bb-axis.bb-axis-y").remove();

I'll take considering this issue if can be more nice way to implement. Thanks anyway.

from billboard.js.

jsong0605 avatar jsong0605 commented on July 20, 2024

Thanks for your answer.

Obviously, the axis does hide when I remove the axis as like your answer.

The thing is ... The white space still remains.
I couldn't manage to draw a chart without these white space.

I'd like to place the chart right above the bottom line, like below.

issue4

Could you give me a tip for a solution, please ?

from billboard.js.

jsong0605 avatar jsong0605 commented on July 20, 2024

Thank you for giving me a solution. It's been very helpful.

from billboard.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.