Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
215 views
in Technique[技术] by (71.8m points)

html - How to scale x axis values on svg chart?

I have a line chart (no library). I need to scale value on X axis only depends on screen with.

This is my chart

<svg width="100%" height="300">
    <rect x="40" y="280" width="100%" height="1" fill="#E6E6E6"></rect>
    <rect x="40" y="0" width="1" height="280" fill="#E6E6E6"></rect>

    <g>
        <path
            d="
                M70,250
                L120,220
                L170,200
                L220,160
                "
            stroke="#FE5131" stroke-width="2" fill="none"></path>
    </g>
</svg>

How to scale with css? I mean L120, become L150... on wider screens and so on.

question from:https://stackoverflow.com/questions/65869525/how-to-scale-x-axis-values-on-svg-chart

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...