Использование flot и bootstrap вместе - PullRequest
0 голосов
/ 11 июля 2019

Я пытаюсь использовать flot.js для построения некоторых токов f. Проблема в том, что я не могу использовать flot.js в своем коде. Я использую версию jquery 3.4.0. Версия Flot - 0.8.3

Код работает нормально без включения библиотеки flot.

Мой index.php


    <html>
    <head>
        <title>Jupiter</title>
        <link rel="icon" href="./pics/jupiter.png">
        <link rel="stylesheet" href="./css/bootstrap.min.css">
        <link rel="stylesheet" href="./css/frontend.css">
        <link rel="stylesheet" href="./css/bootstrap-toggle.min.css">
        <link rel="stylesheet" href="./css/jquery-confirm.min.css">
        <script src="./js/jquery.min.js"></script>
        <script src="./js/bootstrap.min.js"></script>
        <script src="./js/bootstrap-toggle.min.js"></script>
        <script src="./js/bootbox.min.js"></script>
        <script src="./js/jquery-confirm.min.js"></script>
        <script src="./js/jquery.flot.min.js"></script>
        <script src="./js/jquery.flot.time.js"></script>
        <script src="./js/jquery.flot.tooltip.js"></script>
    </head>
    <body>

Main content here
<div id="RFD_curent_1"></div>
</body>
<script src='./js/index.js'></script>
</html>

Мой index.js


    function initialize_currents(){
            var time=(new Date).getTime();
            for(var i=0;i<14400;i++){
                //data1.push([time+i-14400000,32]);
                data1.push([]);
            }
            for(var i=0;i<14400;i++){
                //data2.push([time+i-14400000,25]);
                data2.push([]);
            }
            //data.push([time,0]);
            var dataset = [{label: "0xbb36",data: data1},{label:"0xc563",data:data2}];
            $.plot($("#RFD_curent_1"), dataset, options);
        }
    $(document).ready(function() {
            initialize_currents();
    }

Я получаю следующее предупреждение и сообщение об ошибке в консоли Chrome

jquery.min.js:2 jQuery.Deferred exception: Cannot read property 'toLowerCase' of undefined TypeError: Cannot read property 'toLowerCase' of undefined
    at Object.t.color.extract
(http://192.168.0.170/js/jquery.flot.min.js:1:695)
    at _ (http://192.168.0.170/js/jquery.flot.min.js:1:27080)
    at W (http://192.168.0.170/js/jquery.flot.min.js:1:13848)
    at new e (http://192.168.0.170/js/jquery.flot.min.js:2:1045)
    at Function.t.plot (http://192.168.0.170/js/jquery.flot.min.js:2:3828)
    at initialize_currents (http://192.168.0.170/js/index.js:109:11)
    at HTMLDocument.<anonymous> (http://192.168.0.170/js/index.js:434:9)
    at e (http://192.168.0.170/js/jquery.min.js:2:29453)
    at t (http://192.168.0.170/js/jquery.min.js:2:29755) undefined



jquery.min.js:2 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
    at Object.t.color.extract (jquery.flot.min.js:1)
    at _ (jquery.flot.min.js:1)
    at W (jquery.flot.min.js:1)
    at new e (jquery.flot.min.js:2)
    at Function.t.plot (jquery.flot.min.js:2)
    at initialize_currents (index.js:109)
    at HTMLDocument.<anonymous> (index.js:434)
    at e (jquery.min.js:2)
    at t (jquery.min.js:2)

1 Ответ

0 голосов
/ 11 июля 2019

так что я понял, что проблема проста, вы продемонстрировали число с запятой (,) и должны быть точкой (.)

//data2.push([time+i-14400000.25]);
...