oetiker / RrdGraphJS

An interactive graphing component for RRDtool
http://www.rrdtool.org
GNU General Public License v2.0
54 stars 7 forks source link

Graph is blank #7

Open Rivalld opened 3 years ago

Rivalld commented 3 years ago

Hello

Today i tried to implement RrdGraphJS. Im trying it out and the script seems to work. The only Issue i have, is that the Graph is just blank. I can zoom into it still stays blank.

Here's my syntax in HTML

!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link href="rrdGraphCtrl.css" rel="stylesheet">
    <!-- the modules are implemented on top of the qxWeb library
         from www.qooxdoo.org. It provides excellent
         modularization and event normalization support out of
         the box and thus made implementation of these
         modules much simpler -->
    <script type="text/javascript" src="q-5.0.2.min.js"></script>
    <script type="text/javascript" src="moment.js"></script>
    <script type="text/javascript" src="moment-timezone-with-data.js"></script>
    <script type="text/javascript" src="rrdGraphPng.js"></script>
    <script type="text/javascript" src="rrdGraphCtrl.js"></script>
    <script type="text/javascript">
        q.ready(function(){

            // 'activate' the charts
            var graphs = [];
            q('.graph').forEach(function(item){
                graphs.push(
                    q(item).rrdGraphPng({
                        canvasPadding: 120,
                        initialStart: null
                    })
                );
            });

            // crate a control panel and attach it to the charts
            q('#ctrl').rrdGraphCtrl(graphs,{
                initialTimeRange: 'Last 60 Minutes',
                resetTimeOnDateChange: true
            });

            // you can also remove all the magic again
            q('#rebinder').on('click',function(){
                // q('#ctrl').dispose();
                q('.graph').dispose();
                q('.graph').forEach(function(item){
                    graphs.push(
                        q(item).rrdGraphPng({
                        canvasPadding: 120,
                        initialStart: null
                        })
                    );
                });
                q('#ctrl').rebind(graphs);
            });
        });
    </script>
</head>
<body>
<!--    <button id="rebinder">Rebind</button> -->

    <div id="ctrl"></div>

    <div><img
        style="width:700px;height:350px" class="graph"
        data-src-template="bua-bah39-sw-01.rrd?width={{700}}&amp;height={{350}}&amp;start={{1209600}}&amp;end={{end}}&amp;zoom={{zoom}}&amp;rand={{random}}"
    /></div>

<!--   <div><img
        style="width:700px;height:350px" class="graph"
        data-src-template="cpuutil.png?width={{700}}&amp;height={{350}}&amp;start={{start}}&amp;end={{end}}&amp;zoom={{zoom}}&amp;rand={{random}}"
   />--></div>

    <button id="remove">Remove it all!</button>
</body>
</html>

I added a RRD to the data-src-template and i get no errors but its still blank. Do you have an idea what the Problem could be?

Thanks

oetiker commented 3 years ago

You need a backend which renders images according to the requests produced by the frontend ... look at the network tab in the debugger of your browser to see the requests sent to the backend ...