Googleの負の値を避けるにはどうすればいいですか?私のY軸ではviewWindow:{min:0、}を試しましたが、 お願いします。事前に感謝しますGoogleのグラフからY軸の負の値を避ける方法
<div class="timeline-item">
<div id="top_x_div" style="width: 100%; height: 300px;"></div>
</div>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);
function drawStacked() {
var data = new google.visualization.arrayToDataTable([
['Courses', 'Students'],
["Electronics", 2 ],
]);
var options = {
legend: { position: 'none' },
isStacked: true,
colors: ['green'],
bars: 'vertical', // Required for Material Bar Charts.
axes: {
x: {
0: { side: 'bottom', label: 'Percentage'} // Top x-axis.
}
},
axes: {
y: {
0: { side: 'bottom', label: 'Students'}, // Top x-axis.
/* viewWindow: {
min: 0,
},*/
}
},
vAxis: {
viewWindow: {
min: 0
}
},
bar: { groupWidth: "90%" }
};
var chart = new google.charts.Bar(document.getElementById('top_x_div'));
chart.draw(data, options);
};
</script>
データが負の値が含まれていますか?上記のチャートを描画すると、何も表示されません。また、_material_グラフではサポートされていないオプションがいくつかあります(「Material Chart Feature Parityのトラッキングに関する問題」(https://github.com/google/)を参照)。 google-visualization-issues/issues/2143) - 代わりに_core_ chartを - > 'theme: 'material'オプションで使用することをお勧めします... – WhiteHat
実際に負の値を含まないデータをグラフに表示しますが、なぜなら、特定のコースの学生(生徒ゼロ)がいないときです@WhiteHat – SKM