使用窗格和堆积条形图时仅显示部分图表
Only part of chart shown when using panes and stacked bars
下面的代码使用窗格在堆积条形图中显示两个条形。
我的问题是只显示了图表的一部分,您可以看到 x 轴从 94% 开始。所以看起来值 50(bar 1) 小于 2(bar 2)。为什么只显示了部分图表,我该如何解决?
<div id="chart"></div>
<script>
$("#chart").kendoChart({
legend: {
visible: false
},
seriesDefaults: {
type: "bar",
stack: {
type: "100%"
},
labels: {
visible : true,
position: "insideBase"
}
},
panes:[{
name: "pane1"
}],
series: [{
data: [50],
axis: "axis1",
categoryAxis: "catAxis1"
},
{
data: [2],
axis: "axis1",
categoryAxis: "catAxis1"
}],
valueAxis: [{
name: "axis1",
pane: "pane1"
}],
categoryAxis: [{
name: "catAxis1",
pane: "pane1"
}]
});
</script>
只需将最小值 0 添加到 valueAxis:
valueAxis: [{
min: 0,
name: "axis1",
pane: "pane1"
}],
下面的代码使用窗格在堆积条形图中显示两个条形。 我的问题是只显示了图表的一部分,您可以看到 x 轴从 94% 开始。所以看起来值 50(bar 1) 小于 2(bar 2)。为什么只显示了部分图表,我该如何解决?
<div id="chart"></div>
<script>
$("#chart").kendoChart({
legend: {
visible: false
},
seriesDefaults: {
type: "bar",
stack: {
type: "100%"
},
labels: {
visible : true,
position: "insideBase"
}
},
panes:[{
name: "pane1"
}],
series: [{
data: [50],
axis: "axis1",
categoryAxis: "catAxis1"
},
{
data: [2],
axis: "axis1",
categoryAxis: "catAxis1"
}],
valueAxis: [{
name: "axis1",
pane: "pane1"
}],
categoryAxis: [{
name: "catAxis1",
pane: "pane1"
}]
});
</script>
只需将最小值 0 添加到 valueAxis:
valueAxis: [{
min: 0,
name: "axis1",
pane: "pane1"
}],