HumbleSoftware / Flotr2

Graphs and Charts for Canvas in JavaScript.
http://www.humblesoftware.com/flotr2/
MIT License
2.45k stars 528 forks source link

Create AMD build by default #249

Closed jochenberger closed 10 years ago

jochenberger commented 10 years ago

Make the AMD/UMD build the default build. This way, Flotr (and especially the nolibs build) can be used via requireJS or as "traditional" libraries. Also, I removed the obsolete build.json file.

jochenberger commented 10 years ago

Never mind, I'm about to create a branch that uses AMD/CommonJS modules for all JS files at https://github.com/jochenberger/Flotr2/tree/create-amd-modules I'm currently struggling with a circular dependency between Flotr.js and DefaultOptions.js via Flotr.defaultTickFormatter and Flotr.defaultTrackFormatter. I'll probably have to spin out a separate module for those.

jochenberger commented 10 years ago

@cesutherland Is there any special reason why the default tick and track formatters are defined in Flotr.js instead of in DefaultOptions.js?

cesutherland commented 10 years ago

I don't think so – probably that's where it was originally, and not moved.

jochenberger commented 10 years ago

Alright, thanks. However, moving it won't actually help. There will still be the problem that DefaultOptions.js depends on Flotr.js (because in non-module mode it wants to assign itself toFlotr.defaultOptions) and Flotr.js depends on DefaultOptions.js because addType, addPlugin, and drawText want to use it. The only way I can think of to fix that would be to merge the two files, but that would make that the default options harder to override because it would have to happen after loading Flotr.js but before loading the plugins/types. Another option would be not depending on DefaultOptions.js from Flotr.js, but that would mean that in module mode, you would have to require and probably assign it to Flotr.defaultOptions manually. I guess, I'll have to think about that for a little while longer...