Pergunta

I have the following code, which was creating a graph on the confirmation page of my Drupal Webform (I created a stress test), and has been working fine for several weeks. Now all of a sudden this entirely just stopped working.

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

Anyone have any ideas why it stopped working, and how to get it working again? I didn't make any changes to the code. I have been tearing my hair out.

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, 
        }


        }
    });
});

In my head section I have the following

<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" />
Foi útil?

Solução

jqPlot is expecting an ID, but you're using a class on your page. Try changing it to id="chart1"

Outras dicas

Got it. May be that server is down or file have been moved. So, save .js file from that server and then use it from local directory.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top