gmmoraesbr / flot

Automatically exported from code.google.com/p/flot
0 stars 0 forks source link

Undefiend Error in IE #313

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
hi
i writed a php script for inputing data`s for pushing to flot chart (my
data`s are dynamic) 
this script worked on firefox or opera but in IE i received an error.
i use last version of flot chart.
what`s problem?

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;
SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media
Center PC 6.0)

Timestamp: Thu, 25 Feb 2010 08:31:33 UTC

Message: 'undefined' is null or not an object

Line: 41

Char: 7

Code: 0

URI: http://localhost/easycom-sadaf/visitors.php?do=trend&logf=DI8.txt

Original issue reported on code.google.com by mt1...@gmail.com on 25 Feb 2010 at 8:45

GoogleCodeExporter commented 8 years ago
There's perhaps a mistake in your Javascript code. Sometimes buggy code can 
work fine
in Firefox while failing flat in IE. Look at line 41 in one of your files (it 
usually
doesn't say which file so you have to guess - note that it might be in the HTMl 
page
your PHP generates, you can see it with View source) and see if you can spot 
the error.

Without seeing your code, it's impossible for to tell what's wrong. If you need 
more
help, please try the mailing list/forum, this issue tracker is for bugs in Flot 
code,
and while you might have found a Flot bug, I think you need to be a bit further 
in
your debugging before I'm going to accept a report. :) Hope that's OK.

Original comment by olau%iol...@gtempaccount.com on 25 Feb 2010 at 8:27

GoogleCodeExporter commented 8 years ago
so, i attached my code on this post.
what`s problem?

Original comment by mt1...@gmail.com on 3 Mar 2010 at 10:17

Attachments:

GoogleCodeExporter commented 8 years ago
not idea?!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="layout.css" rel="stylesheet" type="text/css"></link>
    <!--[if IE]><script language="javascript" type="text/javascript"
src="../excanvas.js"></script><![endif]-->
    <script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
    <script language="javascript" type="text/javascript"
src="flot/jquery.flot.js"></script>
    <script language="javascript" type="text/javascript"
src="flot/jquery.flot.selection.js"></script>
    <script language="javascript" type="text/javascript"
src="flot/jquery.flot.navigate.min.js"></script>
    <style>
    </style>
 </head>
    <body>
<? echo '<table border=0 width="50%" align=center>';
$mycon=mysql_connect("192.168.8.206","root","2240225");
mysql_select_db("easycom",$mycon);
echo '<tr><td align=center ><h1>'.$_GET['logf'].'</h1></td></tr></table>';     
?>
    <div id="placeholder" style="width:600px;height:300px;"></div>
    <p class="message"></p>
<script id="source">
$(function () {
var d = [[1196636400000, 0], [1196722800000, 77], [1196809200000, 3636]];
    for (var i = 0; i < d.length; ++i)
      d[i][0] += 60 * 60 * 1000;
    function weekendAreas(axes) {
        var markings = [];
        var d = new Date(axes.xaxis.min);
        d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
        d.setUTCSeconds(0);
        d.setUTCMinutes(0);
        d.setUTCHours(0);
        var i = d.getTime();
        do {
            markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
            i += 7 * 24 * 60 * 60 * 1000;
        } while (i < axes.xaxis.max);
        return markings;
    }
    var options = {
    series: { lines: { show: true }, shadowSize: 2 },
        xaxis: {mode: "time" },
        grid: { markings: weekendAreas,hoverable: true, clickable: true,
backgroundColor: "#ffffff" },
        zoom: {
            interactive: true
        },
        pan: {
            interactive: true
        }
    };
    function showTooltip(x, y, contents) {
        $('<div id="tooltip" style="font-weight:bold; font-size:"18";">' + contents +
'</div>').css( {
            position: 'absolute',
            display: 'none',
            top: y + 10,
            left: x + 15,
            border: '1px solid #fdd',
            padding: '2px',
            'background-color': '#fee',
            opacity: 0.80
        }).appendTo("body").fadeIn(200);
    }
    var previousPoint = null;
    $("#placeholder").bind("plothover", function (event, pos, item) {
        $("#x").text(pos.x.toFixed(2));
        $("#y").text(pos.y.toFixed(2));
            if (item) {
                if (previousPoint != item.datapoint) {
                    previousPoint = item.datapoint;
                    $("#tooltip").remove();
                    var x = item.datapoint[0].toFixed(2),
                        y = item.datapoint[1].toFixed(2);
                    showTooltip(item.pageX, item.pageY,
              x + " = " + y);
                }
            }
            else {
                $("#tooltip").remove();
                previousPoint = null;
            }
    });
    $("#placeholder").bind("plotclick", function (event, pos, item) {
        if (item) {
            $("#clickdata").text("You clicked point " + item.dataIndex + " in " +
item.series.label + ".");
            plot.highlight(item.series, item.datapoint);
        }
    });
    var plot = $.plot($("#placeholder"), [d], options);

    var overview = $.plot($("#overview"), [d], {
        series: {
            lines: { show: true, lineWidth: 1 },
            shadowSize: 0
        },
        xaxis: { ticks: [], mode: "time" },
        yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
        selection: { mode: "x" },
    });
 var plot = $.plot(placeholder, d, options);
     $("#placeholder").bind("plotselected", function (event, ranges) {
        plot = $.plot($("#placeholder"), [d],
                      $.extend(true, {}, options, {
                          xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
                      }));
        overview.setSelection(ranges, true);
    });
    $("#overview").bind("plotselected", function (event, ranges) {
        plot.setSelection(ranges);
    });
});
</script>
<table ><TR><TD width="95%">
<form method=get action=?>
</TR></table>
</form>
</body>
</html>

Original comment by mt1...@gmail.com on 6 Mar 2010 at 7:29

GoogleCodeExporter commented 8 years ago
The classical IE error is a comma to much. IE is very picky about commas, so 
while {
a: 1, b: 2, } is legal in Firefox, it's not legal in IE (it should be { a: 1, 
b: 2}).

Looking at your code, on the line

        selection: { mode: "x" },

you have a comma at the end. That looks like an error to me. Just remove the 
comma.

There might be more though. As I said, look at the page with Firefox, view the 
source
(usually Ctrl+U) and in that find line 41 that IE is referring to, see if you 
can
spot the error. If you can't find it that way, try putting in alert("hello") 
calls
and see how many of those get called before IE gives up.

Original comment by olau%iol...@gtempaccount.com on 15 Mar 2010 at 12:07

GoogleCodeExporter commented 8 years ago
perfect!
very thanks
solved :)

Original comment by mt1...@gmail.com on 17 Mar 2010 at 10:56

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 4 Jun 2012 at 2:52