Skip to main content

Posts

Showing posts with the label DataTable

Transpose of a Google Visualization data table object

Since i spend a lot of time at my day job working with the Google Visualization  tools for the charting needs of my work, i figured it is inevitable that i will be requested to draw a chart with transposed data. ok...let us backtrack a little. So to draw a chart using the Google Visualization tools, the first step is to prepare a DataTable , which is a data structure provided by Google. The DataTable as the name suggests is simple table of rows and columns, hence it can be thought of a 2D matrix . Obviously now once you start to perceive your data as a matrix, what you can do with a matrix is only limited by the type of data stored in it. In this case the matrix operation of interest to me, was the transpose . Transpose is one of the simpler concepts of linear algebra, where by in a given matrix , rows become columns and columns become rows. Ok so now onto business? FYI, this is a quick and dirty solution and is in no way optimal. Since my need was to transpose a table that h...