Uptime of state either 0 or 1 into Piechart

I am currently trying to display a pie chart of of the time that the value is in a state of either 1(running) or 0(idle).

I have a timeline working:

I have tried to follow this post: Duration of switch ON time in hour_minutes_seconds - #11 by oliverde8

I am just missing something I think. I would like to display a pie of percent running vs. idle but just haven’t been able to achieve this yet. BTW I am using Influx 1.x and Grafana the latest open source version.

Thanks