Skip to content

Latest commit

 

History

History
127 lines (115 loc) · 26.5 KB

MapBarChart.md

File metadata and controls

127 lines (115 loc) · 26.5 KB

MapBarChart Component

MapBarChart

mark Object in Graph Props

'mark': {
  'mapScale': 20,
  'mapOrigin': [5, 5],
  'rotation': '-90 0 0',
  'map': {
    'data': mapData,
    'projection': 'Mercator',
    'shapeIdentifier': 'id',
    'shapeKey': 'countries',
    'style': {
      'extrusion':  0.0000001,
      'fill': {
        'color': 'red',
        'opacity': 1,
      },
      'stroke': {
        'width': 1,
        'color': 'black',
      },
    },
  },
  'bars': {
    'type': 'box',
    'style': {
      'depth': 0.2,
      'width': 0.2,
      'height': {
        'scaleType': 'linear',
        'field': 'value',
        'value': [0, 5],
      },
      'fill': {
        'scaleType': 'linear',
        'opacity': 0.9,
        'field': 'value',
        'color': ['green', 'blue'],
      },
    }
  },
}

Properties for mark for Flow Map

Property Type Description
mapScale int Defines scale of the map. Required.
mapOrigin array of 2 ints Defines the origin for the planes. Required. Format example: [0,0]
rotation string Defines the rotation. Required. Format example: '-90 0 0'
map object Defines style of the maps. Required
map.data TopoJson Defines the TopoJson file that would be used to draw the map. Required.
map.projection string Defines the projection of the map. Not Required. Default value: Mercator Available values: Mercator, Robinson, Gall-Peter, Winkel-Tripel, Equirectangular, Natural Earth1.
map.shapeIdentifier string Defines the field in the TopoJson file of the map which can be used to indentify the different TopoJson shapes. Required.
map.shapeKey string Defines the field in the TopoJson which defines the array of the different TopoJson shapes. Required.
map.style object Defines the style for the planes. Not Required.
map.style.extrusion object Defines the height of the map. Not Required. Default value: 0.001.
map.style.fill object Defines the fill for the planes. Not Required
map.style.fill.color string Defines the fill color for map. Not Required. Default value: "#ff0000"
map.style.fill.opacity float Defines the opacity of fill of the map. Not Required. Default value: 1.
map.style.stroke object Defines the stroke for the planes. Not Required. If not present the planes are not stroked.
map.style.stroke.width float Defines the stroke of the map. Not Required. Default value: 1.
map.style.stroke.color string Defines the stroke color for map. Not Required. Default value: "#000000"
bars object Defines style of the bars. Required
bars.type string Defines type of bar that would be created. Not Required. Default value: box. Available values: box, cone or cylinder.
bars.class function Returns the class (html class) for the bars as a function of the data. If space in present then the 2 string with space in between will be taken as different classes. Classes cannot begin with a number and nust not contain any special characters expect. This can be used for animating or creating interactions with the bars. Not Required.
bars.id function Returns the id (html id) for the bars as a function of the data. If space in present then the 2 string with space in between will be taken as different id. ids cannot begin with a number and nust not contain any special characters expect. No 2 ids must be same as id acts as a unique identifier. This can be used for animating or creating interactions with the bars. Not Required.
bars.style object Defines the style for the bar. Required.
bars.style.width float Defines the width of the bar. Not Required. Default value: 0.2.
bars.style.depth float Defines the depth of the bar. Not Required. Default value: 0.2.
bars.style.radius float Defines the radius of the bar, if the bar is a cylinder. Not Required. Default value: 0.2.
bars.style.segments int Defines the no. of segments in bar, if the bar is a cylinder or cone. Not Required. Default value: 16.
bars.style.height object Defines the height of the bar. Required.
bars.style.height.field string Defines the field in the data that will be mapped as height of the bar. Required.
bars.style.height.domain array Defines the domain for height. Not Required. If not present the domain is calculated from the provided data depending on the bars.style.height.scaleType
bars.style.height.value array of 2 floats Defines the range for height. Not Required. Default value: [0,5]
bars.style.height.startFromZero boolean Defines if the domain starts from 0 or not. Not Required. Default value: false Only applicable if bars.style.height.domain is not given .
bars.style.fill object Defines the fill of the bar. Not Required.
bars.style.fill.opacity float Defines the opacity of the bar. Not Required. Default value: 1. Value must be between 0 and 1.
bars.style.fill.scaleType string Defines the scale type for fill of the bar. Not Required. If not present then a constant color that is defined is filled in the bar. Available values: linear or ordinal.
bars.style.fill.field string Defines the field in the data that will be mapped as fill of the bar. Required if bars.style.fill.scaleType is present.
bars.style.fill.domain array Defines the domain for fill. Not Required. If not present the domain is calculated from the provided data depending on the bars.style.fill.scaleType
bars.style.fill.color array or string Defines the color for fill. Not Required. Default value: #ff0000 if bars.style.fill.scaleType is not present else d3.schemeCategory10. If bars.style.fill.scaleType is not present the this needs to be a string otherwise an array.
bars.style.fill.startFromZero boolean Defines if the domain starts from 0 or not. Not Required. Default value: false Only applicable if bars.style.fill.color is not given and bars.style.fill.scaleType is linear.
bars.mouseOver Object Defines the mouseOver effect on the bars. Not Required. If not present no mouse over effect happens.
bars.mouseOver.focusedObject object Defines the style for the mouseOver effect on the bar. Required.
bars.mouseOver.focusedObject.opacity float Defines the opacity of bar when mouse hovers on it. Required.
bars.mouseOver.focusedObject.fill string Defines the color of bar when mouse hovers on it. Required.
bars.mouseOver.nonFocusedObject object Defines the style for the bar not in focus. Required.
bars.mouseOver.nonFocusedObject.opacity float Defines the opacity of bar which are not in focus when mouse hovers on a particular bar. Required.
bars.mouseOver.label object Defines the value and style of the mouse over text. Not Required. If not present the label is not shown.
bars.mouseOver.label.value function Returns the value of the text that is to be shown in the label. Required. \n can be used for new line.
bars.mouseOver.label.align string Defines the alignment of the text in the label. Required. Available values: center, left or right.
bars.mouseOver.label.fontColor string Defines the color of the text in the label. Required.
bars.mouseOver.label.lineHeight float Defines the line height of the text in the label. Not Required.
bars.mouseOver.label.wrapCount int Defines the wrap count of the text in the label. Not Required.
bars.mouseOver.label.backgroundColor string Defines the color of the background of the label. Required.
bars.mouseOver.label.backgroundOpacity string Defines the color of the background of the label. Required.
bars.mouseOver.label.position string Defines the position of the label w.r.t the cursor. Not Required. Format is "0 0 0".
bars.mouseOver.label.rotation string Defines the rotation of the label w.r.t the cursor. Not Required. Format is "90 0 0".
bars.mouseOver.label.width float Defines the width of the label. Not Required.
bars.mouseOver.label.height float Defines the height of the label. Not Required.

Data

Datafile: csv

The data file must have latitude, longitude as the header values.

latitude,longitude,value
42.546245,1.601554,3.148977637
23.424076,53.847818,9.563725062
33.93911,67.709953,7.260326865

Known Issue

  • Holes in the maps don't work (for example Lesotho in South Africa)