Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 439ee771

Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt

  • ID 439ee771c2f04d9b6760e956822899e40f10d092
  • Vorgänger d5145a56
  • Nachfolger fe447b83

Umsatzstatistik: Chart direkt laden

Unterschiede anzeigen:

js/kivi.CustomerVendorTurnover.js
43 43
  };
44 44

  
45 45
  ns.show_turnover_chart = function(period, year_for_month) {
46
    const html = '<div class="chart-container" style="position: relative;">'
47
               + '<canvas id="chart"></canvas>'
48
               + '</div>';
49
    $('#turnovers').html(html);
50

  
51 46
    let mode = "month";
52 47
    if (period === 'y') {
53 48
      mode    = "year";
......
63 58
                   year: year_for_month
64 59
                 };
65 60
    $.getJSON('controller.pl', data, function( returned_data ) {
61
      const html = '<canvas id="turnovers_chart"></canvas>';
62
      $('#turnovers_chart_container').html(html);
66 63
      ns.draw_chart(returned_data);
67
      $("html, body").animate({ scrollTop: $("#chart").offset().top }, "slow");
64
      $("html, body").animate({ scrollTop: $("#turnovers_chart").offset().top }, "slow");
68 65
    });
69 66
  };
70 67

  
......
89 86
  };
90 87

  
91 88
  ns.chart = function(data) {
92
    const ctx = 'chart';
89
    const ctx = 'turnovers_chart';
93 90
    const chart = new Chart(ctx, {
94 91
      type: 'bar',
95 92
      data: {
......
185 182
      if (ui.newPanel.attr('id') == 'quotations') {
186 183
        ns.get_sales_quotations();
187 184
      }
185
      if (ui.newPanel.attr('id') == 'turnover_stat') {
186
        ns.show_turnover_chart("y");
187
      }
188 188
      return 1;
189 189
    });
190 190

  
......
192 192
      if (ui.panel.attr('id') == 'quotations') {
193 193
        ns.get_sales_quotations();
194 194
      }
195
      if (ui.panel.attr('id') == 'turnover_stat') {
196
        ns.show_turnover_chart("y");
197
      }
195 198
      return 1;
196 199
    });
197 200
  };

Auch abrufbar als: Unified diff