With D3.js I draw a graph. Faced a problem, tried to adapt, the page to the phone. and coped with all the blocks but I canβt do it with the schedule, it is cut off but not compressed. here is the chart code.
var width = 850, height = 500, margin=30, padding =20, data = [ {"x": 0.3, "label": 1, "value": 51, "selected": 1}, {"x": 1.3, "label": 2, "value": 67, "selected": 0}, {"x": 2.3, "label": 3, "value": 74, "selected": 0}, {"x": 3.3, "label": 4, "value": 63, "selected": 0}, {"x": 4.3, "label": 5, "value": 56, "selected": 0}, {"x": 5.3, "label": 6, "value": 24, "selected": 0}, {"x": 6.3, "label": 7, "value": 26, "selected": 0}, {"x": 7.3, "label": 8, "value": 19, "selected": 0}, {"x": 8.3, "label": 9, "value": 42, "selected": 0}, {"x": 9.3, "label": 10, "value": 88, "selected": 0} ]; var svg = d3.select("#chart").append("svg") .attr("class", "axis") .attr("width", width) .attr("height", height); // Π΄Π»ΠΈΠ½Π° ΠΎΡΠΈ X= ΡΠΈΡΠΈΠ½Π° ΠΊΠΎΠ½ΡΠ΅ΠΉΠ½Π΅ΡΠ° svg - ΠΎΡΡΡΡΠΏ ΡΠ»Π΅Π²Π° ΠΈ ΡΠΏΡΠ°Π²Π° var xAxisLength = width - 2 * margin; // Π΄Π»ΠΈΠ½Π° ΠΎΡΠΈ Y = Π²ΡΡΠΎΡΠ° ΠΊΠΎΠ½ΡΠ΅ΠΉΠ½Π΅ΡΠ° svg - ΠΎΡΡΡΡΠΏ ΡΠ²Π΅ΡΡ
Ρ ΠΈ ΡΠ½ΠΈΠ·Ρ var yAxisLength = height - 2 * margin; // ΡΡΠ½ΠΊΡΠΈΡ ΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΡΡΠΈΠΈ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ Π½Π° ΠΎΡΡ Π₯ var scaleX = d3.scale.linear() .domain([0, data.length + 1]) .range([0, xAxisLength]); // ΡΡΠ½ΠΊΡΠΈΡ ΠΈΠ½ΡΠ΅ΡΠΏΠΎΠ»ΡΡΠΈΠΈ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ Π½Π° ΠΎΡΡ Y var scaleY = d3.scale.linear() .domain([100, 0]) .range([0, yAxisLength]); // ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΡΡ X var xAxis = d3.svg.axis() .scale(scaleX) .orient("bottom"); // ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΡΡ Y var yAxis = d3.svg.axis() .scale(scaleY) .orient("left") .ticks(4) .tickFormat(function(d) { return d + '%'; }); // ΠΎΡΡΠΈΡΠΎΠ²ΠΊΠ° ΠΎΡΠΈ Π₯ svg.append("g") .attr("class", "x-axis") .attr("transform", // ΡΠ΄Π²ΠΈΠ³ ΠΎΡΠΈ Π²Π½ΠΈΠ· ΠΈ Π²ΠΏΡΠ°Π²ΠΎ "translate(" + margin + "," + (height - margin) + ")") .call(xAxis); // ΠΎΡΡΠΈΡΠΎΠ²ΠΊΠ° ΠΎΡΠΈ Y svg.append("g") .attr("class", "y-axis") .attr("transform", // ΡΠ΄Π²ΠΈΠ³ ΠΎΡΠΈ Π²Π½ΠΈΠ· ΠΈ Π²ΠΏΡΠ°Π²ΠΎ Π½Π° margin "translate(" + margin + "," + margin + ")") .call(yAxis); // Π²ΡΠ±ΠΈΡΠ°Π΅ΠΌ ΡΡΠΈΠ»Ρ d3.selectAll('text') .style('font-family', 'Ubuntu'); // ΠΠ΅ΡΡΠΈΠΊΠ°Π»ΡΠ½ΡΠ΅ Π»ΠΈΠ½ΠΈΠΈ d3.selectAll("gx-axis g.tick") .append("line") // Π΄ΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ Π»ΠΈΠ½ΠΈΡ .classed("grid-line", true) // Π΄ΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ ΠΊΠ»Π°ΡΡ .attr("x1", 0) .attr("y1", 0) .attr("x2", 0) .attr("y2", - (height - 2 * margin)); // ΡΠΈΡΡΠ΅ΠΌ Π³ΠΎΡΠΈΠ·ΠΎΠ½ΡΠ°Π»ΡΠ½ΡΠ΅ Π»ΠΈΠ½ΠΈΠΈ d3.selectAll("gy-axis g.tick") .append("line") .classed("grid-line", true) .attr("x1", 0) .attr("y1", 0) .attr("x2", xAxisLength) .attr("y2", 0) .attr("stroke","#ff0"); // ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΠ±ΡΠ΅ΠΊΡ g Π΄Π»Ρ ΠΏΡΡΠΌΠΎΡΠ³ΠΎΠ»ΡΠ½ΠΈΠΊΠΎΠ² var g =svg.append("g") .attr("class", "body") .attr("transform", // ΡΠ΄Π²ΠΈΠ³ ΠΎΠ±ΡΠ΅ΠΊΡΠ° Π²ΠΏΡΠ°Π²ΠΎ "translate(" + margin + ", 0 )"); // ΡΠ²ΡΠ·ΡΠ²Π°Π΅ΠΌ Π΄Π°Π½Π½ΡΠ΅ Ρ ΠΏΡΡΠΌΠΎΡΠ³ΠΎΠ»ΡΠ½ΠΈΠΊΠ°ΠΌΠΈ g.selectAll("rect.bar") .data(data) .enter() .append("rect") .attr("class", "bar"); // ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅ΠΌ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΡ ΠΏΡΡΠΌΠΎΡΠ³ΠΎΠ»ΡΠ½ΠΈΠΊΠΎΠ² g.selectAll("rect.bar") .data(data) .attr("x", function (d) { return scaleX(dx); }) .attr("y", function (d) { return scaleY(d.value) + margin; }) .attr("height", function (d) { return yAxisLength - scaleY(d.value); }) .attr("width", function(d) { return Math.floor(xAxisLength / data.length) - padding; }) .attr("fill", function (d) { if (d.selected === 0) { return "#ACBBC2"; } else { return "#EE1D23"; } }); // ΠΊΠ½ΠΎΠΏΠΊΠ° ΡΠ΄Π°Π»Π΅Π½ΠΈΡ Π΄ΠΈΠ°Π³ΡΠ°ΠΌΠΌΡ // onclick= $('.bar').remove(); </script> .axis { background-color: lightgoldenrodyellow; } .axis path, .axis line { fill: none; stroke: #333; } .axis .grid-line { stroke: #000; shape-rendering: crispedges; font-family: Ubuntu; stroke-opacity: 0.2; } .axis text { font: 10px Verdana; } .bar { width : 20px; } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> </head> <body> <div id="chart"></div> </body> </html> Here's how it looks on the big screen. 
How to squeeze it correctly?

d3.select("#chart").append("svg").attr("width", width).attr("height", height);. Therefore, it is cut off from you, and not compressed. You can just check this: change the width and height in the script and your schedule will change. To compress the graph dynamically for different devices, you can specify a media-query for the class of the element where the graph is embedded, and before starting the construction of the graph, get the width / height of the element and substitute it into your height and width - Mr. Brightside