-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Chartwrapper #95
Conversation
ee534f2
to
3dd8fff
Compare
Explicitly loaded the 'table' package in chartwrapper also as it was not loading the 'table' package properly using autoload (Useful link). |
f13536c
to
7680fd2
Compare
It will be confusing for user, isn't it? |
I have taken this as an analogy to HighCharts. We can use |
bba1e90
to
f997906
Compare
Added documentation Load packages explicitly in chartwrapper Use chart_class instead of class_chart (for user)
f997906
to
0ddb72a
Compare
@Shekharrajak can you please review this PR and let me know if there are any changes that I have to make? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check once , whether you have added specs for all the new methods and new lines.
|
||
# @see #GoogleVisualr::DataTable.query_response_function_name | ||
def query_response_function_name(element_id) | ||
"handleQueryResponse_#{element_id.tr('-', '_')}" | ||
end | ||
|
||
# @param data [Array, Daru::DataFrame, Daru::Vector, Daru::View::Table, String] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All same methods (for chart and table) should be put into one module and include it into the classes where you want.
def draw_js_chart_wrapper(data, element_id) | ||
js = '' | ||
js << "\n function #{chart_function_name(element_id)}() {" | ||
js << "\n #{to_js}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs \t
would be better instead of spaces.
@@ -35,14 +38,13 @@ def show_script(dom=SecureRandom.uuid, options={}) | |||
# Chart should be rendered in | |||
# @return [String] js code to render the chart with script tag | |||
def show_script_with_script_tag(dom=SecureRandom.uuid) | |||
# if it is data table and importing data from spreadsheet | |||
if is_a?(GoogleVisualr::DataTable) && data.is_a?(String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How your changes is handling this if condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have kept the same method name for both table and chart, and now have put that method in the common module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prakriti-nith , I don't think your replay is relevant . Now are you using the method to_js_full_script_spreadsheet
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,68 @@ | |||
require 'google_visualr' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already one module is added for display purpose , please check display module.
Isn't it display module contains similar methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the common methods to display module. Sorry, I got confused. Actually, display module contained methods that called the methods of base_chart.rb and data_table.rb (like to_js and others) and there was no method that was called back from these files to display.
Updated target ruby version to 2.2 in .rubocoop.yml file as travis was producing this error:
|
@Shekharrajak can you please review the changes? |
Please resolve the conflicts and test it manually once. |
Pull Request Test Coverage Report for Build 603
💛 - Coveralls |
@@ -12,7 +12,7 @@ module DatatablesAdapter | |||
# the datatables option concept. | |||
# | |||
# TODO : this docs must be improved | |||
def init_table(data=[], options={}) | |||
def init_table(data=[], options={}, _user_options={}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In _user_options
, _
is not required, right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless user_options is used in the method (in which it has been passed as a parameter), we need to prefix it with _
as rubocop was throwing Lint/UnusedMethodArgument
error.
As
chart_class
was already reserved in google_visualr, I used another optionclass_chart
which will be provided in the third parameter.class_chart
needs to be set asChartwrapper
do draw a Chartwrapper. Chartwrapper can be used to utilize additional optionview
. Examples are shown here. I am working on documenting the methods.