syntagmatic / parallel-coordinates

A d3-based parallel coordinates plot in canvas. This library is no longer actively developed.
http://syntagmatic.github.com/parallel-coordinates/
Other
510 stars 211 forks source link

Special characters i tsv header? #268

Closed TorbenOestergaard closed 8 years ago

TorbenOestergaard commented 8 years ago

This is probably a trivial question. Is it possible to include special characters in the header of the tsv (or csv) file? For example, it is sometimes useful to include units such as "°" and "m²"

PS: Still love this plot. Thanks for all your efforts..

syntagmatic commented 8 years ago

That should work just fine! Go ahead and reopen if it doesn't work.

TorbenOestergaard commented 8 years ago

Hmm.. Doesn't work for me? I use version 0.7 and the special characters get replaced by a black rectangle/diamond with a white question mark inside. Do I need to change the font type somehow? (The default looks like Arial) udklip

syntagmatic commented 8 years ago

Try adding this tag near the top of the HTML file, if it's not there already:

<meta charset="utf-8">
TorbenOestergaard commented 8 years ago

I added the charset="utf" tag but apparently it didn't help. I have tried two of your examples: table.html (with tsv file and divgrid table) and slickgrid.html (with csv file). Tried both Chrome and Firefox (and emptied the cache and reloaded it). Any suggestions? Much appreciated..

jfourment commented 8 years ago

Hi, Same problem here, we want to include some special chars for currencies (like cent symbol) and it doesn't work whatever charset is defined. I also tried to include html entities in dimension labels but they are not decoded. either.

syntagmatic commented 8 years ago
screen shot 2016-02-02 at 3 37 36 pm

Hmm, I can't seem to reproduce the issue on either the table.html example or slickgrid csv upload. It works in both Chrome and Firefox.

Are you both on Windows? I wonder if it's an OS-related issue somehow.

Edit: Tested using OS X

jfourment commented 8 years ago

Could be OS-related. I'm testing this on Chrome and Firefox on Ubuntu.

TorbenOestergaard commented 8 years ago

I'm on windows..

syntagmatic commented 8 years ago

This is the default style for the axis label font:

https://github.com/syntagmatic/parallel-coordinates/blob/master/d3.parcoords.css#L2

font: 14px sans-serif;

Can you try playing with other fonts to see if it works?

BroHammie commented 8 years ago

I was able to reproduce and got the upload example working by setting the FileReader encoding(http://stackoverflow.com/questions/12448595/get-set-file-encoding-with-javascripts-filereader) like:
reader.readAsText(file, 'ISO-8859-1');

TorbenOestergaard commented 8 years ago

@syntagmatic : Tried to change the font-family as you suggest. It changed the fonts accordingly, though still without the special characters.

@mcwillso : Great. Also works on my computer when running the "upload.html" example. This example uses a FileReader to read a csv file. Do you know a similar fix for the d3.tsv loader used in "table.html" among others?

syntagmatic commented 8 years ago

So this is caused by ISO-8859-1 encoded data files?

Papaparse uses the FileReader API internally and could accept the same encoding config:

http://papaparse.com/docs#config

TorbenOestergaard commented 8 years ago

Haven't thought of looking at the encoding of the csv/tsv files. Apparently, my files were decoded as "UTF-8 without BOM". Changed the encoding to "UTF-8" in Notepad++ and now everything seems to work :-) Thanks a lot for all your feedback!