var div = document.createElement("div");
div.className = "dygraph-legend";
for (var name in messagestyle) {
- if (messagestyle.hasOwnProperty(name)) {
- div.style[name] = messagestyle[name];
- }
+ try {
+ div.style[name] = messagestyle[name];
+ } catch (e) {
+ console.warn("You are using unsupported css properties for your browser in labelsDivStyles");
+ }
}
this.graphDiv.appendChild(div);
this.attrs_.labelsDiv = div;
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
+ <title>Label styles</title>
+ <!--[if IE]>
+ <script type="text/javascript" src="../excanvas.js"></script>
+ <![endif]-->
+ <!--
+ For production (minified) code, use:
+ <script type="text/javascript" src="dygraph-combined.js"></script>
+ -->
+ <script type="text/javascript" src="../dygraph-dev.js"></script>
+
+ <script type="text/javascript" src="data.js"></script>
+ </head>
+ <body>
+ <p>Labels are styled with css3:</p>
+ <div id="div_g14" style="width:600px; height:300px;"></div>
+
+ <script type="text/javascript">
+ g14 = new Dygraph(
+ document.getElementById("div_g14"),
+ NoisyData, {
+ rollPeriod: 14,
+ errorBars: true,
+ labelsDivWidth: 100,
+ labelsDivStyles: {
+ 'backgroundColor': 'rgba(200, 200, 255, 0.75)',
+ 'padding': '4px',
+ 'border': '1px solid black',
+ 'borderRadius': '10px',
+ 'boxShadow': '4px 4px 4px #888'
+ },
+ labelsSeparateLines: true,
+ yAxisLabelWidth: 20
+ }
+ );
+ </script>
+ </body>
+</html>