This version is old school.
Please find jQuery plugins on npm.
jquery.pivot
by Janus Schmidt
The jquery.pivot plugin can be used for presenting table data in pivot form. Data can be read from a html table or json. Use v2.x for jquery 1.7.0 and above. Use v1.x for jquery below 1.7.0