3D Charts

Overview

ZingChart offers a variety of 3D JavaScript chart types, along with the ability to control how the chart is displayed with 3D type, angle, depth, and zoom.

3D Chart Types

The first step to creating JavaScript 3D charts is to specify a 3D chart type.

The available 3D chart types are:

ValueDescription
area3d3D Area
bar3d3D Bar
hbar3d3D Horizontal Bar
line3d3D Line
mixed3d3D Mixed Charts
pie3d3D Pie
ring3d3D Donut
waterfall3d3D Waterfall
hwaterfall3d3D Horizontal Waterfall

3D Area Chart

3D area charts are specified by the area3d value.

Note: Use the alpha-area attribute to adjust the transparency levels to ensure all the data in the series is visible.

{
  type: "area3d",
  plot: {
    'alpha-area': 0.7
  }
}
https://app.zingsoft.com/demos/embed/MM4K5EO2
https://app.zingsoft.com/demos/embed/MM4K5EO2

3D Bar Chart

3D bar charts are specified by the bar3d or vbar3d value. The bars are vertically oriented.

{
  type: "bar3d" /* or "vbar3d" */
}
https://app.zingsoft.com/demos/embed/JU9FN52E
https://app.zingsoft.com/demos/embed/JU9FN52E

3D Horizontal Bar Chart

3D horizontal bar charts are specified by the hbar3d value.

{
  type: "hbar3d"
}
https://app.zingsoft.com/demos/embed/5X587DWF
https://app.zingsoft.com/demos/embed/5X587DWF

3D Line Chart

3D line charts are specified by the line3d attribute.

{
  type: "line3d",
}
https://app.zingsoft.com/demos/embed/GAD1MTKJ
https://app.zingsoft.com/demos/embed/GAD1MTKJ

3D Mixed Chart

The three-dimensional mixed chart is specified by the mixed3d value. You can use the area3d, bar3d, and line3d chart types with our 3D mixed charts, as seen in the example chart below:

{
  type: "mixed3d", // 1. Specify your mixed chart type.
  plot: {
    tooltip: {
      text: "%t"
    }
  },
  series: [ // 2. Specify the chart type for each series object.
    {
      type: "area3d",
      values: [34, 70, 40, 75, 33, 50, 65],
      aspect: "stepped",
      'contour-on-top': false,
      'alpha-area': 0.5,
      text: "Area Chart"
    },
    {
      type: "bar3d",
      values: [49, 30, 21, 15, 59, 51, 69],
      'bar-width': "50%",
      text: "Bar Chart"
    },
    {
      type: "line3d",
      values: [5, 9, 3, 19, 7, 15, 14],
      aspect: "spline",
      text: "Line Chart"
    }
  ]
}
https://app.zingsoft.com/demos/embed/041OC4N9
https://app.zingsoft.com/demos/embed/041OC4N9

3D Pie Chart

Our three-dimensional pie chart is specified by the pie3d value.

{
  type: "pie3d",
}
https://app.zingsoft.com/demos/embed/QZQ78QX4
https://app.zingsoft.com/demos/embed/QZQ78QX4

3D Donut Chart

The three-dimensional donut chart is specified by the ring3d value.

Note: You can modify the donut ring size. Create a plot object and insert a slice attribute. Specify your desired ring size as a percentage or pixel value.

{
  type: "ring3d",

}
https://app.zingsoft.com/demos/embed/ZV6UJ6PP
https://app.zingsoft.com/demos/embed/ZV6UJ6PP

3D Waterfall Chart

The three-dimensional waterfall chart is specified by the waterfall3d value.

{
  type: "waterfall3d",
}
https://app.zingsoft.com/demos/embed/CA3JP4LJ
https://app.zingsoft.com/demos/embed/CA3JP4LJ

3D Horizontal Waterfall Chart

The three-dimensional horizontal waterfall chart is specified by the hwaterfall3d value.

{
  type: "hwaterfall3d",
}
https://app.zingsoft.com/demos/embed/R5DGETT5
https://app.zingsoft.com/demos/embed/R5DGETT5

3D Chart Aspects

To use the 3D attributes in your chart, you must first create a "3d-aspect" object where you can specify which type of 3D aspect to use.

'3d-aspect': { 
    }

True 3D vs Isometric

The "true3d" attribute can be set to true or false. By default, it is set to true.

By setting "true3d" to true, the chart will use a true 3D engine. This will give you access to the perspective and control of the x, y and "z" properties. Setting it to false will force an isometric view, which is a 2D representation of three dimensions. This view has no perspective.

type: "bar3d",
    '3d-aspect': {
      true3d: false
    }
https://app.zingsoft.com/demos/embed/UZFCKJ9E
https://app.zingsoft.com/demos/embed/UZFCKJ9E

Facets

"Facets" is a plot/series object, meaning it can be placed within the "plot" object, where it will have the same effect on every plot object in a chart, or within each object in the "series" array. When placed in a series object, it will only affect that series, allowing you to apply a different style to each.

3D objects are made up of front, left, right, top, and bottom sections. As such, these terms are used within the "facets" object to style each section.

plot: {
  facets: {
    front: {
      'background-color': "#3EA4F9 #0055BF"
    },
    right: {
      'background-color': "#3EA4F9 #0055BF"
    },
    left: {
      'background-color': "#3EA4F9 #0055BF"
    },
    top: {
      'background-color': "white"
    },
    bottom: {
      'background-color': "white"
    }
  }
},
https://app.zingsoft.com/demos/embed/3CBFF0OC
https://app.zingsoft.com/demos/embed/3CBFF0OC

The above demo uses facets within the "plot" object. Below, you'll see a demo in which facets are used within each object of the "series" array to style each plot differently.

https://app.zingsoft.com/demos/embed/9O64IDWX
https://app.zingsoft.com/demos/embed/9O64IDWX

The following demo uses facets to style the goal rings around each cylinder -- they're actually cylinders themselves! Right-click on the chart and select "View Source" to view our JSON. The possibilities are endless when you use a bit of creativity!

https://app.zingsoft.com/demos/embed/TNKH6M0W
https://app.zingsoft.com/demos/embed/TNKH6M0W

Angle

When you are using the isometric view, you have the option of setting the angle perspective by using the "angle" attribute. By default, the angle is set to 45 degrees. You can set it to be any value between 0 and 90.

type: "bar3d",
    '3d-aspect': {
      true3d: false,
      angle:75
    }
https://app.zingsoft.com/demos/embed/9DX7LEVA
https://app.zingsoft.com/demos/embed/9DX7LEVA

When you are using the true 3D view, it will use a true 3D engine, allowing you to use the x, y and "z" properties.

type: "bar3d",
    '3d-aspect': {
      'x-angle':20,
      'y-angle':25,
      'z-angle':0
    }
https://app.zingsoft.com/demos/embed/FX81FQI6
https://app.zingsoft.com/demos/embed/FX81FQI6

Depth

The "depth" attribute is used to specify the depth on the z-axis and can be used in either isometric or true 3D.

type: "bar3d",
    '3d-aspect': {
      depth: "75px"
    }
https://app.zingsoft.com/demos/embed/VITA8YIB
https://app.zingsoft.com/demos/embed/VITA8YIB

Zoom

When you are using the true 3D view, you have the option of setting the zoom perspective by using the "zoom" attribute. By default, the zoom perspective is set to 1.0. If you are using a value less than 1.0, the leading 0 is required before the decimal.

type: "bar3d",
    '3d-aspect': {
      zoom:0.7
    }
https://app.zingsoft.com/demos/embed/11DL9KZK
https://app.zingsoft.com/demos/embed/11DL9KZK

Summary

This was just a small taste of what you can accomplish using the 3D attributes. Try using them on different chart types to see what you can come up with.

Don't forget, a comprehensive list of available attributes and objects can be found on our JSON Syntax page.