require 'daru/view' Daru::View.plotting_library = :googlecharts country_population = [ ['Germany', 200], ['United States', 300], ['Brazil', 400], ['Canada', 500], ['France', 600], ['RU', 700] ] df_cp = Daru::DataFrame.rows(country_population) df_cp.vectors = Daru::Index.new(['Country', 'Population']) geo_table = Daru::View::Table.new(df_cp, pageSize: 5, adapter: :googlecharts, height: 200, width: 200) geochart = Daru::View::Plot.new( geo_table.table, type: :geo, adapter: :googlecharts, height: 500, width: 800) geochart.show_in_iruby idx = Daru::Index.new ['City', 'Population', 'Area'] data_rows = [['Rome', 2761477, 1285.31], ['Milan', 1324110, 181.76], ['Naples', 959574, 117.27], ['Turin', 907563, 130.17], ['Palermo', 655875, 158.9], ['Genoa', 607906, 243.60], ['Bologna', 380181, 140.7], ['Florence', 371282, 102.41], ['Fiumicino', 67370, 213.44], ['Anzio', 52192, 43.43], ['Ciampino', 38262, 11] ] df_city_pop_area = Daru::DataFrame.rows(data_rows) df_city_pop_area.vectors = idx df_city_pop_area geo_marker_table = Daru::View::Table.new(df_city_pop_area, pageSize: 5, height: 200, width: 200) geo_marker_options = { region: 'IT', # FixMe : DisplayMode is not working # displayMode: 'markers', # displayMode: 'text', colorAxis: {colors: ['green', 'blue']}, type: :geo } geomarker_chart = Daru::View::Plot.new( geo_marker_table.table, geo_marker_options) geomarker_chart.show_in_iruby idx = Daru::Index.new ['Country', 'Latitude'] data_rows = [['Algeria', 36], ['Angola', -8], ['Benin', 6], ['Botswana', -24], ['Burkina Faso', 12], ['Burundi', -3], ['Cameroon', 3], ['Canary Islands', 28], ['Cape Verde', 15], ['Central African Republic', 4], ['Ceuta', 35], ['Chad', 12], ['Comoros', -12], ['Cote d\'Ivoire', 6], ['Democratic Republic of the Congo', -3], ['Djibouti', 12], ['Egypt', 26], ['Equatorial Guinea', 3], ['Eritrea', 15], ['Ethiopia', 9], ['Gabon', 0], ['Gambia', 13], ['Ghana', 5], ['Guinea', 10], ['Guinea-Bissau', 12], ['Kenya', -1], ['Lesotho', -29], ['Liberia', 6], ['Libya', 32], ['Madagascar', nil], ['Madeira', 33], ['Malawi', -14], ['Mali', 12], ['Mauritania', 18], ['Mauritius', -20], ['Mayotte', -13], ['Melilla', 35], ['Morocco', 32], ['Mozambique', -25], ['Namibia', -22], ['Niger', 14], ['Nigeria', 8], ['Republic of the Congo', -1], ['Réunion', -21], ['Rwanda', -2], ['Saint Helena', -16], ['São Tomé and Principe', 0], ['Senegal', 15], ['Seychelles', -5], ['Sierra Leone', 8], ['Somalia', 2], ['Sudan', 15], ['South Africa', -30], ['South Sudan', 5], ['Swaziland', -26], ['Tanzania', -6], ['Togo', 6], ['Tunisia', 34], ['Uganda', 1], ['Western Sahara', 25], ['Zambia', -15], ['Zimbabwe', -18] ] df_country_latitude = Daru::DataFrame.rows(data_rows) df_country_latitude.vectors = idx df_country_latitude geo_color_table = Daru::View::Table.new(df_country_latitude, pageSize: 5, height: 350, width: 350) geo_color_table.table geo_color_options = { region: '002', # Africa colorAxis: {colors: ['#00853f', 'black', '#e31b23']}, backgroundColor: '#81d4fa', datalessRegionColor: '#f8bbd0', defaultColor: '#f5f5f5', type: :geo } geocolor_chart = Daru::View::Plot.new( geo_color_table.table, geo_color_options) geocolor_chart.show_in_iruby