No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

VRViz Component

The react component used to generate visualizations is VRViz with 2 props:

  • scene
  • graph

scene defines the property of the A-Frame scene that will be generated in which the visualization will be placed. This is not a mandatory prop in the component. If the developers feels the need to design the scene before and then place the visualization in the designed scene he/she can do that. This provide flexibility to design a customized scene with textures and objects in it and also let the developers add other A-Frame component (to add interactivity or animation) to scene.

graph is the prop where the visualization is defined. Different visualization requires the developer to define different parameter. This is a mandatory prop in the component. The prop must be defined as an array which gives flexibility to add multiple visualizations in the same scene to either design a dashboard in VR (just by changing the position of their origin) or overlap multiple visualization on each other.

Example of Visualization Component

<VRViz
  scene={
    {
      'sky': {
        'style': {
          'color': '#ccc',
          'texture': false,
        }
      },
      'lights': [
        {
          'type': 'directional',
          'color': '#fff',
          'position': '0 1 1',
          'intensity': 1,
          "decay": 1,
        },
        {
          'type': 'ambient',
          'color': '#fff',
          'intensity': 1,
          "decay": 1,
        }
      ],
      'camera': {
        'position': '0 0 10',
        'rotation': '0 0 0',
      },
      'floor': {
        'style': {
          'color': '#ccc',
          'texture': false,
          'width': 100,
          'depth': 100,
        }
      },
      'parentDiv':{
        'class':'graph',
        'height':1000,
        'width':1000
      },
      'reloadPageOnExitVR':true
    }
  }
  graph={
    [
      {
        'type': 'TreeMap',
        'data': {
          'dataFile': "data/TreeMap.json",
          'fileType': 'json',
        },
        'style': {
          'origin': [0, 0, 0],
          'dimensions': {
            'width': 50,
            'depth': 50,
            'height': 5,
          }
        },
        'mark': {
          'type': box,
          'style': {
            'paddingInner': 0.5,
            'paddingOuter': 0.1,
            'extrusion': {
              'field': 'size',
              'startFromZero': true,
            },
            'fill': {
              'scaleType': 'ordinal',
              'opacity': 1,
            },
          },
        },
      }
    ]
  }
/>

Scene Object

Scene object help the developer to define the characteristics of the scene where the visualization will be placed. As mentioned above the scene object is not mandatory. Different keys in this object help us to define the scene.

Example

{
  'sky': {
    'style': {
      'color': '#ccc',
      'texture': false,
    }
  },
  'lights': [
    {
      'type': 'directional',
      'color': '#fff',
      'position': '0 1 1',
      'intensity': 1,
      "decay": 1,
    },
    {
      'type': 'ambient',
      'color': '#fff',
      'intensity': 1,
      "decay": 1,
    }
  ],
  'camera': {
    'position': '0 0 10',
    'rotation': '0 0 0',
  },
  'floor': {
    'style': {
      'color': '#ccc',
      'texture': false,
      'width': 100,
      'depth': 100,
    }
  },
  'parentDiv':{
    'class':'graph',
    'height':1000,
    'width':1000
  },
  'reloadPageOnExitVR':true
}

6 main features / properties of the scene objects are:

  • sky
  • lights
  • camera
  • floor
  • 3D-objects (optional)
  • parentDiv (optional)
  • reloadPageOnExitVR (optional)

sky

Sky has property called style in which the visual properties of sky is defined.

Style Properties for Sky

PropertyTypeDescription
colorstringColor of the skybox. Not Required if texture is true.
textureboolIf there is texture present in the skybox or not. Default value is false.
imgstringPath to the texture / image that is shown on the skybox. Not required if texture is false.

lights

Light property is defined as array which can have multiple lights. Proposed light system is a combination of an ambient light source and directional light source. Each element of array i.e. light is defined using the properties mentioned below.

Properties for Light

PropertyTypeDescription
typestringType of light. Required. Available values: ambient, directional, point.
colorstringColor of the light. Required
intensityfloatIntesity of the light. Required
decayfloatDecay value of the light. Required
positionstringPosition of light source. Not required if type is ambient. Format is "0 0 0". Note that for type directional only the vector matters i.e. position="-100 100 0" and position="-1 1 0" are the same.

camera

Properties for Camera

PropertyTypeDescription
positionstringPosition of the camera. Required. Format is "0 0 0".
rotationstringRotation of the camera. Required. Format is "90 0 0". Note that the values are in degree and the numbers represent ratation along x-axis, y-axis and z-axis respectively.

floor

Floor has property called style in which the visual properties of floor is defined.

Style Properties for Floor

PropertyTypeDescription
colorstringColor of the floor. Not Required if texture is true.
widthfloatWidth of the floor. Required
depthfloatDepth of the floor. Required
textureboolIf there is texture present in the floor or not. Not Required. Default value is false.
imgstringPath to the texture / image that is shown on the floor. Not Required if texture is false.
repeatboolNot Required if texture is false.

3D-objects

3D-objects property is defined as array which can have multiple 3D objects. Each element of array i.e. 3D object is defined using the properties mentioned below.

Properties for 3D-objects

PropertyTypeDescription
objectFilestringPath of the 3D object. Required
idstringID of the 3D object which is later used to identify this object. There should not be any space or special character except and must not start with a number. Required

parentDiv (optional)

parentDiv defines the class and size of the div in which a-scene is embedded.

Properties for parentDiv

PropertyTypeDescription
classstringDefines the class name of the div in which a-scene is embedded. Default value is aframeBox.
heightintDefines the height of the div in which a-scene is embedded. Default value is height of the window or browser.
widthintDefines the height of the div in which a-scene is embedded. Default value is width of the window or browser.

reloadPageOnExitVR (optional)

Defines if the user wants to reload the page when exiting VR mode. Is useful when there are multiple a-scene in the same page. Not Required. Default value: false. Format:''reloadPageOnExitVR':true

Graph Object

Graph object help the developer to define the visualization. Although different visualizations requires the developer to define different parameters, there are some features which are same for most or all visualization type. This is a mandatory prop in the component. The prop must be defined as an array which gives flexibility to add multiple visualizations in the same scene to either design a dashboard in VR (just by changing the position of their origin) or overlap multiple visualization on each other.

Main features / properties of the graph objects are:

  • type
  • data
  • style Not Required
  • mark
  • axis Not Required
  • title Not Required
  • rotationOnDrag Not Requred
  • animateRotation Not Required

type

type is used to define what kind of visualization is needed. The availabe values for type are :

Charts

  • BarGraph for 3D Bar Graph
  • StackedBarGraph for 3D Stacked Bar Graph
  • LollipopChart for 3D Lollipop Chart
  • RectangleChart for 3D Rectangle Chart
  • ScatterPlot for 3D Scatter Plot / 3D Bubble Chat
  • ConnectedScatterPlot for 3D Connected Scatter Plot
  • MeshPlot for 3D Mesh Plot
  • WaterFallPlot for Waterfall Plot
  • TimeSeries for 3D Time Series
  • SpiralPlot for 3D Spiral Plot

Maps

  • PrismMap for 3D Prism Map
  • MapBarGraph for 3D Map Bar Graph
  • MapStackedBarGraph for 3D Map Stacked Bar Graph
  • MapTimeBars for Time Series on Map
  • IsolineMap for 3D Map with Iso Line
  • FlowMap for 3D Flow Map

Diagrams

  • CrossSectionView for 3D Cross Sectional View or 3D Models
  • ContourMap for 3D Contour Map
  • PointCloud for 3D Point Cloud
  • ForceDirectedGraph for 3D Force Directed Graph
  • TreeMap for 3D TreeMap

Plots

  • ContourPlot for 3D Contour Plot
  • ParametricCurvePlot for 3D Parametric Curve Plot
  • SurfacePlot for 3D Surface Plot
  • ParametricSurfacePlot for 3D Parametric Surface Plot

data

Properties for Data

PropertyTypeDescription
dataFilestringPath to location where the data file is located. Required for most visualization type except for curve plot, surface plot, parametric curve plot and parametric surface plot.
fileTypestringType of value. Available values: csv, json, ply, text. If the value of fileType is not mentioned the dataFile is taken as a json variable. csv fletype must have header; text is used for csv without header.
descarrayDescription of the header. Required only if the fileType is csv. Example: [['Year', 'date','YYYY'], ['geoJson', 'jsonObject'], ['Tornadoes', 'text'], ['Deaths', 'number']]. If the data type for a particular header is date or time then the format is also required. Available formats can be seen here. Moment.js is used to parse dates and time.

style Not Required

Properties for Style

PropertyTypeDescription
originobjectDefines the position where the origin of the graph is placed. Keys in the object are x, y and z.Not Required. Default value: {x: 0, y: 0, z: 0}. Not all keys are required also.
rotationstringDefines the rotation of the chart. Not Required. Default value: '0 0 0' Format example: '-90 0 0'
dimensionobjectDefines the dimension of the graph. Keys in the object are width, depth and height. The value for all these keys are float type. Not Required. Default value: {width: 10, height: 10, depth: 10}.
pivotobjectDefines the pivot point around which the graph can be rotated using animateRotation or on mouse drag. Keys in the object are x, y and z.Not Required. Default value: {x: 0, y: 0, z: 0}. Not all keys are required also.

mark

mark is used to define the style and encoding for graphics in different visualizations. Different visualizations have different mark properties and key. These are discussed further in the documentation of individual visualizations.

axis Not Required

axis is used to define and draw the x, y and z axis. This object is not compulsory. If this object is not present none of the axes are drawn.

Example

'axis': {
  'axis-box': {
    'color': 'black',
  },
  'x-axis': {
    'orient': 'bottom-back',
    'title': {
      'text': '',
      'fontSize': 10,
      'color': 'black',
      'opacity': 1,
    },
    'ticks': {
      'noOfTicks': 10,
      'size': 0.1,
      'color': 'black',
      'opacity': 1,
      'fontSize': 10,
      'rotation': '-90 0 0',
      'align':'center'
    },
    'grid': {
      'color': 'black',
      'opacity': 1,
    }
  },
  'y-axis': {
    'orient': 'bottom-back',
    'title': {
      'text': '',
      'fontSize': 10,
      'color': 'black',
      'opacity': 1,
    },
    'ticks': {
      'noOfTicks': 10,
      'size': 0.1,
      'color': 'black',
      'opacity': 1,
      'fontSize': 10,
      'rotation': '-90 0 0',
      'align':'center'
    },
    'grid': {
      'color': 'black',
      'opacity': 1,
    }
  },
  'z-axis': {
    'orient': 'bottom-back',
    'title': {
      'text': '',
      'fontSize': 10,
      'color': 'black',
      'opacity': 1,
    },
    'ticks': {
      'noOfTicks': 10,
      'size': 0.1,
      'color': 'black',
      'opacity': 1,
      'fontSize': 10,
      'rotation': '-90 0 0',
      'align':'center'
    },
    'grid': {
      'color': 'black',
      'opacity': 1,
    }
  }
}

axis has the 2 main type of objects

  • axis-box
  • x-axis, y-axis, z-axis

Note: For spiral chart the axis prop is not defined like below. To see the axis prop in spiral chart read the documentation of spiral chart here.

axis-box Defines if the axis-box is drawn or not and the color and opacity of the axis box. Not Required. If the object is not present then the axis-box is not drawn. The dimensions of the axis box is taken from the dimension object in style

Properties for axis-box

PropertyTypeDescription
colorstringDefines the color of the axis box. Required
opacityfloatDefines the opacity of the axis box. Reqruied. Value must be between 0 and 1

x-axis, y-axis, z-axis Defines if the different axes are drawn or not. Not Required. If an object is not present then that axis is not drawn.

Properties for x-axis, y-axis, z-axis

PropertyTypeDescription
orientstringDefines where the ticks are displayed. Not Required. Default value for x-axis: front-top. Default value for x-axis: front-left. Default value for x-axis: bottom-left.. Available values for x-axis: front-top, back-bottom, back-top or front-bottom. Available values for y-axis: front-left, back-left, front-right or back-right. Available values for z-axis: bottom-left, top-left, top-right or bottom-right.
titleobjectDefined the style of title for the axis. Not Required.
title.textstringDefined the text for title for the axis. Not Required. Default value: x-axis, y-axis or z-axis depending on the axis.
title.fontSizeintDefined the font size for title for the axis. Not Required. Default value: 12.
title.colorstringDefined the color for title for the axis. Not Required. Default value: "#000000".
title.opacityfloatDefined the opacity for title for the axis. Not Required. Default value: 1. Value must be between 0 and 1. Currently this feature is not available.
title.billboardingboolDefines if the text always face the camera. Not Required. Default value: true. If the value is change to true title.rotation is ignored.
tickobjectDefined the ticks for the axis. Required.
tick.noOfTicksintDefined the no. of tick for the axis. Required. No. of ticks are only applicable for linear scale.
tick.sizefloatDefined the font size for ticks for the axis. Required.
tick.fontSizeintDefined the font size for text for tick for the axis. Required.
tick.colorstringDefined the color for ticks and text for tick for the axis. Required.
tick.opacityfloatDefined the opacity for title for the axis. Required. Value must be between 0 and 1.
tick.rotationstringDefines the alignment of the text for ticks. Not Required. Default value for x-axis: "-90 0 0". Default value for y-axis: "0 0 0". Default value for z-axis: "-90 0 0". Format is "0 0 0".
tick.alignstringDefines the alignment of the text for ticks. Not Required. Default value for x-axis: center. Default value for y-axis: right. Default value for z-axis: right. Available values: left, center, right.
tick.billboardingboolDefines if the text always face the camera. Not Required. Default value:true. If the value is change to true tick.rotation is ignored.
gridobjectDefined the style of grid for the axis. Not Required.
grid.colorstringDefined the color for grid for the axis. Not Required. Default value: "#000000".
grid.opacityfloatDefined the opacity for grid for the axis. Not Required. Default value: 1. Value must be between 0 and 1.

title Not Required

This defines the title of the graph

Properties for title

PropertyTypeDescription
valuefunctionReturns the value of the text that is to be shown in the label. Not Required. Default value: Visualization \n can be used for new line.
alignstringDefines the alignment of the text in the graph title. Not Required. Default value: center Available values: center, left or right.
colorstringDefines the color of the text in the graph title. Not Required. Default value: "#000000".
lineHeightfloatDefines the line height of the text in the graph title. Not Required. Default value: 14.
wrapCountintDefines the wrap count of the text in the graph title. Not Required. Default value: 80.
positionstringDefines the position of the graph title. Required. Format is "0 0 0".
rotationstringDefines the rotation of the graph title. Not Required. Format is "90 0 0".
fontSizefloatDefines the fontSize of the graph title. Not Required. Default value: 12.
billboardingboolDefines if the text always face the camera. Not Required. Default value: true. If the value is change to true title.rotation is ignored.

rotationOnDrag Not Required

This is use to define weather the visualization rotates on drag. Not Required. If no present then rotationOnDrag is activated by default. Type: object.

Properties for rotationOnDrag

PropertyTypeDescription
rotateVisualizationbooleanDefines weather visualization rotates on drag. Not Required. Default value: true.
rotateAroundYaxisbooleanDefines weather rotation on drag is allowed along Y axis. Not Required. Default value: true.
rotateAroundXaxisbooleanDefines weather rotation on drag is allowed along X axis. Not Required. Default value: true.

animateRotation Not Required

This is use to define the rotation animation of the graph for viewing it in different perspective. If animateRotation is present the roation of graph on mouse drag is ignored.

Properties for animateRotation

PropertyTypeDescription
initialAnglesstringDefines the starting angel (in degrees) of the rotation animation for the graph. Required. Example: "0 0 0"
finalAnglesstringDefines the ending angel (in degrees) of the rotation animation for the graph. Required. Example: "0 360 0"
durationintDefines the timeperiod of the animation. The value is in millisecond. Required.