I would like to show a "cumulative total" of nodes by date. For example, it should look like this:
date number total 1/1 1 1 1/2 3 4 1/3 2 6 1/4 4 10
I've tried views_php without luck:
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Your solution is correct. However, there's a bug in PHP code fields. You must access the $data variable because $row is (surprisingly) empty.
This issue will help you.
Have you tried the Views Calc module? I think you will get what you want from it. Here is an excerpt about it from the module's project page:
... adds simple calculations to a views table. Requires the Views module.
You can SUM, AVERAGE, COUNT, MIN, MAX, or AVG selected columns. A plug in theme makes the view look more spreadsheet-like (right justifies numeric fields, shades calculated columns and rows, and underlines calculated rows).
I built a module for this specific issue, as even the maintainers of Views PHP say it shouldn't be used. My module is Views Cumulative Field, and there are versions for D7 and D8.
Some more details about it (from its project page):
This module creates a Views field handler that enables you to calculate the cumulative value of another field in your view. This is great for Views displays created by the Charts module, but can be used for any View that allows fields.
It was inspired by this comment on the Views PHP module page:
While this module allows you to directly use PHP inside views which may be useful for quick and easy solutions, it is highly advisable to use regular handlers and plugins when available (or even to create one yourself).