首页 > 解决方案 > 我的刷新适用于图形但不适用于桌面

问题描述

我有一张带桌子的图形

在此处输入图像描述

我的问题是图形刷新而不是表格,我必须按 F5 并刷新表格。

我希望表格与图表同时更新。

<div class="row">
 <div class="col-12 col-md-6">
   <div id="chartdivpricing" style="width: 100%;height: 400px; position: relative; top: -23px;"> 
   </div>
 </div>
 <div class="col-12 col-md-6">
  <div class="table-responsive">
    <table class="table table-striped" *ngIf="lastprice.length > 0">
       <tr style="background-color: #f8f9fa;">
         <td style="width: 30%;">
           <span>Time transaction</span>
         </td>
        <td style="width: 30%;" class="text-right">
           <span>Trading quantity</span>
        </td>
        <td style="width: 40%;">
           <span>Price</span>
        </td>
        </tr>
        <tr *ngFor="let lp of lastprice">
        <td style="border: 0px;">
          <span>
         {{lp.TIME | getXFirstElements:'8' }}
          </span>
        </td>
       <td style="border: 0px;" class="text-right">
        <span>
         {{lp.VOLUMEJOUR | myformatnum }}
        </span>
       </td>
          <td style="border: 0px;">
        <span>
      {{lp.COURS | number:'1.6-6' | myformatnum }}
      </span>
     </td>
    </tr>
  </table>
 </div>
 </div>
</div>

图形在这里

<div id="chartdivpricing" style="width: 100%;height: 400px; position: relative; top: -23px;"></div>

我不知道我应该如何修复表格中的刷新,就像图表一样?

prepareDataForHistory(res) {
        if (res.RETURNCODE == 'OKK00') {
            this.amChartsHistoryData = []
            for (var j = 0; j < res.HISTO.POINT.length; j++) {
                if (this.amChartsHistoryDataIntraday) {
                    this.amChartsHistoryData.push({
                        "date": new Date(res.HISTO.POINT[j].DATE + " " + res.HISTO.POINT[j].TIME),
                        "price": res.HISTO.POINT[j].PRICE
                    });
                } else {
                    this.amChartsHistoryData.push({
                        "date": new Date(res.HISTO.POINT[j].DATE.substr(0, 4), res.HISTO.POINT[j].DATE.substr(4, 2), res.HISTO.POINT[j].DATE.substr(6, 2)),
                        "price": res.HISTO.POINT[j].PRICE
                    });
                }
            }
            this.designPricingAmcharts("chartdivpricing", "", this.amChartsHistoryData);
        }
    }

如果不是这个,我可以提供其他代码。

预先感谢您的帮助。

标签: javascriptangulartypescript

解决方案


您的表格取决于“lastprice”。所以除非'lastprice'改变,否则它不会改变。


推荐阅读