我希望能够以忽略纵横比(适合屏幕)的方式将我的 SVG 图形适合我的 div。但是,当我更改窗口宽度时,我的图表会超出我的黄色框。如何使用 vh 表示的 div 高度来纠正这种情况?
.svg-container {
display: inline-block;
position: relative;
width: 100%;
height: 60vh;
/* aspect ratio */
vertical-align: top;
overflow: hidden;
background-color: yellow;
}
.svg-content-responsive {
display: inline-block;
position: absolute;
top: 10px;
left: 0;
}
.line {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
}Run Code Online (Sandbox Code Playgroud)
<div class="container-fluid" data-ng-swipe-left="showMenu.value = true" data-ng-swipe-disable-mouse="">
<div aw-resolve-loader="" ui-view="main" class="view reveal-animation ng-scope">
<div style="float: left" class="ng-scope"></div>
<div class="ng-scope ng-isolate-scope">
<div class="svg-container">
<svg viewBox="0 0 800 600" preserveAspectRatio="none">
<path class="line" d="M0,600L114.28571428571428,300L228.57142857142856,562.5L457.1428571428571,225L571.4285714285714,375L800,0"></path>
</svg> …Run Code Online (Sandbox Code Playgroud)我想使用 Gnuplot 绘制一种数据透视图。所以我需要忽略文件中的一些数据行。我尝试了以下方法:
unset key
set xtics font "Times-Roman, 5"
set ytics font "Times-Roman, 5"
set multiplot layout 4,3 #title "Multiplots\n"
plot [7:50][0:1] 'forStackoverGnuplot.txt' using 1:($2==0?($3==4?$4:NaN):NaN) with lines ti '4'
plot [7:50][0:1] 'forStackoverGnuplot.txt' using 1:($2==0?($3==4?$4:"fe"):"fe") with lines ti '4'
Run Code Online (Sandbox Code Playgroud)
数据文件:
20 0 5 0.668593155
7 0 4 0.885223087
20 0 5 0.668593155
10 0 4 0.92239289
20 0 5 0.668593155
20 0 4 0.834947746
30 0 4 0.693726036
50 0 4 0.47169919
Run Code Online (Sandbox Code Playgroud)
但我得到:

这不是我预期的结果。我能做什么?我想让数据线交错。