These two weeks in my journey were really thrilling and adventurous. The wizarding world is full of Hurdles but with the power magical ruby, I tried to conquer them all. In the never-ending world of magic, these are my contributions for the week 3 and 4.
Exporting of HighCharts in different formats:
Through this feature, user can export the HighChart in various formats (PDF, PNG, JPEG, and SVG) using the code. Just as the export button is used to export the chart, this method can be used plus it provides the option for the file name.
To track the progress of the feature, follow this PR. To use this feature:
- Add the line `plot .export(export_type, file_name)` after generating the Daru::View::Plot object.
- That’s it. Sit back and enjoy 🙂
Using only these four lines:
We can download all the four HighStocks simultaneously.
In web frameworks, offline-exporting has been provided while in IRuby notebook online exporting has been provided as there was some error in offline-exporting the HighChart to PDF in IRuby notebook.
The second feature is coming straight from Prof. McGonagall’s class. ChartWrapper, it was introduced to ease the js developers as it required less code and is much more convenient to use. So, how this will benefit daru-view?
- Firstly, we can now use another option `view` which provides the facility to visualize only some of the columns. For example,
I created this table and generated the GoogleChart for it:
Now, can I visualize combined charts individually? Anything is possible in the world of magic my dear 😉
What if I want to get the chart for Sales v/s Expenses? Swirl the wand. 😀
- Secondly, further ChartWrapper paves the way for ChartEditor to implement as ChartEditor only works on ChartWrapper.
To generate charts using ChartWrapper, user needs to set the
class_chart option as ‘Chartwrapper’ in the third parameter (we will be implementing all the user options provided by us in the third parameter, will update the HighCharts also). This feature has been implemented in this PR. Also check out some more examples of ChartWrapper here.
Beautiful isn’t it. Prof. McGonagall is great.
Importing data from Google Spreadsheet in GoogleCharts:
This piece of magic has been bugging me for a long time. The spell was first created by me before the GSoC, things didn’t work out completely then. There was a bug that only last chart was coming as the output out of all. It has been resolved now by creating a separate query response for each chart. Track this feature in the PR here. Do visit this to check out some more examples.
Through this feature, user can create a GoogleChart by providing the link of the spreadsheet and can perform various queries on it. Examples are shown below:
I have added the rspec tests of all these features. Apart from these, I added the examples of Highcharts using `modules` option and have updated all the examples of HighCharts, HighStock and HighMaps in Daru::View::Plot.new(data, opts) format in this commit.
Difficulties and challenges are a part of life, facing them are how you get strong.
The above quote was just for self-consolidations. 😛 I am facing a problem in implementing the proxy design pattern to load the js files in HighCharts.