Sha256: 5ba25d38f3619f313873c77fcd556d7ddf0c13c152b7152535da244026ddfecb

Contents?: true

Size: 907 Bytes

Versions: 2

Compression:

Stored size: 907 Bytes

Contents

<% content_for :javascripts do %>
  <script type="text/javascript">
    google.setOnLoadCallback(drawBalanceChart);
    function drawBalanceChart() {
        var data = google.visualization.arrayToDataTable([
          ['<%=t ".date" %>', null],
          <% balance = @account.initial_balance %>
          ['<%= @account.start_date.strftime("%d/%m/%Y") %>', <%= balance %> ],
          <% @movements.ordered.each do |movement| %>
            <% movement.incoming? ? (balance += movement.amount) : (balance -= movement.amount) %>
            ['<%= movement.date.strftime("%d/%m/%Y") %>', <%= balance %> ],
          <% end %>
        ]);

        var options = {
          title: '<%=t ".title" %>',
          colors: ['#F89406']
        };

        var chart = new google.visualization.LineChart(document.getElementById('balance_chart'));
        chart.draw(data, options);
      }

  </script>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bookkeeper-0.0.7 app/views/bookkeeper/balance/_balance_chart.html.erb
bookkeeper-0.0.6 app/views/bookkeeper/balance/_balance_chart.html.erb