“The purpose of magic is to create beautiful effects.”-not, one who can’t be named.
In the second week of Hogwarts school of magic and ruby for science, I devoted my time to work on Custom styling CSS in HighCharts and loading of modules and map data (in HighMaps).
Custom Styling CSS in HighCharts
There are two styles of this Highchart magic, namely, Classic and Styled. Classic mode is easy and can be done with a single swirl of your magic wand. It provides some custom CSS styling and does not require any additional dependencies. While a magician using styled mode must have good magical skills. It uses js dependency replacing the older one + the CSS dependency and provides full custom CSS styling.
I have implemented the Styled mode for web frameworks but as there is no method to load CSS files in IRuby notebook, (there are still a lot of magic that need to be invented), so I have kept classic mode for IRuby notebook where some styling can be provided. To catch up on the progress of this feature, follow this PR. I have also added some examples of custom styling in Daru-view, check them out and have added rails example in this PR.
To access this feature, a magician needs to provide the required CSS styling in the
CSS option to modify the chart. Following are some of the screenshots of the after effects of the magic to demonstrate this feature:
That was just for entertainment purpose :P. The real thing is below
The second spell during this week that I tried to pull out of my wand was to Load modules and Map data.
Load modules and Map data
There are lot of dependencies of HighCharts, HighStock, HighMaps and their modules (sort of Harry, Hermione, Ron of HighCharts :P). It’s not possible to load all at once when the plotting_library is set to highcharts or when dependent_script is added in web frameworks. So, now daru-view is loading the basic dependencies to draw the plots when plotting_library is set as highcharts. The extra modules required to load a chart can be provided in the `modules` option by the user which will be loaded when `show_in_iruby` is called in IRuby notebook and when `div` is called in web frameworks. Map data will be loaded using `option[:chart][:map]` option already provided by the user to draw the map. I have added the changes in this commit.
Apart from these I have added the rails app in this PR to demonstate various HighCharts, HighStock and HighMaps. I have included the unit tests for the code. I have also added more examples of HighMaps where data is in the form of Daru::DataFrame.