douchan6512 2019-01-28 18:35
浏览 175

如何自动刷新Plot.ly(JS)图表?

I tried all different ways to use trigger the refresh automatically after one second. But unable to do so, if any expert of Plot.ly JS please help. Retrieving data on Y axis from MySql through linking a Php

Chart is plotted successfully but unable to refresh on its own when mySQL data is updated the plot unless to refresh the browser.

Thanks in advance.

<script src="js/plotly-latest.min.js"></script>
<script>
    $(document).ready(function zk (){
                                var trace1 = 
                                            {
                                            type: 'bar',
                                            x: ['T001','T002','T003','T004','T005'],
                                            y: [<?php include 'retrieve.php'; ?>],
                                            marker: {
                                                    color: '#C8A2C8',
                                                    line: { width: 1.5 }
                                                    }
                                            };                                 
                                            var data = [ trace1 ];
                                            var layout = {
                                                          //title: 'Responsive',
                                                          font: {size: 18}  
                                                        };
                                            Plotly.newPlot('myDiv', data, layout, {
                                                                                    displaylogo: false,
                                                                                    responsive: true,
                                                                                    displayModeBar: false
                                                                                });       
                                        });

</script>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 fluent的在模拟压强时使用希望得到一些建议
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用
    • ¥15 Web.config连不上数据库
    • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
    • ¥15 怎么配置广告联盟瀑布流
    • ¥15 Rstudio 保存代码闪退