Other questions, like “what is the distribution of colors in your data set?”, requires shifting or pivoting the data, as you want to evaluate a specific column instead of rows. Charting will often need this data pivot and doing it optimally is crucial if you are working with a large amount of data on the client side.
Consider drawing a simple pie chart that shows color distribution of the data set in the picture above. This will require looping or processing every row as you need to capture all colors from the color column. After that, you need to figure out the frequency of colors to divide the pie chart accordingly. None of this is very hard to do but if you also want to draw the distribution of car makes, years, or values in any other column, it would hurt performance if you had to loop through all rows every time. Instead, use FastPivot to pivot or shift the data and analyze columns instead of rows.
FastPivot.js performs only 1 loop over all the rows and returns an array with unique values in each column (under _labels), an array of frequency for those values (under _labelsdata), and a _data object where any given value could be quickly retrieved.
Check it out on GitHub as well as this example of drawing a chart with FastPivot and ChartJS