Reputation: 546
i am trying to use stacked bar in jquery sparkline plugin, mine version in 2.1.2, the normal sparkline work properly, but the stacked bar type, dosen't work, here is my code (similar):
<span class="sparklines" data-sparkline-value="1:2,3:4,5:4,3:2"></span>
and initialising function
$('.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
});
});
Upvotes: 0
Views: 865
Reputation: 546
add to javascript code: zeroAxis: false and spark values should be [1,2],[3,4],[5,4],[3,2], there is another method, this method it s prefered to use div with data-spark-value, other method we should use span and the value is seperated by ":" between span tags
Upvotes: 2