Skip to content
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

Add material charts. #95

Merged
merged 8 commits into from
Aug 27, 2015
Merged

Add material charts. #95

merged 8 commits into from
Aug 27, 2015

Conversation

winston
Copy link
Owner

@winston winston commented Aug 26, 2015

Add material charts for the following:

  • bar
  • column
  • line
  • scatter

Fixes #87, #85. Supercedes #88.

To use material charts, just pass in the material: true as an option when creating a chart.

Example:

data_table = GoogleVisualr::DataTable.new
    data_table.new_column('string', 'Year')
    data_table.new_column('number', 'Sales')
    data_table.new_column('number', 'Expenses')
    data_table.add_rows(4)
    data_table.set_cell(0, 0, '2004')
    data_table.set_cell(0, 1, 1000)
    data_table.set_cell(0, 2, 400)
    data_table.set_cell(1, 0, '2005')
    data_table.set_cell(1, 1, 1170)
    data_table.set_cell(1, 2, 460)
    data_table.set_cell(2, 0, '2006')
    data_table.set_cell(2, 1, 660)
    data_table.set_cell(2, 2, 1120)
    data_table.set_cell(3, 0, '2007')
    data_table.set_cell(3, 1, 1030)
    data_table.set_cell(3, 2, 540)

    opts   = { 
      :width => 400, :height => 240, 
      :title => 'Company Performance', 
      vAxis: {title: 'Year', titleTextStyle: {color: 'red'}},
      :material => true
    }
    @chart = GoogleVisualr::Interactive::BarChart.new(data_table, opts)

You can also set material to true after creation of the chart like so:

    opts   = { 
      :width => 400, :height => 240, 
      :title => 'Company Performance', 
      vAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
    }
    @chart = GoogleVisualr::Interactive::BarChart.new(data_table, opts)
    @chart.material = true

- refactor classes in GoogleVisualr::Packages
@@ -41,3 +41,13 @@ def base_chart_with_listener_js(div_class="div_class")
js << "\n };"
js << "\n</script>"
end

def material_chart(div_class="div_class")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing in default value assignment.

- annotation chart
- calendar
- gantt
- sankey
- word tree
Adds locale option as described in..
winston added a commit that referenced this pull request Aug 27, 2015
@winston winston merged commit ca0574d into master Aug 27, 2015
@winston winston deleted the feature/add-material-charts branch August 27, 2015 15:35
bendycode added a commit to bendyworks/payroll that referenced this pull request Oct 3, 2015
bendycode added a commit to bendyworks/payroll that referenced this pull request Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants