Class: SmartChart::Map

Inherits:
SingleDataSetChart show all
Defined in:
lib/smart_chart/charts/map.rb

Instance Attribute Summary collapse

Attributes inherited from SingleDataSetChart

#colors

Attributes inherited from BaseChart

#background, #data, #height, #legend, #margins, #orientation, #style, #width

Class Method Summary collapse

Methods inherited from BaseChart

#initialize, #to_html, #to_query_string, #to_url, #valid?, #validate!

Constructor Details

This class inherits a constructor from SmartChart::BaseChart

Instance Attribute Details

#foregroundObject

color of countries or states with no data (default white)



56
57
58
# File 'lib/smart_chart/charts/map.rb', line 56

def foreground
  @foreground
end

#regionObject

region to be depicted (default “world”, see Map.regions for choices)



53
54
55
# File 'lib/smart_chart/charts/map.rb', line 53

def region
  @region
end

Class Method Details

.country_codesObject

Array of valid ISO 3166-1-alpha-2 country codes. Source: code.google.com/apis/chart/isocodes.html



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/smart_chart/charts/map.rb', line 8

def self.country_codes
  %w[
    AF AX AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE
    BZ BJ BM BT BO BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL
    CN CX CC CO KM CG CD CK CR CI HR CU CY CZ DK DJ DM DO EC EG SV GQ
    ER EE ET FK FO FJ FI FR GF PF TF GA GM GE DE GH GI GR GL GD GP GU
    GT GG GN GW GY HT HM VA HN HK HU IS IN ID IR IQ IE IM IL IT JM JP
    JE JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW
    MY MV ML MT MH MQ MR MU YT MX FM MD MC MN ME MS MA MZ MM NA NR NP 
    NL AN NC NZ NI NE NG NU NF MP NO OM PK PW PS PA PG PY PE PH PN PL
    PT PR QA RE RO RU RW BL SH KN LC MF PM VC WS SM ST SA SN RS SC SL
    SG SK SI SB SO ZA GS ES LK SD SR SJ SZ SE CH SY TW TJ TZ TH TL TG
    TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VE VN VG VI WF
    EH YE ZM ZW
  ]
end

.regionsObject

Array of valid map regions.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/smart_chart/charts/map.rb', line 40

def self.regions
  %w[
    africa
    asia
    europe
    middle_east
    south_america
    usa
    world
  ]
end

.us_state_codesObject

Array of valid US state codes. Source: code.google.com/apis/chart/statecodes.html



29
30
31
32
33
34
35
# File 'lib/smart_chart/charts/map.rb', line 29

def self.us_state_codes
  %w[
    AK AL AR AZ CA CO CT DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI
    MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT
    VA VT WA WI WV WY
  ]
end