{"id":14108,"date":"2021-12-15T12:10:49","date_gmt":"2021-12-15T12:10:49","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=14108"},"modified":"2022-08-13T11:08:54","modified_gmt":"2022-08-13T11:08:54","slug":"surface-chart-javascript","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/","title":{"rendered":"How to Build Surface Chart Using JavaScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png\" alt=\"How to Build a Surface Chart Using JavaScript\" width=\"100%\" class=\"alignnone size-full wp-image-14117\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png 1695w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-300x158.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-768x403.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-1024x538.png 1024w\" sizes=\"(max-width: 1695px) 100vw, 1695px\" \/><\/a><a href=\"https:\/\/www.anychart.com\/blog\/2018\/11\/20\/data-visualization-definition-history-examples\/\">Data visualization<\/a> is a must-have skill today with ever-growing data and the need to analyze as well as present that data. You will definitely come across data charts whether you are in the technology industry or not and therefore, it is a good idea to learn how to build visualizations.<\/p>\n<p>I will show you here that building charts is not very tough and with the right tools, you can start creating interactive, interesting visualizations in little time and effort!<\/p>\n<p>In this step-by-step tutorial, I will demonstrate how to represent GDP values of various countries for the past 15 years on a beautiful interactive 3D surface chart using a JavaScript library for data visualization.<\/p>\n<p>The surface plot looks quite complex, but I will show you how straightforward it is to make a compelling and fully functional one.<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>What\u2019s a 3D Surface Chart?<\/h2>\n<p>A 3D surface chart plots three dimensions of data on the x, y, and z axes with two of the variables being independent (displayed along the horizontal axes) and one being dependent on the other two (shown on the vertical axis).<\/p>\n<p>In this tutorial, I will be plotting countries and years as the independent variables and GDP values as the dependent variable.<\/p>\n<h2>JavaScript Charting Libraries<\/h2>\n<p>Currently, there are a lot of good <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">JS charting libraries<\/a>, all of them having some pros and cons. You can choose which one to use based on your specific requirements and the best part is that the process of building visualizations is very similar for all of the libraries. So, you can start learning with any of the libraries and extend your knowledge to another library as well.<\/p>\n<p>For this tutorial, I am going to use the <a href=\"https:\/\/www.anychart.com\/\">AnyChart<\/a> JavaScript charting library which is likely a good choice for beginners. It has tons of <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/\">examples<\/a> along with extensive <a href=\"https:\/\/docs.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">documentation<\/a> that is really useful when starting out.<\/p>\n<p>Also, AnyChart is quite easy to use and flexible with loads of customization options. And what\u2019s especially important to many \u2014 it is free for personal, educational, and other non-commercial use.<\/p>\n<h2>Building Basic 3D Surface Plot Using a JS Library<\/h2>\n<p>It is an advantage, of course, if you have background knowledge of HTML, CSS, and JavaScript. But don\u2019t get overwhelmed even if you are a complete beginner. I will walk you through each line of the code, and once you understand what is happening, it should get easier to grasp.<\/p>\n<p>There are four general steps to create a 3D surface plot or basically any chart with a JS library, and as mentioned earlier, these steps remain alike irrespective of the library you use.<\/p>\n<ul>\n<li>Create an HTML page to display your chart.<\/li>\n<li>Include the required JavaScript files.<\/li>\n<li>Prepare and connect your data.<\/li>\n<li>Write the JS code for the chart.<\/li>\n<\/ul>\n<h3>Step 1 \u2014 Create a basic HTML page<\/h3>\n<p>The initial step is to have a blank HTML page that will hold the chart. I will add a block element with a unique id to the page. I will use the id to reference the <code>&lt;div&gt;<\/code> later.<\/p>\n<p>I will now specify the height and width of the <code>&lt;div&gt;<\/code> as 100% for both in the <code>&lt;style&gt;<\/code> block of the page. This will render the chart on the full page. You can specify the height and width according to your preference.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&nbsp;&nbsp;&lt;head&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta charset=\"utf-8\"&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;JavaScript Surface Chart&lt;\/title&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;style type=\"text\/css\"&gt;   \r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html, body, #container {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  width: 100%;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  height: 100%;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  margin: 0;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  padding: 0;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/style&gt;\r\n&nbsp;&nbsp;&lt;\/head&gt;\r\n&nbsp;&nbsp;&lt;body&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n&nbsp;&nbsp;&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>Step 2 \u2014 Add the necessary scripts<\/h3>\n<p>When you are using a JavaScript library, you need to add the scripts specific to the chart that you are building and the library that you are using.<\/p>\n<p>Here, I am using AnyChart so I need to add the corresponding scripts for the surface plot from <a href=\"https:\/\/cdn.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">its CDN<\/a> (Content Delivery Network) which is basically where all the scripts can be found.<\/p>\n<p>So, I will include AnyChart\u2019s <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#core\" target=\"_blank\" rel=\"nofollow\">Core<\/a> and <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#surface\" target=\"_blank\" rel=\"nofollow\">Surface<\/a> modules for this chart.<\/p>\n<p>Just to remind you, include all these script files in the <code>&lt;head&gt;<\/code> section of your HTML page.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&nbsp;&nbsp;&lt;head&gt;\r\n&nbsp;&nbsp;&lt;meta charset=\"utf-8\"&gt;\r\n&nbsp;&nbsp;&lt;title&gt;JavaScript Surface Chart&lt;\/title&gt;\r\n&nbsp;&nbsp;&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-surface.min.js\"&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;style type=\"text\/css\"&gt;   \r\n&nbsp;&nbsp;&nbsp;&nbsp;html, body, #container {\r\n&nbsp;&nbsp;&nbsp;&nbsp;  width: 100%; height: 100%; margin: 0; padding: 0;\r\n&nbsp;&nbsp;  }\r\n&nbsp;&nbsp;&lt;\/style&gt;\r\n&nbsp;&nbsp;&lt;\/head&gt;\r\n&nbsp;&nbsp;&lt;body&gt; \r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;script&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ All the code for the JS Surface Chart will come here\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>Step 3 \u2014 Include the data<\/h3>\n<p>The data I decided to visualize in a 3D surface plot comes from the World Bank Open Data website that gives me the GDP (PPP based) data for all the countries in a CSV file.<\/p>\n<p>It is easier to create a chart if the data is in the format that the chart expects and how you want to show the data. So I pre-processed the data accordingly. You can go through my JSON data file <a href=\"https:\/\/gist.githubusercontent.com\/shacheeswadia\/b0d6b34a1910359e0e1a8fc0c84019a6\/raw\/4ab92ca6361f1bc9875d2854e2e1271bc991f86b\/surfaceAreaData.json\" target=\"_blank\" rel=\"nofollow\">here<\/a>.<\/p>\n<p>To load the data from the JSON file, I will add the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#data_adapter\" target=\"_blank\" rel=\"nofollow\">Data Adapter<\/a> module of AnyChart and use the <code>loadJsonFile<\/code> method inside the <code>&lt;script&gt;<\/code> tag in the body of the HTML page.<\/p>\n<p>The three preparatory steps are done so get ready to write some code!<\/p>\n<h3>Step 4 \u2014 Write the code to draw the chart<\/h3>\n<p>The first thing I will do is ensure that all the code is executed only after the page is fully loaded. To do that, I will enclose the entire code within the <code>anychart.onDocumentReady()<\/code> function.<\/p>\n<p>Then, I will work with the data that is loaded from the JSON file. Even though I have already pre-processed the data, I will need to further process it for plotting the 3D surface chart. Basically, I will create an array that holds the y and z axes data according to the sequence of the x axis data.<\/p>\n<pre><code class=\"javascript\">anychart.onDocumentReady(function () {\r\n&nbsp;&nbsp;anychart.data.loadJsonFile(\r\n&nbsp;&nbsp;  'https:\/\/gist.githubusercontent.com\/shacheeswadia\/b0d6b34a1910359e0e1a8fc0c84019a6\/raw\/4ab92ca6361f1bc9875d2854e2e1271bc991f86b\/surfaceAreaData.json',\r\n&nbsp;&nbsp;  function (data) {\r\n      \/\/ processing of the data\r\n      var result = [];\r\n      for (var x = 0; x &lt; data.x.length; x++) {\r\n        for (var y = 0; y &lt; data.y.length; y++) {\r\n          result.push([x, data.y.sort()[y], data.z[x][y]]);\r\n        }\r\n      }\r\n    }\r\n  );\r\n});<\/code><\/pre>\n<p>Now, I will create the surface chart and set the markers based on the data array just created.<\/p>\n<p>Next, I will need to set the x axis labels from the loaded data because the array that I created contains only a sequence and not the country names. I will also specify the maximum for the x scale.<\/p>\n<pre><code class=\"javascript\">\/\/ create surface chart\r\nvar chart = anychart.surface();\r\n \r\n\/\/ enable markers and set data for them\r\nchart.markers().enabled(true).data(result);\r\n \r\n\/\/ set x axis labels format\r\nchart\r\n  .xAxis()\r\n  .labels()\r\n  .format(function () {\r\n    return data.x[Math.round(this.value)];\r\n  });.\r\n \r\n\/\/ set x axis scale maximum\r\nchart.xScale().maximum(data.x.length - 1);<\/code><\/pre>\n<p>I will now give my chart a title and a bit of padding on all the sides. Lastly, I will reference the <code>&lt;div&gt;<\/code> created in step one and draw the chart.<\/p>\n<pre><code class=\"javascript\">\/\/ set chart paddings\r\nchart.padding(25, 50, 75, 50);\r\n \r\n\/\/ set chart title\r\nchart.title('GDP per capita (PPP) in 2006-2020, in USD');\r\n \r\n\/\/ set container id for the chart\r\nchart.container('container');\r\n \r\n\/\/ initiate chart drawing\r\nchart.draw();<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-ylK75uzg\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/ylK75uzg\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-ylK75uzg{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>Voila! A basic functional 3D surface plot is ready!<\/p>\n<p>You can have a look at this basic version of a JavaScript 3D surface plot on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/xxLbBZa\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>, [or on <a href=\"https:\/\/playground.anychart.com\/ylK75uzg\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>], or check out the code right here.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&nbsp;&nbsp;&lt;head&gt;\r\n&nbsp;&nbsp;&lt;meta charset=\"utf-8\"&gt;\r\n&nbsp;&nbsp;&lt;title&gt;JavaScript Surface Chart&lt;\/title&gt;\r\n&nbsp;&nbsp;&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-surface.min.js\"&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;style type=\"text\/css\"&gt;   \r\n&nbsp;&nbsp;&nbsp;&nbsp;html, body, #container {\r\n&nbsp;&nbsp;&nbsp;&nbsp;  width: 100%; height: 100%; margin: 0; padding: 0;\r\n&nbsp;&nbsp;  }\r\n&nbsp;&nbsp;&lt;\/style&gt;\r\n&nbsp;&nbsp;&lt;\/head&gt;\r\n&nbsp;&nbsp;&lt;body&gt; \r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;script&gt;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;anychart.onDocumentReady(function () {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  anychart.data.loadJsonFile(\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    'https:\/\/gist.githubusercontent.com\/shacheeswadia\/b0d6b34a1910359e0e1a8fc0c84019a6\/raw\/4ab92ca6361f1bc9875d2854e2e1271bc991f86b\/surfaceAreaData.json',\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    function (data) {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ processing of the data\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      var result = [];\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      for (var x = 0; x &lt; data.x.length; x++) {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (var y = 0; y &lt; data.y.length; y++) {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          result.push([x, data.y.sort()[y], data.z[x][y]]);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      }\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ create surface chart\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      var chart = anychart.surface();\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ enable markers and set data for them\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart.markers().enabled(true).data(result);\r\n      \r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ set x axis labels format\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        .xAxis()\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        .labels()\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        .format(function () {\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          return data.x[Math.round(this.value)];\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        });\r\n    \r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ set x axis scale maximum\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart.xScale().maximum(data.x.length - 1);\r\n    \r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ set chart paddings\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart.padding(25, 50, 75, 50);\r\n    \r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ set chart title\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart.title('GDP per capita (PPP) in 2006-2020, in USD');\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ set container id for the chart\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart.container('container');\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      \/\/ initiate chart drawing\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      chart.draw();\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    }\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  );\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Customizing the JS Surface Chart<\/h2>\n<p>One of the best parts of using any JS charting library is that you need to write a very minimal amount of code to get a working version of the chart implemented. Moreover, most of the libraries provide options to customize the chart to make it more personalized and informative.<\/p>\n<p>Let me show you how to enhance the JS 3D surface chart to make it more intuitive and aesthetically better:<\/p>\n<h3>Step 1 \u2014 Improve the look and feel of all the axes<\/h3>\n<p>It might seem like small changes, but this is what I am going to do first. Modifying the look and feel of the axes makes the chart look distinctly better and easier to read.<\/p>\n<h4>Modify the basic settings of the axes<\/h4>\n<p>To emphasize the 3D effect of the surface plot, I will rotate the y and z axes 15 and 45 degrees respectively. This can be done very simply using the inbuilt rotation function.<\/p>\n<p>I will now set the maximum and minimum of the y axis as the start and end year to make the plotting look sharper.<\/p>\n<pre><code class=\"javascript\">\/\/ set y and z axes rotation\r\nchart.rotationY(15);\r\nchart.rotationZ(45);\r\n \r\n\/\/ set y scale minimum\/maximum\r\nchart.yScale().minimum(2006);\r\nchart.yScale().maximum(2020);<\/code><\/pre>\n<p>I will now enable minor ticks for x and y axes to showcase more ticks and consequently more labels. For uniformity in the ticks, I will set the interval to a fixed value for y and z axes.<\/p>\n<pre><code class=\"javascript\">\/\/ enable x and y axes minor ticks\r\nchart.xAxis().minorTicks().enabled(true);\r\nchart.xAxis().minorLabels().enabled(true);\r\nchart.yAxis().minorTicks().enabled(true);\r\nchart.yAxis().minorLabels().enabled(true);\r\n \r\n\/\/ set scales ticks intervals\r\nchart.yScale().ticks().interval(8);\r\nchart.zScale().ticks().interval(40000);<\/code><\/pre>\n<h4>Modify the labels of the axes<\/h4>\n<p>To avoid overlap with the x axis label, I will hide the last label in the y axis.<\/p>\n<p>Next, I will reduce the font size of the labels and minor labels (labels of the minor ticks) of all the axes.<\/p>\n<pre><code class=\"javascript\">\/\/ hide the last label in y axis\r\nchart.yAxis().drawLastLabel(false);\r\n \r\n\/\/ set x, y and z axes labels font size\r\nchart.xAxis().labels().fontSize(10);\r\nchart.xAxis().minorLabels().fontSize(10);\r\nchart.yAxis().labels().fontSize(10);\r\nchart.yAxis().minorLabels().fontSize(10);\r\nchart.zAxis().labels().fontSize(10);<\/code><\/pre>\n<p>Finally, in the label modification, I will rotate the x axis labels and minor labels to 90 degrees for a cleaner look.<\/p>\n<p>I will also need to set the x axis minor labels with the loaded data similar to what I did earlier for the x axis normal labels.<\/p>\n<pre><code class=\"javascript\">\/\/ set x axis labels rotation\r\nchart.xAxis().labels().rotation(90);\r\nchart.xAxis().minorLabels().rotation(90);\r\nchart\r\n  .xAxis()\r\n  .minorLabels()\r\n  .format(function () {\r\n    return data.x[Math.round(this.value)];\r\n  });<\/code><\/pre>\n<h4>Modify the stroke of the axes<\/h4>\n<p>By default, the surface chart uses three different colors to denote the 3 different axes. But I don\u2019t need that for my representation so I will change the stroke of all the axes along with the ticks to a light gray color.<\/p>\n<pre><code class=\"javascript\">\/\/ set x, y and z axes stroke settings\r\nchart.xAxis().stroke(null);\r\nchart.xAxis().ticks().stroke(\"1 lightgray\"); \r\nchart.xAxis().minorTicks().stroke(\"1 lightgray\"); \r\nchart.yAxis().stroke(null);\r\nchart.yAxis().ticks().stroke(\"1 lightgray\"); \r\nchart.yAxis().minorTicks().stroke(\"1 lightgray\");\r\nchart.zAxis().stroke(null);\r\nchart.zAxis().ticks().stroke(\"1 lightgray\"); \r\nchart.zAxis().minorTicks().stroke(\"1 lightgray\");<\/code><\/pre>\n<p>Check out here how this version with all the beautification of the axes looks like, and you can play around with it on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/eYEZyqP\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [or on <a href=\"https:\/\/playground.anychart.com\/xbTC6gE8\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>].<\/p>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-xbTC6gE8\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/xbTC6gE8\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-xbTC6gE8{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3>Step 2 \u2014 Add a color palette<\/h3>\n<p>A sure shot way of elevating your chart\u2019s appeal is to add a color palette based on the data you are showcasing. It is quite a straightforward process where I will first create a linear color scale with the colors that I want and then set that color scale for the chart.<\/p>\n<p>Along with adding the colors, I will also add a legend that will show what color indicates what value range, and this can be done in just one line of code.<\/p>\n<pre><code class=\"javascript\">\/\/ create color scale\r\nvar customColorScale = anychart.scales.linearColor();\r\ncustomColorScale.colors([\r\n  '#ffdd0e',\r\n  '#BCA600',\r\n  '#76A100',\r\n  '#1b8366',\r\n  '#007561'\r\n]);\r\n \r\n\/\/ set color scale\r\nchart.colorScale(customColorScale);\r\n \r\n\/\/ enable and configure color range\r\nchart.colorRange().enabled(true).orientation('right');<\/code><\/pre>\n<h3>Step 3 \u2014 Enhance the tooltip<\/h3>\n<p>When you are showcasing more data, it is always a good idea to have a useful tooltip. The default tooltip is not really informative so I will customize it to display the values of all the three parameters of each plotted point \u2014 country, year, and GDP figure.<\/p>\n<pre><code class=\"javascript\">\/\/ tooltip settings\r\nchart\r\n  .tooltip()\r\n  .useHtml(true)\r\n  .titleFormat(function () {\r\n    return data.x[this.x];\r\n  })\r\n  .format(function () {\r\n    return \"Year: \" + this.y + \"&lt;br&gt;\" + \"GDP:$ \" + this.z.toFixed(2);\r\n  });<\/code><\/pre>\n<p>Don\u2019t you think that this simple tooltip adds so much more value to the chart? See how cool and customized the JavaScript-based 3D surface chart looks now and you can find the entire code on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/GRvZxod\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [and on <a href=\"https:\/\/playground.anychart.com\/R1Mq06kP\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>].<\/p>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-Mbg400nu\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/R1Mq06kP\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-Mbg400nu{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h2>Conclusion<\/h2>\n<p>Isn\u2019t it amazing how such an exciting and complicated-looking 3D surface plot can be built quite easily? With JavaScript libraries, you can quickly create a simple, operative chart and then add as many features as you want to tweak your visualization.<\/p>\n<p>There are a lot of different types of data visualization available in the various <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">JS charting libraries<\/a> and you can look into the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Supported_Charts_Types\" target=\"_blank\" rel=\"nofollow\">chart type options<\/a> available in AnyChart, for example.<\/p>\n<p>Please ask any questions, give suggestions, or simply say hello. The sky is the limit for improving every country\u2019s GDP as well as creating great visualizations so start making some interesting and enlightening charts with this newly learned skillset!<\/p>\n<hr \/>\n<p><strong><em>Published with the permission of Shachee Swadia. Originally appeared on <a href=\"https:\/\/www.hongkiat.com\/blog\/creating-surface-chart-with-javascript\/\" target=\"_blank\" rel=\"nofollow\">Hongkiat<\/a> under the title <em>&#8220;How to Create Surface Chart with JavaScript (In 4 Easy Steps)&#8221;<\/em> on December 10, 2021.<\/em><\/strong><\/p>\n<hr \/>\n<p><strong><em>Find out more about surface charts on <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/surface-chart\/\">Chartopedia<\/a>, a free guide to chart types. Don&#8217;t miss other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JS charting tutorials<\/a>.<\/em><\/strong><\/p>\n<hr \/>\n<p><strong><em>Got an idea for a guest post? We look forward to hearing about it \u2014 <a href=\"https:\/\/www.anychart.com\/support\/\">let us know<\/a>!<\/p>\n<p><!-- SyntaxHighlighter --><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/default.min.css\"><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/atom-one-light.min.css\"><script src=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/highlight.min.js\"><\/script><script>hljs.initHighlightingOnLoad();<\/script><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Data visualization is a must-have skill today with ever-growing data and the need to analyze as well as present that data. You will definitely come across data charts whether you are in the technology industry or not and therefore, it is a good idea to learn how to build visualizations. I will show you here [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,263,23,13,279,4],"tags":[449,555,557,53,260,254,1758,284,127,166,258,471,266,620,1292,880,806,1759,54,1760,2757,256,1111,844,165,1370,774,2223,805,872,1698,1699,873,259,1762,3108,2013,2014,32,55,1335,144,2979,167,152,2949,36,907,141,249,81,57,1238,142,96,99,58,65,56,101,1937,2335,1938,459,556,30,172,1939,2015,2816,1763,804],"class_list":["post-14108","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-big-data","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-3d","tag-3d-charts","tag-3d-surface-plot","tag-anychart","tag-best-data-visualization-examples","tag-chart","tag-chart-design","tag-chart-examples","tag-chart-types","tag-charting","tag-charts","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-chart","tag-data-charting","tag-data-charts","tag-data-design","tag-data-visualization","tag-data-visualization-design","tag-data-visualization-development","tag-data-visualization-examples","tag-data-visualization-practice","tag-data-visualization-tutorial","tag-data-visualizations","tag-data-viz-examples","tag-dataviz-examples","tag-diagrams","tag-front-end-development","tag-gdp","tag-gdp-data","tag-gdp-data-visualization","tag-gdp-per-capita","tag-graphs","tag-guest-post","tag-hongkiat","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-infographic","tag-infographics","tag-information-graphics","tag-interactive-charts","tag-interactive-infographic","tag-interactive-infographics","tag-javascript","tag-javascript-chart-tutorial","tag-javascript-charting","tag-javascript-charting-api","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-graph","tag-javascript-graphics","tag-javascript-graphics-library","tag-javascript-library","tag-js-chart","tag-js-charting","tag-js-charts","tag-js-graphics","tag-json","tag-json-charts","tag-json-data-visualization","tag-statistics","tag-surface-chart","tag-tips-and-tricks","tag-tutorial","tag-visualizing-json-data","tag-web-charts","tag-web-design","tag-web-developers","tag-web-development","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Build Surface Chart Using JavaScript | AnyChart News<\/title>\n<meta name=\"description\" content=\"3D surface plots may look complex. But they&#039;re easy to build! Learn how to create a compelling surface chart in JavaScript visualizing 15 years of GDP data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build Surface Chart Using JavaScript\" \/>\n<meta property=\"og:description\" content=\"Learn how to quickly create a compelling, interactive 3D surface chart in JavaScript. Visualizing 15 years of GDP data along the tutorial.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"AnyChart News\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AnyCharts\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-15T12:10:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-13T11:08:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-social.png\" \/>\n<meta name=\"author\" content=\"Shachee Swadia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Build Surface Chart Using JavaScript\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to quickly create a compelling, interactive 3D surface chart in JavaScript. Visualizing 15 years of GDP data along the tutorial.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-social.png\" \/>\n<meta name=\"twitter:creator\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:site\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shachee Swadia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\"},\"author\":{\"name\":\"Shachee Swadia\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"headline\":\"How to Build Surface Chart Using JavaScript\",\"datePublished\":\"2021-12-15T12:10:49+00:00\",\"dateModified\":\"2022-08-13T11:08:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\"},\"wordCount\":1739,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png\",\"keywords\":[\"3D\",\"3D charts\",\"3D Surface Plot\",\"AnyChart\",\"best data visualization examples\",\"chart\",\"chart design\",\"chart examples\",\"chart types\",\"charting\",\"charts\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"data chart\",\"data charting\",\"data charts\",\"data design\",\"Data Visualization\",\"data visualization design\",\"data visualization development\",\"data visualization examples\",\"data visualization practice\",\"data visualization tutorial\",\"data visualizations\",\"data viz examples\",\"dataviz examples\",\"diagrams\",\"front-end development\",\"GDP\",\"GDP data\",\"GDP data visualization\",\"GDP per capita\",\"graphs\",\"guest post\",\"Hongkiat\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"infographic\",\"infographics\",\"information graphics\",\"interactive charts\",\"interactive infographic\",\"interactive infographics\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting library\",\"javascript charts\",\"javascript graph\",\"javascript graphics\",\"JavaScript graphics library\",\"JavaScript library\",\"js chart\",\"js charting\",\"js charts\",\"JS graphics\",\"JSON\",\"JSON charts\",\"JSON data visualization\",\"statistics\",\"Surface Chart\",\"Tips and tricks\",\"tutorial\",\"visualizing JSON data\",\"web charts\",\"web design\",\"web developers\",\"web development\"],\"articleSection\":[\"AnyChart Charting Component\",\"Big Data\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\",\"name\":\"How to Build Surface Chart Using JavaScript | AnyChart News\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png\",\"datePublished\":\"2021-12-15T12:10:49+00:00\",\"dateModified\":\"2022-08-13T11:08:54+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"description\":\"3D surface plots may look complex. But they're easy to build! Learn how to create a compelling surface chart in JavaScript visualizing 15 years of GDP data.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png\",\"width\":1695,\"height\":890},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Build Surface Chart Using JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\",\"url\":\"https:\/\/www.anychart.com\/blog\/\",\"name\":\"AnyChart News\",\"description\":\"AnyChart JS Charts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.anychart.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\",\"name\":\"Shachee Swadia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"caption\":\"Shachee Swadia\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Build Surface Chart Using JavaScript | AnyChart News","description":"3D surface plots may look complex. But they're easy to build! Learn how to create a compelling surface chart in JavaScript visualizing 15 years of GDP data.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Build Surface Chart Using JavaScript","og_description":"Learn how to quickly create a compelling, interactive 3D surface chart in JavaScript. Visualizing 15 years of GDP data along the tutorial.","og_url":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2021-12-15T12:10:49+00:00","article_modified_time":"2022-08-13T11:08:54+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-social.png","type":"","width":"","height":""}],"author":"Shachee Swadia","twitter_card":"summary_large_image","twitter_title":"How to Build Surface Chart Using JavaScript","twitter_description":"Learn how to quickly create a compelling, interactive 3D surface chart in JavaScript. Visualizing 15 years of GDP data along the tutorial.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js-social.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Shachee Swadia","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/"},"author":{"name":"Shachee Swadia","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"headline":"How to Build Surface Chart Using JavaScript","datePublished":"2021-12-15T12:10:49+00:00","dateModified":"2022-08-13T11:08:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/"},"wordCount":1739,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png","keywords":["3D","3D charts","3D Surface Plot","AnyChart","best data visualization examples","chart","chart design","chart examples","chart types","charting","charts","data analysis","data analytics","data analytics examples","data chart","data charting","data charts","data design","Data Visualization","data visualization design","data visualization development","data visualization examples","data visualization practice","data visualization tutorial","data visualizations","data viz examples","dataviz examples","diagrams","front-end development","GDP","GDP data","GDP data visualization","GDP per capita","graphs","guest post","Hongkiat","HTML","HTML charts","HTML5","html5 charts","infographic","infographics","information graphics","interactive charts","interactive infographic","interactive infographics","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting library","javascript charts","javascript graph","javascript graphics","JavaScript graphics library","JavaScript library","js chart","js charting","js charts","JS graphics","JSON","JSON charts","JSON data visualization","statistics","Surface Chart","Tips and tricks","tutorial","visualizing JSON data","web charts","web design","web developers","web development"],"articleSection":["AnyChart Charting Component","Big Data","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/","url":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/","name":"How to Build Surface Chart Using JavaScript | AnyChart News","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png","datePublished":"2021-12-15T12:10:49+00:00","dateModified":"2022-08-13T11:08:54+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"description":"3D surface plots may look complex. But they're easy to build! Learn how to create a compelling surface chart in JavaScript visualizing 15 years of GDP data.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/12\/surface-chart-js.png","width":1695,"height":890},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2021\/12\/15\/surface-chart-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Build Surface Chart Using JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.anychart.com\/blog\/#website","url":"https:\/\/www.anychart.com\/blog\/","name":"AnyChart News","description":"AnyChart JS Charts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.anychart.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51","name":"Shachee Swadia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","caption":"Shachee Swadia"},"url":"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/14108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=14108"}],"version-history":[{"count":21,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/14108\/revisions"}],"predecessor-version":[{"id":15516,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/14108\/revisions\/15516"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=14108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=14108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=14108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}