如何从javascript中的.json文件在弹出窗口中呈现json数据 仪表板 自溶剂 搜索 情绪 来源 问题 形容词 类型 其他

如何从javascript中的.json文件在弹出窗口中呈现json数据 仪表板 自溶剂 搜索 情绪 来源 问题 形容词 类型 其他,javascript,jquery,html,Javascript,Jquery,Html,这是我的项目,在这个项目中,如何使用JavaScript从弹出窗口中的.JSON文件中获取数据。 在这些代码中,如何使用java脚本在弹出窗口中呈现数据,在这些代码中,如果可以通过url检索JSON文件,则要呈现多个JSON文件: 在json文件中: $(function() { $( ".column" ).sortable({ connectWith: ".column", handle: ".portlet-header", cancel: ".

这是我的项目,在这个项目中,如何使用JavaScript从弹出窗口中的.JSON文件中获取数据。
在这些代码中,如何使用java脚本在弹出窗口中呈现数据,在这些代码中,如果可以通过url检索JSON文件,则要呈现多个JSON文件:

在json文件中:

$(function() {
    $( ".column" ).sortable({
      connectWith: ".column",
      handle: ".portlet-header",
      cancel: ".portlet-toggle",
      placeholder: "portlet-placeholder ui-corner-all"
    });

    $( ".portlet" )
      .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
      .find( ".portlet-header" )
        .addClass( "ui-widget-header ui-corner-all" )
        .prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");

    $( ".portlet-toggle" ).click(function() {
      var icon = $( this );
      icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" );
      icon.closest( ".portlet" ).find( ".portlet-content" ).toggle();
    });
  });











   $(function(json) {
    $( "#dialog" ).dialog();
    console.log(json);

  });

$.getJSON("AnalyticsFoxMain.json", function(json) {
    console.log(json); // this will show the info it in firebug console

    window.onload = function () {
    d3.json("data.json", function(data) {
  console.log(data[0]);
});
    console.log(json);

     $('#jsonImage').attr('src', json.image);
     $( '#jsonText'  ).text(json.Company);
     $('#jsonCde').text(json.Brand);
     $('#jsonDesc').text(json.Description);
    var chart = new CanvasJS.Chart("chartContainer",
    {
        title:{
            text: "sentiment"
        },
                animationEnabled: true,
        legend:{
            verticalAlign: "center",
            horizontalAlign: "left",
            fontSize: 12,
            fontFamily: "Helvetica"        
        },
        theme: "red and blue",
        data: [
        {        
            type: "pie",       
            indexLabelFontFamily: "Garamond",       
            indexLabelFontSize: 20,
            indexLabel: "{label} {y}",
            startAngle:-25,      
            showInLegend: true,
            toolTipContent:" {y}",
            dataPoints: [
                {  y: json.Sentiment.positive},
                { y: json.Sentiment.negative},

            ]
        }
        ]
    });
    chart.render();
 var chart = new CanvasJS.Chart("chartContainer1",
    {

        title: { 
            text: "Source" 
        }, 
        data: [ 
        { 
            type: "doughnut", 
            indexLabel: " {y}",
            toolTipContent: "{y}",
            dataPoints: [ 
                {  y: json.Source.facebook},
                { y: json.Source.twitter},
                { y: json.Source.mouthshut}
            ] 
        } 
        ] 
    });
    chart.render();





google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {

        var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['Dealer1',    3540  ],
          ['Dealer2',1320]

        ]);

        var options = {
          title: 'others'
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
      }
chart.render();



   $(function () {
    $('#container').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: 0,
            plotShadow: false
        },
        title: {
            text: 'Adjectives',
            align: 'center',
            verticalAlign: 'middle',
            y: 40
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}</b>'
        },
        plotOptions: {
            pie: {
                dataLabels: {
                    enabled: true,
                    distance: -50,
                    style: {
                        fontWeight: 'bold',
                        color: 'white',
                        textShadow: '0px 1px 2px black'
                    }
                },
                startAngle: -90,
                endAngle: 90,
                center: ['50%', '75%']
            }
        },
        series: [{
            type: 'pie',
            name: 'Adjectives',
            innerSize: '50%',
            data: [
                ['Space Inside',       2000],

                ['Looks',   4000],
                ['Reliability',    3000],
                {
                    name: 'Proprietary or Undetectable',
                    y: 0.2,
                    dataLabels: {
                        enabled: false
                    }
                }
            ]
        }]
    });
});

var chart = AmCharts.makeChart( "chartdiv", {
  "type": "pie",
  "theme": "light",
  "dataProvider": [ {
    "title": "petrol",
    "value": 3540
  }, {
    "title": "Diesel",
    "value": 1320
  } ],
  "titleField": "title",
  "valueField": "value",
  "labelRadius": 5,

  "radius": "42%",
  "innerRadius": "60%",
  "labelText": "[[title]]",
  "export": {
    "enabled": true
  }
} );



    }


    $(function () {
    $('#container1').highcharts({
        chart: {
            type: 'pie',
            options3d: {
                enabled: true,
                alpha: 350
            }
        },
        title: {
            text: 'Issues'
        },
        subtitle: {
            text: ''
        },
        plotOptions: {
            pie: {
                innerSize: 50,
                depth: 10
            }
        },
        series: [{
            name: '',
            data: [
                ['GearProblems', 4000],
                ['EngineKnocking', 2000],
                ['PowerWindows',3000]
            ]
        }]
    });
});
});
在html中:

data = '[
    {"surname" : "Alex", "first_name" : "Chaosman"},
    {"surname" : "Ben", "first_name" : "Dickson"},]';

var arr=JSON.parse(数据);
console.log(arr[0]。名字+“”+arr[0]。姓氏);
console.log(arr[1]。名字+“”+arr[1]。姓氏);

请发布一些与问题相关的项目的html/CSS/JS…$('popup.body').html(''+JSON.stringify(yourObject)+'')
<script type="text/javascript" src="file.json"></script>
<script>
    var arr = JSON.parse(data);
    console.log(arr[0].first_name + ' ' + arr[0].surname);
    console.log(arr[1].first_name + ' ' + arr[1].surname);
</script>