1. var chart_id = table.attr('id') + '_chart';
  2. if($('#'+chart_id).length == 0) {
  3. $('<div class="chart" id="'+chart_id+'"><svg></svg></div>').insertBefore($(this));
  4. }
  5. var xFormat = table.data("x-format");
  6. var yFormat = table.data("y-format");
  7. nv.addGraph(function() {
  8. var chart = nv.models.multiBarChart();
  9. var width = 1000;
  10. var height = 300;
  11. chart.margin({top: 20, right: 60, bottom: 20, left: 60});
  12. chart.height(height);
  13. chart.width(width);
  14. chart.yAxis.scale(100).orient("left")
  15. .tickFormat(tickTock(table.data("yFormat")));
  16. chart.xAxis.tickFormat(tickTock(table.data("xFormat")));
  17. chart.reduceXTicks(false);
  18. chart.showLegend(true);
  19. chart.showControls(false);
  20. chart.groupSpacing(0.2)
  21. d3.select('#'+chart_id+' svg')
  22. .attr('perserveAspectRatio', 'xMinYMid')
  23. .attr('width', width)
  24. .attr('height', height)
  25. .datum(data)
  26. .attr('viewBox', '0 0 ' + width + ' ' + height)
  27. .transition().duration(500)
  28. .call(chart);
  29. return chart;
  30. });
 
 

108

 

1087

Pasted Text #1036

-

PasteBin

Lines
36
Words
78
Dimensione
1,2 KB
Creato
Tipo
application/jav…
All Rights Reserved ((C))
Per favore accedi per lasciare un commento!