Jqplot:为什么呈现 0 个条形图?
Jqplot: Why are 0 bars rendering?
我在使用 jqplot 时遇到问题,其中堆叠的条形有时会显示 0 的条形。我不想要 0 的条形。与每个条形关联的所有数字加起来等于最大值。这是我看到的。
Stacked bars with 0 labels removed
问题出在 MS/AL(27 站)。有一个蓝色条,但该条代表 0。但这并不总是发生。实际上可以在栏中显示第三种颜色,但是本示例的 none 显示了它。
这是一个点标签显示 0(而不是 hideZeros:true)的示例,只是为了证明 0 导致条形图呈现。
Stacked bars with labels for 0s
这是我的 javascript:
$.jqplot(div_id, customer_amount, {
title:{
text: v.truck_label+' ('+v.count+' stops)',
textAlign: 'left'
},
animate: true,
stackSeries: true,
axesDefaults:{
showTicks: false,
tickOptions:{
show: false,
showTicks: false,
showGridline: false
},
rendererOptions: {
baselineWidth: 1.5,
drawBaseline: false
}
},
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {
barDirection: 'horizontal',
highlightMouseOver: false,
//shadow: false
shadowAngle: 35,
shadowAlpha: 0.1,
shadowDepth: 4
},
pointLabels: {
show: true,
formatString: '%d',
hideZeros:true
}
},
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
showTicks: false,
ticks: [''],
tickOptions:{
show: false,
showGridline: false
}
},
xaxis: {
max: max,
showTicks: false,
tickOptions:{
show: false,
showGridline: false
}
}
},
grid: {
drawGridLines: false,
drawBorder: false,
shadow: false,
borderColor: 'transparent',
background: 'transparent'
},
seriesColors: series_colors
});
有人知道发生了什么事吗?有什么建议吗?
查看工作 fiddle...
var options = {
title: 'Title ',
stackSeries: true,
seriesColors: ["#eb4b3d", "#ffc800", "#009149"],
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: {
show: true,
hideZeros: true
},
rendererOptions: {
barWidth: 25,
varyBarColor: true,
},
},
axes: {
xaxis: {
// renderer: $.jqplot.CategoryAxisRenderer,
//
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks,
},
yaxis: {
//autoscale: true,
//label: 'Application Count',
min: 0,
tickInterval: 5,
max: 50
}
},
axesDefaults: {
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions: {
angle: -30,
fontSize: '10pt'
}
}
};
我在使用 jqplot 时遇到问题,其中堆叠的条形有时会显示 0 的条形。我不想要 0 的条形。与每个条形关联的所有数字加起来等于最大值。这是我看到的。
Stacked bars with 0 labels removed
问题出在 MS/AL(27 站)。有一个蓝色条,但该条代表 0。但这并不总是发生。实际上可以在栏中显示第三种颜色,但是本示例的 none 显示了它。
这是一个点标签显示 0(而不是 hideZeros:true)的示例,只是为了证明 0 导致条形图呈现。
Stacked bars with labels for 0s
这是我的 javascript:
$.jqplot(div_id, customer_amount, {
title:{
text: v.truck_label+' ('+v.count+' stops)',
textAlign: 'left'
},
animate: true,
stackSeries: true,
axesDefaults:{
showTicks: false,
tickOptions:{
show: false,
showTicks: false,
showGridline: false
},
rendererOptions: {
baselineWidth: 1.5,
drawBaseline: false
}
},
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {
barDirection: 'horizontal',
highlightMouseOver: false,
//shadow: false
shadowAngle: 35,
shadowAlpha: 0.1,
shadowDepth: 4
},
pointLabels: {
show: true,
formatString: '%d',
hideZeros:true
}
},
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
showTicks: false,
ticks: [''],
tickOptions:{
show: false,
showGridline: false
}
},
xaxis: {
max: max,
showTicks: false,
tickOptions:{
show: false,
showGridline: false
}
}
},
grid: {
drawGridLines: false,
drawBorder: false,
shadow: false,
borderColor: 'transparent',
background: 'transparent'
},
seriesColors: series_colors
});
有人知道发生了什么事吗?有什么建议吗?
查看工作 fiddle...
var options = {
title: 'Title ',
stackSeries: true,
seriesColors: ["#eb4b3d", "#ffc800", "#009149"],
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: {
show: true,
hideZeros: true
},
rendererOptions: {
barWidth: 25,
varyBarColor: true,
},
},
axes: {
xaxis: {
// renderer: $.jqplot.CategoryAxisRenderer,
//
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks,
},
yaxis: {
//autoscale: true,
//label: 'Application Count',
min: 0,
tickInterval: 5,
max: 50
}
},
axesDefaults: {
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions: {
angle: -30,
fontSize: '10pt'
}
}
};