Domanda

Ho il seguente codice, che stava creando un grafico nella pagina di conferma del mio Drupal Webform (ho creato uno stress test) e funziona bene per diverse settimane. Ora all'improvviso questo ha appena smesso di funzionare.

http://www.beatinganger.com/node/353/done?sid=720

Qualcuno ha qualche idea per cui ha smesso di funzionare e come farlo funzionare di nuovo? Non ho apportato modifiche al codice. Mi sono strappato i capelli.

jQuery(function($) {
    var ticks = [], vals = [];
    var one = $('#edit-submitted-physical-state, #edit-submitted-mental-state, #edit-submitted-feelings-of-belonging, #edit-submitted-feelings-of-justice, #edit-submitted-feelings-of-integrity, #edit-submitted-weight-management, #edit-submitted-emotional-ease, #edit-submitted-feelings-of-stimulation, #edit-submitted-feelings-of-justice, #edit-submitted-feelings-of-relationship, #edit-submitted-feelings-of-satisfaction')
        .each(function(i, el) {
            vals.push(Number(el.value));
            ticks.push($('label[for="'+el.id+'"]').text().replace('Feelings of ', '').replace(': ', '').replace(' State', '').replace(' Ease', '').replace(' Management', '').replace(' Control', ''));
        });

    var plot1 = $.jqplot('chart1', [vals], {
        seriesDefaults: {
            renderer: $.jqplot.BarRenderer
        },
        axes: {
            xaxis: {
                renderer: $.jqplot.CategoryAxisRenderer,
                ticks: ticks
            },
            yaxis: {
            min: 0,
        max: 20, 
        }


        }
    });
});

Nella mia sezione testa ho quanto segue

<script language="javascript" type="text/javascript" src="http://www.beatinganger.com/scripts/jquery.jqplot.js"></script> 
<script language="javascript" type="text/javascript" src="http://www.beatinganger.com/scripts/jqplot.barRenderer.js"></script> 
<script language="javascript" type="text/javascript" src="http://www.beatinganger.com/scripts/jqplot.categoryAxisRenderer.js"></script> 

<link rel="stylesheet" type="text/css" href="http://www.beatinganger.com/scripts/jquery.jqplot.css" />
È stato utile?

Soluzione

JQPlot si aspetta un ID, ma stai usando una classe sulla tua pagina. Prova a cambiarlo in id = "chart1"

Altri suggerimenti

Fatto. Potrebbe essere che il server sia inattivo o che il file sia stato spostato. Quindi, salva il file .js da quel server e quindi usalo dalla directory locale.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top