question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Control the SVG size and width/height ratio

See original GitHub issue

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. 😃

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chenjiandongxcommented, Oct 12, 2019

@timqian I’m the author of pyecharts. Echarts is a great visualization library created by Baidu frontend team.

I got an idea that combines chart.xkcd with python. Because your charts lib is so adorable and I like such hand drawing style things.

But now it just an idea and not on the shedule temporarily 😃

1reaction
timqiancommented, Oct 7, 2019

Try

  <div style="width:800px;">
      <svg class="line-chart"></svg>
  </div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Scale SVG | CSS-Tricks
So a rule like svg {width: 100%; height: auto;} will cancel out the dimensions and aspect ratio you set in the code, and...
Read more >
preserveAspectRatio - SVG: Scalable Vector Graphics | MDN
The preserveAspectRatio attribute indicates how an element with a viewBox providing a given aspect ratio must fit into a viewport with a ...
Read more >
Intrinsic Sizing - SVG
"If either/both of the 'width' and 'height' of the rootmost 'svg' element are in percentage units (or omitted), the aspect ratio is calculated...
Read more >
Size and aspect ratio | Graphery SVG
You can define the SVG size with .height() and .width() , or the equivalent CSS properties. The SVG can be scaled without limitations,...
Read more >
How can I make an svg scale with its parent container?
Using both max-width: 100% and max-height : 100% will make the svg always scale to the container without ever overflowing or losing its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found