我正在尝试订购(从chart.js
库中获得的)一系列图形,并且有一个我无法处理的图形。然后显示它的屏幕截图,
如您所见,左边的一个在适当的位置,而右下角的一个在适当位置,但是圆形饼图(圆形)可以满足您的要求。
代码:
#graficos_container {
height: 100%;
width: 100%;
background-color: #e0e0e0;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
#one_graph {
height: 500px;
width: 55%;
background-color: #FFF;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0 5px;
border: 1px solid #a8a7a7;
border-radius: 5px;
}
#prueba {
width: 90%;
}
#paquetes_graf {
height: auto;
width: 90%;
background-color: tomato;
}
#two_graph {
height: 500px;
width: 35%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0 5px;
}
.single_two_graph {
height: 50%;
width: 100%;
background-color: #FFF;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 5px 0;
border: 1px solid #a8a7a7;
border-radius: 5px;
}
<div id="graficos_container">
<div id='one_graph'>
<div id="prueba">
<canvas class="grafico" id="bateria_graf"></canvas>
</div>
<input type="button" value="Graficar" class="boton btn_graf" id="bat_graf_btn">
</div>
<div id='two_graph'>
<div class="single_two_graph">
<div id="prueba">
<canvas class="grafico" id="paquetes_graf"></canvas>
</div>
<input type="button" value="Graficar" class="boton btn_graf" id="paq_graf_btn">
</div>
<div class="single_two_graph">
<div id="prueba">
<canvas class="grafico" id="paquetes_full_graf"></canvas>
</div>
<input type="button" value="Graficar" class="boton btn_graf" id="paq_full_graf_btn">
</div>
</div>
这种图表是响应式的,因此,我认为将其放入可以适应的容器中,但是不行。我该怎么办?
非常感谢。
您是否尝试将display:flex添加到.prueba类,现在在您的示例中似乎已经响应了。
#graficos_container {
height: 100%;
width: 100%;
background-color: #e0e0e0;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
#one_graph {
height: 500px;
width: 55%;
background-color: #FFF;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0 5px;
border: 1px solid #a8a7a7;
border-radius: 5px;
}
#prueba {
width: 90%;
display:flex;
}
#paquetes_graf {
height: auto;
width: 90%;
background-color: tomato;
}
#two_graph {
height: 500px;
width: 35%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0 5px;
}
.single_two_graph {
height: 50%;
width: 100%;
background-color: #FFF;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 5px 0;
border: 1px solid #a8a7a7;
border-radius: 5px;
}
<div id="graficos_container">
<div id='one_graph'>
<div id="prueba">
<canvas class="grafico" id="bateria_graf"></canvas>
</div>
<input type="button" value="Graficar" class="boton btn_graf" id="bat_graf_btn">
</div>
<div id='two_graph'>
<div class="single_two_graph">
<div id="prueba">
<canvas class="grafico" id="paquetes_graf"></canvas>
</div>
<input type="button" value="Graficar" class="boton btn_graf" id="paq_graf_btn">
</div>
<div class="single_two_graph">
<div id="prueba">
<canvas class="grafico" id="paquetes_full_graf"></canvas>
</div>
<input type="button" value="Graficar" class="boton btn_graf" id="paq_full_graf_btn">
</div>
</div>