Create a plugin architecture (Formerly: Consideration for future: source splitting and plugin architecture)
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.4k
- Avg merge
- 6d 16h
- Merged PRs (30d)
- 1
Description
Hi,
This library is getting larger and larger, currently there are about 5000 lines of source in a single file, which is overwhelming even for experienced developers. I thinks it's time to start splitting the code into smaller logical units. I like how D3 is organized, they are concatenating all the small pieces to form a single js file as a result. It's not very difficult to implement, I can volunteer to do the it with C3 in a separate branch. Let me know.
Another aspect is that the library reached extent, so that core functionality should be identified, moving other functions into separate files as plugin modules. In this case end user could include only whats needed, or load modules on demand. Other libraries modularize even by chart type (if bar chart is all what you need, why waste bandwidth for other types), but I guess it would be hard to do the same with C3. However in my opinion these items can be good candidates for moving out:
1. Tooltip rendered. Someone could be able to replace the default one if needed and contribute results. Then library eventually will have multiple tooltips of different styles
2. Legend renderer. The core should provide legend renderer array of item information (color, datum, description, etc) and request a bounding box coords so that chart could be rescaled to fit everything. I would need this function very much in my project, as I'm not very happy how the default one works. The guy in #348 could also implement his own legend renderer the way required, without adding crazy features into the core.
3. Renderers for chart items. These are not existent now, but someone may wish to create fancy bars with shadows/gloss/gradients etc
To conclude all the said above would be a huge refactoring work. However if there are more people here who may want to get involved for making this library even better, then we may start planning things :)
Contributor guide
Assessment
This issue has not been assessed yet.