程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了无法在 HTML/JS 应用程序的结果中获取蜘蛛图?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决无法在 HTML/JS 应用程序的结果中获取蜘蛛图??

开发过程中遇到无法在 HTML/JS 应用程序的结果中获取蜘蛛图?的问题如何解决?下面主要结合日常开发的经验,给出你关于无法在 HTML/JS 应用程序的结果中获取蜘蛛图?的解决方法建议,希望对你解决无法在 HTML/JS 应用程序的结果中获取蜘蛛图?有所启发或帮助;

嗨,我正在尝试将我的问卷数据放在蜘蛛图中,但目前我卡住了,无法显示它,我在我的 Js 中使用以下代码

$('.spIDerChart').highcharts({

        chart: {
            polar: true,type: 'line',style: {
              FontFamily: "Georgia,serif",// default Font
              FontSize: '12px'
            }
        },colors: ['#0067ac','#a02842','#007680'],pane: {
            size: '80%'
        },xAxis: {
            categorIEs: ["Section 1","Section 2","Section 3","Section 4","Section 5"],tickmarkPlacement: 'on',linewidth: 0
        },yAxis: {
            grIDlineInterpolation: 'polygon',linewidth: 0,min: 0,max: 60,tickInterval: 5
        },tooltip: {
            shared: true,pointFormat: '<span style="color:{serIEs.color}"> <b>{point.y:,.0f}%</b><br/>'
        },legend: {
            enabled: false
        },serIEs: [{    
            data: [55,48,43,39,18],pointPlacement: 'on'
        }]
    });

但是,如果我使用的是个人]y 比此代码有效,但是当我将它与其他代码放在一起以显示在结果中时,它不起作用...请告诉我...我哪里出错了这里是完整的代码

HTML :-



<script src="https://cdnjs.cloudFlare.com/AJAX/libs/jquery/3.3.1/jquery.min.Js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/CSS/bootstrap.min.CSS">
    <script src="https://AJAX.GoogleAPIs.com/AJAX/libs/jquery/3.5.1/jquery.min.Js"></script>
    <script src="https://cdnjs.cloudFlare.com/AJAX/libs/popper.Js/1.16.0/umd/popper.min.Js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/Js/bootstrap.min.Js"></script>
    <script src="https://cdnjs.cloudFlare.com/AJAX/libs/Chart.Js/2.9.3/Chart.min.Js"></script>
    <link rel="stylesheet" href="CSS/styles.CSS">
    <script src="myscript.Js"></script> 

<section class="container py-4">
    <div class="row">
        <div class="col-md-12">
            <h2>Survey</h2>
            <ul ID="tabs" class="nav nav-tabs">
                <li class="nav-item"><a href="" data-target="#personalinfo" data-toggle="tab" class="nav-link small text-uppercase active">Personal Info</a></li>
                <li class="nav-item"><a href="" data-target="#section1" data-toggle="tab" class="nav-link small text-uppercase">Section 1</a></li>
                <li class="nav-item"><a href="" data-target="#section2" data-toggle="tab" class="nav-link small text-uppercase">Section 2</a></li>
                <li class="nav-item"><a href="" data-target="#results" data-toggle="tab" class="nav-link small text-uppercase">Results</a></li>
            </ul>
            <br>
            <div ID="tabsContent" class="tab-content">
                <div ID="personalinfo" class="tab-pane fade active show">
                    <div class="form-group">
                        <label for="fullname">Full name address</label>
                        <input type="email" class="form-control" ID="fullname" aria-describedby="nameHelp" placeholder="Enter full name">
                        <small ID="nameHelp" class="form-@R_708_3801@-muted">Please enter your full name.</small>
                    </div>
                    <div class="form-group">
                        <label for="email">Email address</label>
                        <input type="email" class="form-control" ID="email" aria-describedby="email" placeholder="Enter email">
                        <small ID="email" class="form-@R_708_3801@-muted">Please enter your valID email address.</small>
                    </div>
                    <div class="form-group">
                        <label for="age">password</label>
                        <input type="number" class="form-control" ID="age" aria-describedby="age" placeholder="Age">
                        <small ID="age" class="form-@R_708_3801@-muted">Please enter your age in number.</small>
                    </div>
                    <a class="btn btn-priMary btnNext" >Next</a>

                </div>
                <div ID="section1" class="tab-pane fade">
                    <div class="section-1-questions">
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 1:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question1" ID="grIDRadios1" value="1">
                                        <label class="form-check-label" for="grIDRadios1">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-1">
                                        <input class="form-check-input " type="radio" name="question1" ID="grIDRadios2" value="2">
                                        <label class="form-check-label" for="grIDRadios2">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question1" ID="grIDRadios3" value="3">
                                        <label class="form-check-label" for="grIDRadios3">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 2:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question2" ID="grIDRadios4" value="1">
                                        <label class="form-check-label" for="grIDRadios4">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question2" ID="grIDRadios5" value="2">
                                        <label class="form-check-label" for="grIDRadios5">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question2" ID="grIDRadios6" value="3">
                                        <label class="form-check-label" for="grIDRadios6">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 3:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question3" ID="grIDRadios7" value="1">
                                        <label class="form-check-label" for="grIDRadios7">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question3" ID="grIDRadios8" value="2">
                                        <label class="form-check-label" for="grIDRadios8">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-1">
                                        <input class="form-check-input" type="radio" name="question3" ID="grIDRadios9" value="3">
                                        <label class="form-check-label" for="grIDRadios9">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                    </div>
                    <a class="btn btn-priMary btnNext" >Next</a>
                    <a class="btn btn-priMary btnPrevIoUs" >PrevIoUs</a>
                </div>
                <div ID="section2" class="tab-pane fade">
                    <div class="section-2-question">
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 4:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question4" ID="grIDRadios10" value="1">
                                        <label class="form-check-label" for="grIDRadios10">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question4" ID="grIDRadios11" value="2">
                                        <label class="form-check-label" for="grIDRadios11">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question4" ID="grIDRadios12" value="3">
                                        <label class="form-check-label" for="grIDRadios12">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 5:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question5" ID="grIDRadiOS13" value="1">
                                        <label class="form-check-label" for="grIDRadiOS13">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question5" ID="grIDRadios14" value="2">
                                        <label class="form-check-label" for="grIDRadios14">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question5" ID="grIDRadios15" value="3">
                                        <label class="form-check-label" for="grIDRadios15">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 4:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question6" ID="grIDRadios16" value="1">
                                        <label class="form-check-label" for="grIDRadios16">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question6" ID="grIDRadios17" value="2">
                                        <label class="form-check-label" for="grIDRadios17">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question6" ID="grIDRadios18" value="3">
                                        <label class="form-check-label" for="grIDRadios18">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                        <fIEldset class="form-group">
                            <div class="row">
                                <legend class="col-form-label col-sm-2 pt-0">Question 4:</legend>
                                <div class="col-sm-10">
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question7" ID="grIDRadios19" value="1">
                                        <label class="form-check-label" for="grIDRadios19">
                                            1
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question7" ID="grIDRadios20" value="2">
                                        <label class="form-check-label" for="grIDRadios20">
                                            2
                                        </label>
                                    </div>
                                    <div class="form-check section-2">
                                        <input class="form-check-input" type="radio" name="question7" ID="grIDRadios21" value="3">
                                        <label class="form-check-label" for="grIDRadios21">
                                            3
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </fIEldset>
                    </div>
                    <a class="btn btn-priMary btnNext" >Next</a>
                    <a class="btn btn-priMary btnPrevIoUs" >PrevIoUs</a>
                </div>
                <div ID="results" class="tab-pane fade">
                    <div class="final-results"></div>
                    <br>
                    <h3 class="chart-title">automation Benefits Measured (SpIDer Chart)</h3>

  <div class="spIDerChart"></div>
                    <br>
                    <button type="button" class="btn btn-success" onclick="displayRadiovalue()">
                        Show Results
                    </button>
                    <br>
                    <br>
                    <div ID="control" style="display: none">
                        <a ID="toemail" class="btn btn-link" href="mailto:youremail@domain.com?subject=Survey response&body=">Send to
                            email</a>&nbsp;<button onclick="window.print();" class="btn btn-warning">Send to pdf</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

Js :-

function displayRadiovalue() {
    let section1 = document.querySELEctorAll('.section-1 > input[type="radio"]')
    let section2 = document.querySELEctorAll('.section-2 > input[type="radio"]')
    let sectionnew = document.querySELEctorAll('#section1').values
    let fullname = document.querySELEctor('#fullname').value
    let email = document.querySELEctor('#email').value
    let age = document.querySELEctor('#age').value
    var ctx = document.querySELEctor('#spIDerChart').getContext('2d');
    let section1@R_738_10586@l = 0
    let section2@R_738_10586@l = 0
    let section1Question = 0
    let section2Question = 0
    let finalResults = document.querySELEctor('.final-results')
    let result1 = ''
    let result2 = ''
    finalResults.INNERHTML = ''
  
    //Section 1
    section1.forEach(function(radio,indeX) {
        if (radio.checked) {
            section2Question++
            section1@R_738_10586@l += +radio.value
        }
    })
  
    //Section 2
    section2.forEach(function(radio,indeX) {
        if (radio.checked) {
            section1Question++
            section2@R_738_10586@l += +radio.value
        }
    })

    $('.spIDerChart').highcharts({

        chart: {
            polar: true,pointPlacement: 'on'
        }]
    });

  
    //Final Results and valIDation
    if (fullname.value != '' && email.value != '' && age.value != '') {
        if (section1@R_738_10586@l > 0 && section2@R_738_10586@l > 0) {
            finalResults.INNERHTML += gendetails(fullname,email,agE)
            finalResults.INNERHTML += "<h2>Results</h2>"
            finalResults.INNERHTML += gentable(section1Question,section1@R_738_10586@l,1)
            finalResults.INNERHTML += gentable(section2Question,section2@R_738_10586@l,2)
            finalResults.INNERHTML += "<h2>Chart Results</h2>"
            document.getElementByID("control").style.display = "block";
            document.getElementByID("resultsChart").style.display = "block";
            document.getElementByID("toemail").href += document.querySELEctor(".final-results").innerText;
            new Chart(ctx,highcharts); //show chart
        } else {
            finalResults.INNERHTML = 'Snap! Please SELEct the atleast one survey question from each section '
        }
    } else {
        finalResults.INNERHTML = 'Snap! Please enter your name,emial,age in the first section '
    }
  }
  
  function gendetails(name,agE) {
    var result = "<h2>Personal Info</h2>"
    result += "<b>Full name:</b> <span>" + name + "</span><br>"
    result += "<b>Email name:</b> <span>" + email + "</span><br>"
    result += "<b>Age: </b> <span>" + age + "</span><br>"
    return result
  }
  
  function gentable(ques,@R_738_10586@l,section) {
    var result = "<b>Section " + section + ":</b><br>"
    var tr = "<tr><th>" + @R_738_10586@l + "</th><th>" + ((@R_738_10586@l / (ques * 3)) * 100).toFixed(2) + "</th></tr>"
    result += "<table><thead><tr><th>@R_738_10586@l score</th><th>Percentage</th></tr></thead><tbody>" + tr + "</tbody></table>"
    return result
  }
  $(document).ready(function(){
  $('.btnNext').click(function(){
    $('.nav-tabs .active').closest('li').next('li').find('a').trigger('click');
  });
  
  $('.btnPrevIoUs').click(function(){
    $('.nav-tabs .active').closest('li').prev('li').find('a').trigger('click');
  });
});

CSS :-


canvas {
    display: none
}

@media print {
    body * {
        visibility: hIDden;
    }
    canvas {
        visibility: visible;
        margin-top: 30%;
    }
    .form-control {
        visibility: visible;
    }
    .final-results * {
        visibility: visible;
    }
    .final-results,.form-control {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
    }
}

table,table tr th,table tr td {
    border: 1px solID black;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的无法在 HTML/JS 应用程序的结果中获取蜘蛛图?全部内容,希望文章能够帮你解决无法在 HTML/JS 应用程序的结果中获取蜘蛛图?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。