Skip to content

Latest commit

 

History

History
135 lines (125 loc) · 28.7 KB

LollipopChart.md

File metadata and controls

135 lines (125 loc) · 28.7 KB

LollipopChart Component

LollipopChart

mark Object in Graph Props

'mark': {
  'type': 'box',
  'position': {
    'x': {
      'field': 'State',
    },
    'y': {
      'startFromZero': true,
      'field': 'Population',
    },
    'z': {
      'field': 'AgeGroup',
    }
  },
  'style': {
    'padding': {
      'x': 0.1,
      'z': 0.1,
    },
    'radius': {
      'value':0.1,
    },
    'fill': {
      'opacity': 0.8,
      'scaleType': 'linear',
      'field': 'Population',
      'color': ['#b71c1c', '#2196f3'],
    },
  },
  'droplines': {
    'style': {
      'radius':0.01,
      'fill': {
        'opacity': 0.8,
        'scaleType': 'linear',
        'field': 'Population',
        'color': ['#b71c1c', '#2196f3'],
      },
    }
  },
}

Properties for mark for Bar Graph

Property Type Description
type string Defines type of bar that would be created. Not Required. Default value: box. Available values: box, cone or cylinder.
class function Returns the class (html class) for the point 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 point. Not Required.
id function Returns the id (html id) for the point 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 point. Required.
position object Defines the how the position of bars will be mapped. Required.
position.x object Required.
position.x.field string Defines the field in the data that will be mapped as x position of the bar. Required.
position.x.domain float Defines the domain for x position. Not Required. If not present the domain is calculated from the provided data.
position.y object Required.
position.y.field string Defines the field in the data that will be mapped as y position of the bar. Required.
position.y.domain array Defines the domain for y position. Not Required. If not present the domain is calculated from the provided data.
position.z object Required.
position.z.field string Defines the field in the data that will be mapped as z position of the bar. Required.
position.z.domain array Defines the domain for z position. Not Required. If not present the domain is calculated from the provided data.
style object Defines the style for the bar. Not Required.
style.padding object Defines the spacing between the bar. Not Required.
style.padding.x object Defines the spacing between the bar along x axis. Not Required. Default value: 0 Value must be between 0 and 1.
style.padding.z object Defines the spacing between the bar along z axis. Not Required. Default value: 0 Value must be between 0 and 1.
style.segments int Defines the no. of segments in bar, if the bar is a cylinder or cone. Not Required. Default value: 16 Only applicable if type is cylinder or cone.
style.radius object Defines the radius of the mark. Not Required.
style.radius.field string Defines the field in the data that will be mapped as radius of the mark. Required if style.radius.scaleType is present.
style.radius.value float or array Defines the radius of the mark. Not Required. Default value: 0.1 If style.radius.scaleType is not present the this needs to be float otherwise an array of float.
style.radius.domain array Defines the domain for radius. Not Required. If not present the domain is calculated from the provided data depending on the style.radius.scaleType
style.radius.startFromZero boolean Defines if the domain starts from 0 or not. Not Required. Default value: false Only applicable if style.radius.domain is not given and style.radius.scaleType is linear.
style.fill object Defines the fill of the bar. Not Required.
style.fill.opacity float Defines the opacity of the bar. Not Required. Default value: 1 Value must be between 0 and 1.
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.
style.fill.field string Defines the field in the data that will be mapped as fill of the bar. Required if style.fill.scaleType is present.
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 style.fill.scaleType
style.fill.color array or string Defines the color for fill. Not Required. Default value if style.fill.scaleType is present is d3.schemeCategory10, else "#ff0000" If style.fill.scaleType is not present the this needs to be a string otherwise an array.
style.fill.startFromZero boolean Defines if the domain starts from 0 or not. Not Required. Default value: false Only applicable if style.fill.domain is not given and style.fill.scaleType is linear.
droplines object Defines the droplines / stem of the lollipop mark. Not Required.
droplines.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.
droplines.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.
droplines.style object Defines the style for the droplines. Not Required.
droplines.style.radius float Defines the radius of the droplines. Not Required.
droplines.style.fill object Defines the fill of the droplines. Not Required.
droplines.style.fill.opacity float Defines the opacity of the droplines. Not Required. Default value: 1 Value must be between 0 and 1.
droplines.style.fill.scaleType string Defines the scale type for fill of the droplines. Not Required. If not present then a constant color that is defined is filled in the droplines. Available values: linear or ordinal.
droplines.style.fill.field string Defines the field in the data that will be mapped as fill of the droplines. Required if droplines.style.fill.scaleType is present.
droplines.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 droplines.style.fill.scaleType
droplines.style.fill.color array or string Defines the color for fill. Not Required. Default value if droplines.style.fill.scaleType is present is d3.schemeCategory10, else "#ff0000" If droplines.style.fill.scaleType is not present the this needs to be a string otherwise an array.
droplines.style.fill.startFromZero boolean Defines if the domain starts from 0 or not. Not Required. Default value: false Only applicable if droplines.style.fill.color is not given and droplines.style.fill.scaleType is linear.
mouseOver Object Defines the mouseOver effect on the bars. Not Required. If not present no mouse over effect happens.
mouseOver.focusedObject object Defines the style for the mouseOver effect on the bar. Required.
mouseOver.focusedObject.opacity float Defines the opacity of bar when mouse hovers on it. Required.
mouseOver.focusedObject.fill string Defines the color of bar when mouse hovers on it. Required.
mouseOver.nonFocusedObject object Defines the style for the bar not in focus. Required.
mouseOver.nonFocusedObject.opacity float Defines the opacity of bar which are not in focus when mouse hovers on a particular bar. Required.
mouseOver.label object Defines the value and style of the mouse over text. Not Required. If not present the label is not shown.
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.
mouseOver.label.align string Defines the alignment of the text in the label. Required. Available values: center, left or right.
mouseOver.label.fontColor string Defines the color of the text in the label. Required.
mouseOver.label.lineHeight float Defines the line height of the text in the label. Not Required.
mouseOver.label.wrapCount int Defines the wrap count of the text in the label. Not Required.
mouseOver.label.backgroundColor string Defines the color of the background of the label. Required.
mouseOver.label.backgroundOpacity string Defines the color of the background of the label. Required.
mouseOver.label.position string Defines the position of the label w.r.t the cursor. Not Required. Format is "0 0 0".
mouseOver.label.rotation string Defines the rotation of the label w.r.t the cursor. Not Required. Format is "90 0 0".
mouseOver.label.width float Defines the width of the label. Not Required.
mouseOver.label.height float Defines the height of the label. Not Required.
onClick function Callback function for mouseclick on the shape. Argument of the function is the data binded to the shape. Not Required

Note: The width and depth or radius of the bar is calculated depending upon the dimensions of the graph and padding in between the bars.

Data

Datafile: csv

Year,Month,Tornadoes,Deaths
1996,January,35,1
1996,February,14,1
1997,January,50,2
1997,February,23,1
1998,January,47,0
1998,February,72,42
1999,January,212,18
1999,February,22,0