3D Column Chart with Null and 0 Values


Advertisements

We have already seen the configuration used to draw a chart in Highcharts Configuration Syntax chapter.

An example of a 3D Column chart with null and 0 values is given below.

Configurations

Let us now see the additional configurations/steps taken.

chart.options3d

Configure the chart type to be 3D based. Set the type to be 'Column'. Options to render charts in 3 dimensions.

var chart = {
   type: 'column',
   options3d: {
      enabled: true,
      alpha: 15,
      beta: 15,
      depth: 50,
      viewDistance: 25
   }
};

Example

highcharts_3d_column_null.htm

<html>
   <head>
      <title>Highcharts Tutorial</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
      <script src = "https://code.highcharts.com/highcharts.js"></script>  
      <script src = "https://code.highcharts.com/highcharts-3d.js"></script>
   </head>
   
   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 auto"></div>
      <script language = "JavaScript">
         $(document).ready(function() {  
            var chart = {      
               type: 'column',
               margin: 75,
               
               options3d: {
                  enabled: true,
                  alpha: 10,
                  beta: 25,
                  depth: 70
               }
            };
            var title = {
               text: '3D chart with null values'   
            };
            var subtitle = {
               text: 'Notice the difference between a 0 value and a null point'  
            };
            var xAxis = {
               categories: Highcharts.getOptions().lang.shortMonths
            };
            var yAxis = {
               title: {
                  text: null
               }
            };   
            var series = [{
               name: 'Sales',
               data: [2, 3, null, 4, 0, 5, 1, 4, 6, 3]
            }];     
            var json = {};   
            json.chart = chart; 
            json.title = title;   
            json.subtitle = subtitle;    
            json.xAxis = xAxis; 
            json.yAxis = yAxis; 
            json.series = series;   
            $('#container').highcharts(json);
         });
      </script>
   </body>
   
</html>

Result

Verify the result.

highcharts_3d_charts.htm
Advertisements