Skip to main content

Region

Region class. Contains a reference to an SVG element.

Hierarchy

Index

Constructors

constructor

Properties

bubble

bubble: HTMLElement

optionalcenter

center?: SVGPoint

choroplethValue

choroplethValue: number

customAttrs

customAttrs: string[]

optionaldata

data?: Model

optionaldetails

disabled

disabled: boolean

elem

elem: SVGGraphicsElement

elemOriginal

elemOriginal: SVGGraphicsElement

element

element: HTMLElement | SVGElement

events

events: Events

optionalfill

fill?: string

gaugeValue

gaugeValue: number

hovered

hovered: boolean

id

id: string

id_no_spaces

id_no_spaces: string

initialState

initialState: string

label

label: HTMLElement

mapsvg

mapsvg: MapSVGMap

name

name: string

objects

options

options: Partial<RegionOptions>

optionalpopover

selected

selected: boolean

status

status: string | number

statusOptions

style

style: Partial<CSSStyleDeclaration>

styleByState

styleByState: RegionStylesByStatus

styleSvg

styleSvg: Partial<CSSStyleDeclaration>

optionaltitle

title?: string

optionaltooltip

tooltip?: Tooltip

type

Methods

adjustBubbleScreenPosition

  • adjustBubbleScreenPosition(): void
  • Adjust position of Region bubble


    Returns void

adjustLabelScreenPosition

  • adjustLabelScreenPosition(): void
  • Adjust position of Region Label


    Returns void

adjustStroke

  • adjustStroke(scale: number): void
  • Parameters

    • scale: number

    Returns void

attr

  • attr(v1: any, v2?: any): string
  • Sets attribute of an SVG object


    Parameters

    • v1: any

      attribute name or object: {name: value, name: value}

    • v2: any = null

      value

    Returns string

deselect

  • deselect(): void
  • Deselect the Region.


    Returns void

drawBubble

  • drawBubble(): void
  • Draw a choropleth bubble for the region


    Returns void

forTemplate

  • forTemplate(): any
  • Returns an object with properties of the Region formatted for a template


    Returns any

getBBox

  • Returns SVG bounding box of the Region


    Returns ViewBox

    • [x,y,width,height]

getBubbleSize

  • getBubbleSize(): any
  • Returns size of the choropleth bubble


    Returns any

getCenter

  • Returns center of an object in pixel coordinates


    Returns ScreenPoint

    • [x,y]

getCenterLatLng

  • Returns center of an object in geo-coordinates


    Parameters

    • yShift: any

    Returns GeoPoint

getCenterSVG

  • Returns center of an object in SVG coordinates


    Returns SVGPoint

getChoroplethColor

  • getChoroplethColor(): string
  • Returns color of the Region for choropleth map


    Returns string

    color

getComputedStyle

  • getComputedStyle(prop: string, elem?: HTMLElement | SVGElement): string
  • Returns style of a given property of an SVG object


    Parameters

    • prop: string

      property name

    • optionalelem: HTMLElement | SVGElement

      SVG object

    Returns string

    • style

getData

  • getData(): any
  • Returns any

getDisabledState

  • getDisabledState(asDefault?: boolean): boolean
  • Checks if Region should be disabled


    Parameters

    • optionalasDefault: boolean

    Returns boolean

getGeoBounds

  • Returns geo-bounds of an object - South-West & North-East points.


    Returns { ne: GeoPoint; sw: GeoPoint }

getModel

getOptions

  • getOptions(forTemplate?: boolean): {}
  • Returns Region properties


    Parameters

    • optionalforTemplate: boolean

      adds special properties for use in a template

    Returns {}

    • [key string]: any

getStyle

  • getStyle(prop: string): string
  • Returns style of a property of the SVG object


    Parameters

    • prop: string

      property name

    Returns string

highlight

  • highlight(): void
  • Highlight the Region. Used on mouseover.


    Returns void

isCluster

isMarker

  • Returns this is Marker

isRegion

  • Returns this is Region

moveBubbleScreenPositionBy

  • moveBubbleScreenPositionBy(deltaX: any, deltaY: any): void
  • Set position of Region bubble by given numbers


    Parameters

    • deltaX: any
    • deltaY: any

    Returns void

moveLabelScreenPositionBy

  • moveLabelScreenPositionBy(deltaX: any, deltaY: any): void
  • Set position of Region Label by given numbers


    Parameters

    • deltaX: any
    • deltaY: any

    Returns void

select

  • select(): void
  • Select the Region.


    Returns void

setBubbleScreenPosition

  • setBubbleScreenPosition(x: any, y: any): void
  • Set position of Region bubble by given numbers


    Parameters

    • x: any
    • y: any

    Returns void

setData

  • setData(data: Model): void
  • Adds custom data loaded from server


    Parameters

    • data: Model

      Any set of {key:value} pairs

    Returns void

setDisabled

  • setDisabled(on?: boolean, skipSetFill?: boolean): void
  • Disables the Region.


    Parameters

    • optionalon: boolean

      true/false = disable/enable

    • optionalskipSetFill: boolean

      If false, color of the Region will not be changed

    Returns void

setFill

  • setFill(fill: string): void
  • Sets the fill color for the Region


    Parameters

    • fill: string

      The fill color to set

    Returns void

setId

  • setId(id: string): void
  • Set ID of an object


    Parameters

    • id: string

    Returns void

setLabelScreenPosition

  • setLabelScreenPosition(x: any, y: any): void
  • Set position of Region Labels by given numbers


    Parameters

    • x: any
    • y: any

    Returns void

setSelected

  • setSelected(selected: boolean): void
  • Selects the Region.


    Parameters

    • selected: boolean

    Returns void

setStatus

  • setStatus(status: string | number): boolean
  • Sets status of the Region. Takes the list of statuses from global MapSVG options.


    Parameters

    • status: string | number

    Returns boolean

setStylesByState

setTitle

  • setTitle(title?: string): void
  • Sets Title of the Region


    Parameters

    • optionaltitle: string

    Returns void

setchoroplethValue

  • setchoroplethValue(val: number): void
  • Set Region choropleth value. Used to calculate color of the Region.


    Parameters

    • val: number

    Returns void

unhighlight

  • unhighlight(): void
  • Unhighlight the Region. Used on mouseout.


    Returns void

update

  • update(options: any): void
  • Updates the Region

    @example
    var region = mapsvg.getRegion("US-TX");
    region.update({
    fill: "#FF3322"
    });

    Parameters

    • options: any

    Returns void

staticgetComputedStyle

  • getComputedStyle(prop: string, elem?: HTMLElement | SVGElement): string
  • Parameters

    • prop: string
    • optionalelem: HTMLElement | SVGElement

    Returns string