<tfoot id='6rI5Y'></tfoot>
    <bdo id='6rI5Y'></bdo><ul id='6rI5Y'></ul>
      <legend id='6rI5Y'><style id='6rI5Y'><dir id='6rI5Y'><q id='6rI5Y'></q></dir></style></legend>

      <i id='6rI5Y'><tr id='6rI5Y'><dt id='6rI5Y'><q id='6rI5Y'><span id='6rI5Y'><b id='6rI5Y'><form id='6rI5Y'><ins id='6rI5Y'></ins><ul id='6rI5Y'></ul><sub id='6rI5Y'></sub></form><legend id='6rI5Y'></legend><bdo id='6rI5Y'><pre id='6rI5Y'><center id='6rI5Y'></center></pre></bdo></b><th id='6rI5Y'></th></span></q></dt></tr></i><div id='6rI5Y'><tfoot id='6rI5Y'></tfoot><dl id='6rI5Y'><fieldset id='6rI5Y'></fieldset></dl></div>

      1. <small id='6rI5Y'></small><noframes id='6rI5Y'>

        将谷歌折线图放在传单弹出窗口中

        时间:2023-08-08
              <bdo id='tgAKW'></bdo><ul id='tgAKW'></ul>
                <tbody id='tgAKW'></tbody>

                  <small id='tgAKW'></small><noframes id='tgAKW'>

                  <legend id='tgAKW'><style id='tgAKW'><dir id='tgAKW'><q id='tgAKW'></q></dir></style></legend>

                  <tfoot id='tgAKW'></tfoot>
                  <i id='tgAKW'><tr id='tgAKW'><dt id='tgAKW'><q id='tgAKW'><span id='tgAKW'><b id='tgAKW'><form id='tgAKW'><ins id='tgAKW'></ins><ul id='tgAKW'></ul><sub id='tgAKW'></sub></form><legend id='tgAKW'></legend><bdo id='tgAKW'><pre id='tgAKW'><center id='tgAKW'></center></pre></bdo></b><th id='tgAKW'></th></span></q></dt></tr></i><div id='tgAKW'><tfoot id='tgAKW'></tfoot><dl id='tgAKW'><fieldset id='tgAKW'></fieldset></dl></div>
                  本文介绍了将谷歌折线图放在传单弹出窗口中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试将 Google 折线图插入独立的 Leaflet 弹出窗口.我按照here 的指示在标题中有图表生成代码,并且然后我将 div 元素放在弹出窗口中.

                  I'm trying to insert a Google line chart into a standalone Leaflet popup. I have the chart generation code in the header as instructed here, and then I put the div element in the popup.

                  var popup = L.popup()
                    .setLatLng([51.5, -0.09])
                    .setContent('<div id="curve_chart" style="width: 400px; height: 200px"></div>')
                    .openOn(mymap);
                  

                  这只会创建一个空的 400x200 弹出窗口.我很确定问题的出现是因为图表生成脚本找不到 div 元素,因为它还不存在,但我不知道如何解决它.我尝试在声明弹出窗口后移动脚本,但这并没有做任何事情.如何在弹出窗口中显示图表?

                  This just creates an empty 400x200 popup. I'm pretty sure that the problem arises because the chart generation script can't find the div element because it doesn't exist yet, but I don't know how to fix it. I tried moving the script after the declaration of the popup, but that didn't do anything. How can I display the chart in the popup?

                  推荐答案

                  尝试构建类似于以下代码片段的代码...

                  try structuring the code similar to the following snippet...

                  1) 先加载谷歌图表

                  2) 然后加载你需要的其他东西

                  2) then load other stuff you need

                  3) 然后尝试打开弹出窗口

                  3) then try opening the popup

                  // run this before anything else on the page
                  google.charts.load('current', {
                    callback: initPage,
                    packages: ['corechart']
                  });
                  
                  function initPage() {
                    // do normal start up stuff here
                    // ...
                  
                    // open the popup
                    var popup = L.popup()
                      .setLatLng([51.5, -0.09])
                      .setContent('<div id="curve_chart" style="width: 400px; height: 200px"></div>')
                      .openOn(mymap);
                  
                    drawChart();
                  }
                  
                  function drawChart() {
                    var data = new google.visualization.DataTable();
                    data.addColumn('string', 'Topping');
                    data.addColumn('number', 'Slices');
                    data.addRows([
                      ['Mushrooms', 3],
                      ['Onions', 1],
                      ['Olives', 1],
                      ['Zucchini', 1],
                      ['Pepperoni', 2]
                    ]);
                  
                    var container = document.getElementById('curve_chart');
                    var chart = new google.visualization.LineChart(container);
                    chart.draw(data);
                  }
                  

                  这篇关于将谷歌折线图放在传单弹出窗口中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:检索 Leaflet 的当前比例值 下一篇:传单在按钮单击时打开特定标记弹出窗口

                  相关文章

                  最新文章

                1. <i id='HIT4e'><tr id='HIT4e'><dt id='HIT4e'><q id='HIT4e'><span id='HIT4e'><b id='HIT4e'><form id='HIT4e'><ins id='HIT4e'></ins><ul id='HIT4e'></ul><sub id='HIT4e'></sub></form><legend id='HIT4e'></legend><bdo id='HIT4e'><pre id='HIT4e'><center id='HIT4e'></center></pre></bdo></b><th id='HIT4e'></th></span></q></dt></tr></i><div id='HIT4e'><tfoot id='HIT4e'></tfoot><dl id='HIT4e'><fieldset id='HIT4e'></fieldset></dl></div>

                    <bdo id='HIT4e'></bdo><ul id='HIT4e'></ul>
                  <tfoot id='HIT4e'></tfoot>
                2. <small id='HIT4e'></small><noframes id='HIT4e'>

                    1. <legend id='HIT4e'><style id='HIT4e'><dir id='HIT4e'><q id='HIT4e'></q></dir></style></legend>