简体   繁体   English

如何从Canvas数据网格创建数据透视表?

[英]how to create pivot table from Canvas Data Grid?

I need help - how to create a pivot table in Canvas-Datagrid. 我需要帮助-如何在Canvas-Datagrid中创建数据透视表。 Kindly Help me. 请帮助我。 This is what we're trying to do. 这就是我们想要做的。 the actual data is below: 实际数据如下:

https://github.com/TonyGermaneri/canvas-datagrid https://github.com/TonyGermaneri/canvas-datagrid

在此处输入图片说明

we're trying to get the data grid to display something like this in a new grid preferably: 我们正在尝试使数据网格最好在新网格中显示如下内容:

在此处输入图片说明

data in the grid is a array of objects or an array of arrays, manipulating the data is done the same way you would any standard JS data. 网格中的数据是对象数组或数组数组,操作数据的方式与处理任何标准JS数据的方式相同。

This looks like an elegant solution to the problem: https://medium.com/front-end-hacking/matrix-rotation-%EF%B8%8F-6550397f16ab 这看起来像是解决问题的优雅方法: https : //medium.com/front-end-hacking/matrix-rotation-%EF%B8%8F-6550397f16ab

So what you'd do is: 因此,您要做的是:

grid.data = flipMatrix(grid.data); and maybe grid.draw(); 也许是grid.draw();

If the grid is not disposing of the previous schema (the column names are not changing) you can tell it to always load a new schema when the setting data by setting the autoGenerateSchema property to true. 如果网格未处理先前的架构(列名未更改),则可以通过将autoGenerateSchema属性设置为true来告诉它在设置数据时始终加载新的架构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM