Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control the SVG size and width/height ratio #41

Open
chenjiandongx opened this issue Oct 7, 2019 · 12 comments
Open

Control the SVG size and width/height ratio #41

chenjiandongx opened this issue Oct 7, 2019 · 12 comments
Assignees

Comments

@chenjiandongx
Copy link

Hi @timqian, Is there a easy way to control the SVG size?

I try to set width and height attr like this

<svg class="line-chart" width="800px" height="600px"></svg>

but it seem doesn't work. :)

@timqian
Copy link
Owner

timqian commented Oct 7, 2019

The width of the svg depends on its parent. You can change the width of its parent to change its size.

@timqian
Copy link
Owner

timqian commented Oct 7, 2019

The ratio of with and height is hard coded to 4/3. Adding a setting to config it might be good. I am considering adding this

@chenjiandongx
Copy link
Author

Now div is the parent tag,

  <div width="800px" height="600px" width="800px">
      <svg class="line-chart"></svg>
  </div>

but.. SVG shows incomplete

image

@chenjiandongx
Copy link
Author

It would be nice if added a new setting opts for it.

@timqian
Copy link
Owner

timqian commented Oct 7, 2019

Try

  <div style="width:800px;">
      <svg class="line-chart"></svg>
  </div>

@chenjiandongx
Copy link
Author

chenjiandongx commented Oct 7, 2019

It works, :)

The ratio of with and height is hard coded to 4/3.

and is this will be changed in the future?

@timqian
Copy link
Owner

timqian commented Oct 7, 2019

The default will always be 4/3, I think adding an option to change it might be good

@timqian timqian changed the title Can I control the SVG size? Control the SVG size and width/height ration Oct 7, 2019
@timqian
Copy link
Owner

timqian commented Oct 7, 2019

I will keep this issue open for size & ratio related updates

@timqian timqian changed the title Control the SVG size and width/height ration Control the SVG size and width/height ratio Oct 7, 2019
@chenjiandongx

This comment has been minimized.

@timqian timqian self-assigned this Oct 9, 2019
@chenjiandongx

This comment has been minimized.

@timqian

This comment has been minimized.

@chenjiandongx

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants