2016-05-20 10 views
0

Ich verwende ein Diagramm der D3 Sankey aber ich möchte es als Reaktion bitte kann jemand machen mir helfen, es reaktionsfähiger zu machen ...Wie reagiert, D3 Sankey Diagramm

dies ist der jQuery Code des Sankey chart

Sankey = (function() { 
function Sankey() { 
    this.display_in_element = 'sankey'; 
    this.display_width = $("#" + this.display_in_element).width(); 
    this.display_height = $("#" + this.display_in_element).height(); 
    this.r = Raphael(this.display_in_element, this.display_width, this.display_height); 
    this.left_margin = 100; 
    this.right_margin = 100; 
    this.y_space = 10; 
    this.threshold_for_drawing = 0; 
    this.box_width = 50; 
    this.flow_edge_width = 2; 
    this.flow_curve = 0.25; 
    this.boxes = {}; 
    this.box_array = []; 
    this.lines = {}; 
    this.line_array = []; 
    this.stacks = []; 
    this.bubbles = []; 
    this.bubbleColor = '#000'; 
    this.bubbleLabelColor = '#fff'; 
    this.opacity = '1.0'; 
    this.opacity_highlight = '0.1'; 
} 

this is the sankey chart shown in image

Antwort

0

ich denke, das

var svg = d3.select('#your-graph-div-id').append("svg") 
    .attr("width", '100%') 
    .attr("height", '100%') 
    .attr('viewBox','0 0 '+Math.min(width,height)+' '+Math.min(width,height)) 
    .attr('preserveAspectRatio','xMinYMin') 
    .append("g") ; 

sollte für Sie arbeiten. Stellen Sie Ihre Svg's Breite & Höhe auf '100%' und schließen Sie die preserveAspectRatio ein.