chart
chart copied to clipboard
"TypeError: undefined is not an object" on csv and table import
I'm getting a TypeError: undefined is not an object (evaluating 'Object.keys(a[0])')
after pasting my 3 column table from Numbers in the following function:
function transpose(a) {
return Object.keys(a[0]).map(function(c) {
return a.map(function(r) { return r[c]; });
});
}
I am also unable to load the .csv file directly, the plugin hands at the pink spinner then. Any suggestions what might be wrong? The csv is generated via https://www.npmjs.com/package/csv-writer
Sketch version: 62 chart version: 5.4.4
Hi @joernroeder! Could you give me an example of table that you are trying to use and type of Chart?
@pavelkuligin the chart type didnt matter. I was unable to a) upload (infinite loading) and b) paste the attached csv.
test.txt (I had to rename to .txt
to upload it here)
@joernroeder I've found a few issues, will fix them tomorrow and ship new release
@joernroeder please update to Chart 5.4.5 and use this CSV: https://yadi.sk/d/xpaCKxTDkPECJw (your example had empty row at the end so it was an issue)
Ping me if you have any questions/problems
@pavelkuligin thanks for looking into this. Empty lines at a file are pretty common, especially if you work with code and editors https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
I've testet 5.4.5 today and still noticed that I have to convert integers e.g. 8
to floats 8.0
to work properly when importing the csv directly. as soon as my source file had Integers in the data generation got stuck at the loading spinner.
@joernroeder yep, I'm working on removing empty rows from CSV files.
Issue with integers is pretty strange, I will test it today and get back with clarifications
@joernroeder I did some test and it works well: https://www.loom.com/share/244035d1e33146e0a8ee75f17a20e991
Maybe you see the spin for a long time because Sketch's performance is low with large amount of data