chart-csv
chart-csv copied to clipboard
Customization
Hey, this lib is awesome, thanks very much.
I have had to fork it so that I can customize how I use c3.js
, allowing me to set the data.x
value. Would you consider allowing some customization from the command-line? I'm very happy to help out with a PR, but I thought I should ask first to see if you're interested in this proposal and also to ask how you might go about it, given that currently this lib is just printing the csv to a string variable, a process which doesn't allow customization of the webpage's JS.
Thanks for reaching out and sorry for the slow reply 😃
I guess one option would be to have different templates in the templates directory depending on which chart library you wanted to use and then chose the right one depending on the command line arguments. Off the top of my head that would be the most simple approach.
How did you imagine the command line arguments would look?
No worries!
That sounds like a good solution, although it would mean a lot of code repetition if all you were changing were the options passed to c3.generate()
.
Another solution off the top of my head would be to add a couple of simple string writestreams to the array here: https://github.com/watson/chart-csv/blob/master/index.js#L9, allowing you to pass the options from within that file (thereby making it customisable in node-land) rather than having it hardcoded in the html file.
This solution is a little messier but would mean less duplication. What do you think?