var chart_id = table.attr('id') + '_chart';
if($('#'+chart_id).length == 0) {
$('<div class="chart" id="'+chart_id+'"><svg></svg></div>').insertBefore($(this));
}
var xFormat = table.data("x-format");
var yFormat = table.data("y-format");
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
var width = 1000;
var height = 300;
chart.margin({top: 20, right: 60, bottom: 20, left: 60});
chart.height(height);
chart.width(width);
chart.yAxis.scale(100).orient("left")
.tickFormat(tickTock(table.data("yFormat")));
chart.xAxis.tickFormat(tickTock(table.data("xFormat")));
chart.reduceXTicks(false);
chart.showLegend(true);
chart.showControls(false);
chart.groupSpacing(0.2)
d3.select('#'+chart_id+' svg')
.attr('perserveAspectRatio', 'xMinYMid')
.attr('width', width)
.attr('height', height)
.datum(data)
.attr('viewBox', '0 0 ' + width + ' ' + height)
.transition().duration(500)
.call(chart);
return chart;
});
-
Please log in to leave a comment!