jquery 迷你图堆积条问题
jquery sparkline stacked bar issue
我正在尝试在 jquery 迷你图插件中使用堆叠条,我的版本是 2.1.2,正常的迷你图工作正常,但堆叠条类型不起作用,这是我的代码 (类似):
<span class="sparklines" data-sparkline-value="1:2,3:4,5:4,3:2"></span>
和初始化函数
$('.sparklines').each(function () {
$(this).sparkline(
$(this).data("sparkline-value"), {
type: $(this).data("sparkline-type") ? $(this).data("sparkline-type") : 'bar',
barWidth: $(this).data("sparkline-bar-width") ? $(this).data("sparkline-bar-width") : 5,
negBarColor: '#f44',
stackedBarColor: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00',
'#dd4477', '#0099c6', '#990099'],
barSpacing: $(this).data("sparkline-bar-spacing") ? $(this).data("sparkline-bar-spacing") : 2,
height: $(this).data("sparkline-height") ? $(this).data("sparkline-height") : '20px',
barColor: $(this).data("sparkline-color") ? $(this).data("sparkline-color") : '#7BB2B4',
enableTagOptions: true
});
});
添加到 javascript 代码:
零轴:假
并且spark的值应该是[1,2],[3,4],[5,4],[3,2],还有一个方法,这个方法最好用div with data-spark -value,我们应该使用 span 的其他方法,值在 span 标签之间用“:”分隔
我正在尝试在 jquery 迷你图插件中使用堆叠条,我的版本是 2.1.2,正常的迷你图工作正常,但堆叠条类型不起作用,这是我的代码 (类似):
<span class="sparklines" data-sparkline-value="1:2,3:4,5:4,3:2"></span>
和初始化函数
$('.sparklines').each(function () {
$(this).sparkline(
$(this).data("sparkline-value"), {
type: $(this).data("sparkline-type") ? $(this).data("sparkline-type") : 'bar',
barWidth: $(this).data("sparkline-bar-width") ? $(this).data("sparkline-bar-width") : 5,
negBarColor: '#f44',
stackedBarColor: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00',
'#dd4477', '#0099c6', '#990099'],
barSpacing: $(this).data("sparkline-bar-spacing") ? $(this).data("sparkline-bar-spacing") : 2,
height: $(this).data("sparkline-height") ? $(this).data("sparkline-height") : '20px',
barColor: $(this).data("sparkline-color") ? $(this).data("sparkline-color") : '#7BB2B4',
enableTagOptions: true
});
});
添加到 javascript 代码: 零轴:假 并且spark的值应该是[1,2],[3,4],[5,4],[3,2],还有一个方法,这个方法最好用div with data-spark -value,我们应该使用 span 的其他方法,值在 span 标签之间用“:”分隔