Skip to content

Commit

Permalink
graph div must not have padding, standard workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
mirabilos committed Feb 16, 2023
1 parent e24d675 commit a4adb3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gallery/styled-chart-labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Gallery.register(
parent.innerHTML = [
"<style>.dygraph-legend { text-align: right; background: none; }</style>",
"<p class='infotext'>This chart's labels are styled</p>",
"<div class='chart' id='div_g' style='width:600px; height:300px;'></div>",
"<div class='chart' style='width:600px; height:300px;'><div id='div_g' style='width:100%; height:100%;'></div></div>",
"<p class='infotext'>This version of the chart uses the default styles:</p>",
"<div class='chart' id='div_g2' style='width:600px; height:300px;'></div>"].join("\n");
"<div class='chart' style='width:600px; height:300px;'><div id='div_g2' style='width:100%; height:100%;'></div></div>"].join("\n");
},
run: function() {
new Dygraph(
Expand Down
8 changes: 6 additions & 2 deletions tests/styled-chart-labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
margin: 5px;
padding: 2px;
}
.actuallychart {
width: 100%;
height: 100%;
}
.dygraph-legend {
text-align: right;
background: none;
Expand All @@ -39,10 +43,10 @@
<p>In this chart, each chart label is styled independently. View source to
see how it works.</p>

<div class="chart" id="div_g" style="width:600px; height:300px;"></div>
<div class="chart" style="width:600px; height:300px;"><div class="actuallychart" id="div_g"></div></div>

<p>This version of the chart uses the default styles:</p>
<div class="chart" id="div_g2" style="width:600px; height:300px;"></div>
<div class="chart" style="width:600px; height:300px;"><div class="actuallychart" id="div_g2"></div></div>

<script type="text/javascript"><!--//--><![CDATA[//><!--
g = new Dygraph(
Expand Down

0 comments on commit a4adb3b

Please sign in to comment.