{"id":17619,"date":"2024-10-17T10:32:41","date_gmt":"2024-10-17T10:32:41","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=17619"},"modified":"2024-10-17T10:32:41","modified_gmt":"2024-10-17T10:32:41","slug":"height-width-chart-js","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/","title":{"rendered":"3 Ways to Set Height and Width of JavaScript Charts \u2014 JS Chart Tips"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png\" alt=\"JavaScript chart with custom width and height, showing code\" width=\"100%\" class=\"alignnone size-full wp-image-18280\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png 1336w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height-300x159.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height-768x408.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height-1024x544.png 1024w\" sizes=\"(max-width: 1336px) 100vw, 1336px\" \/><\/a>Navigating chart dimensions is key in crafting user-friendly visual presentations, especially when integrating multiple charts into an existing web page or app screen. In our <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\" target=\"_blank\">JavaScript chart tutorials<\/a>, charts are usually showcased as stretching across an entire web page. But it&#8217;s far from rocket science to make them smaller. In today\u2019s <a href=\"https:\/\/www.anychart.com\/blog\/category\/js-chart-tips\/\" target=\"_blank\">JS Chart Tips<\/a>, we explore three effective ways to resize your charts by adjusting their width and height.<\/p>\n<p><!--more--><\/p>\n<h2>Question: How to Set Chart Height and Width?<\/h2>\n<p>Our\u00a0<a href=\"https:\/\/www.anychart.com\/support\/\" target=\"_blank\">Support Team<\/a>\u00a0often\u00a0gets inquiries about configuring custom chart sizes in various situations. The most recent question received via live chat was quite general: <em>\u201cHow do I change the height of the chart?\u201d<\/em> No additional details or images were provided, so we addressed it as a general case, assuming it might look\u00a0as shown below, and offered several possible solutions with relevant examples\u00a0right away.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/sketch-of-js-chart-with-custom-width-and-height.png\" alt=\"A sketch of a chart with custom height and width settings\" width=\"65%\" class=\"alignnone size-full wp-image-18281\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/sketch-of-js-chart-with-custom-width-and-height.png 3300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/sketch-of-js-chart-with-custom-width-and-height-300x173.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/sketch-of-js-chart-with-custom-width-and-height-768x442.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/sketch-of-js-chart-with-custom-width-and-height-1024x590.png 1024w\" sizes=\"(max-width: 3300px) 100vw, 3300px\" \/><\/p>\n<p>Following our\u00a0response, we decided\u00a0to highlight the approaches we covered, which boil down to three main options, depending on particular needs:<\/p>\n<ol>\n<li>Utilizing the JavaScript API<\/li>\n<li>Configuring through JSON<\/li>\n<li>Applying CSS styles<\/li>\n<\/ol>\n<p>Each approach provides the necessary control and flexibility to ensure your charts fit perfectly within their designated spaces. Join us as we break down these techniques to help you optimize your charting setups.<\/p>\n<h2>Solution\u00a01: Configuring\u00a0Height\/Width in JavaScript API<\/h2>\n<h3>Overview<\/h3>\n<p>You can\u00a0specify the required height or width\u00a0of your JavaScript chart using the <code>height()<\/code> and <code>width()<\/code> methods\u00a0right inside the chart&#8217;s JS code.<\/p>\n<h3>In Detail<\/h3>\n<p>For instance, add the following line of code\u00a0to set the\u00a0height of your JS chart\u00a0as 50% with the help of the corresponding methods from the JavaScript API:<\/p>\n<pre><code class=\"javascript\">chart.height(\"50%\");\r\n<\/code><\/pre>\n<p>To configure the width, act exactly the same way with the appropriate method:<\/p>\n<pre><code class=\"javascript\">chart.width(\"50%\");\r\n<\/code><\/pre>\n<p>For more information, see these methods in our API reference:<\/p>\n<ul>\n<li><a href=\"https:\/\/api.anychart.com\/anychart.charts.Cartesian#height\" target=\"_blank\" rel=\"nofollow\">Height | AnyChart JS API Reference<\/a><\/li>\n<li><a href=\"https:\/\/api.anychart.com\/anychart.charts.Cartesian#width\" target=\"_blank\" rel=\"nofollow\">Width | AnyChart JS API Reference<\/a><\/li>\n<\/ul>\n<h3>Example<\/h3>\n<p>Check out\u00a0an example of a chart where the height and width settings are specified using the JavaScript API:<\/p>\n<ul>\n<li><a href=\"https:\/\/playground.anychart.com\/aQmufkcN\" target=\"_blank\" rel=\"nofollow\">JS\u00a0Column Chart with Height and Width Set in JS API<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/playground.anychart.com\/aQmufkcN\" target=\"_blank\" rel=\"nofollow\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JS-API.png\" alt=\"JS Chart with Height and Width Set in JS API\" width=\"100%\" class=\"alignnone size-full wp-image-17945\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JS-API.png 2048w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JS-API-300x188.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JS-API-768x480.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JS-API-1024x640.png 1024w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<h2>Solution 2:\u00a0Configuring Height\/Width in JSON<\/h2>\n<h3>Overview<\/h3>\n<p>If your chart&#8217;s configuration is in <a href=\"https:\/\/docs.anychart.com\/Working_with_Data\/Data_From_JSON\" target=\"_blank\" rel=\"nofollow\">JSON<\/a> format,\u00a0you\u00a0likely already know that the name of every object in JSON\u00a0corresponds to the name of a method or parameter in JavaScript. Height and width settings are no exception.<\/p>\n<h3>In Detail<\/h3>\n<p>Here&#8217;s how you can add the height setting to your JSON configuration:<\/p>\n<pre><code class=\"json\">\"height\": \"50%\",\r\n<\/code><\/pre>\n<p>Feel free to set the chart width identically:<\/p>\n<pre><code class=\"json\">\"width\": \"50%\",<\/code><\/pre>\n<p>The entire JSON chart configuration with both settings described above can look\u00a0as follows:<\/p>\n<pre><code class=\"javascript\">\/\/ configure json data\r\nvar json = {\r\n  \/\/ configure the chart\r\n  \"chart\": {\r\n    \/\/ set the column chart type\r\n    \"type\": \"column\",\r\n    \/\/ set the chart height\r\n    \"height\": \"50%\",\r\n    \"width\": \"50%\",\r\n    \/\/ set the chart data\r\n    \"series\": [{\r\n      \"data\": [\r\n        {x: \"Q1\", value: 8},\r\n        {x: \"Q2\", value: 12},\r\n        {x: \"Q3\", value: 18},\r\n        {x: \"Q4\", value: 11}\r\n      ],\r\n    }],\r\n    \/\/ set the chart container\r\n    \"container\": \"container\"\r\n  }\r\n};<\/code><\/pre>\n<h3>Example<\/h3>\n<p>Check out an example of a chart where the height and width settings are defined in\u00a0JSON configuration:<\/p>\n<ul>\n<li><a href=\"https:\/\/playground.anychart.com\/oqvNsm4U\" target=\"_blank\" rel=\"nofollow\">JS\u00a0Column Chart with Height and Width Set in JSON<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/playground.anychart.com\/oqvNsm4U\" target=\"_blank\" rel=\"nofollow\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JSON.png\" alt=\"JS Chart with Height and Width Set in JSON\" width=\"100%\" class=\"alignnone size-full wp-image-17944\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JSON.png 2048w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JSON-300x188.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JSON-768x480.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-JSON-1024x640.png 1024w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<h2>Solution 3: Configuring Height\/Width in CSS Rules<\/h2>\n<h3>Overview<\/h3>\n<p>Alternatively, you can specify\u00a0the required width or height by adjusting the CSS rules of\u00a0the\u00a0block-level HTML element used\u00a0as the container\u00a0for your JavaScript-based chart.<\/p>\n<h3>In Detail<\/h3>\n<p>To\u00a0set the desired height in CSS, use the <code>height<\/code> property. Likewise,\u00a0configure the width with the help of <code>width<\/code>.<\/p>\n<p>For instance, here&#8217;s how you can\u00a0specify\u00a0both custom height and weight:<\/p>\n<pre><code class=\"css\">#container {\r\n  height: 50%;\r\n  width: 50%;\r\n}<\/code><\/pre>\n<h3>Example<\/h3>\n<p>Check out\u00a0an example of a chart where the height and width are set in the CSS rules:<\/p>\n<ul>\n<li><a href=\"https:\/\/playground.anychart.com\/tP7toQoT\" target=\"_blank\" rel=\"nofollow\">JS\u00a0Column Chart with Height and Width Set in CSS<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/playground.anychart.com\/tP7toQoT\" target=\"_blank\" rel=\"nofollow\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-CSS.png\" alt=\"JS Chart with Height and Width Set in CSS\" width=\"100%\" class=\"alignnone size-full wp-image-17943\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-CSS.png 2048w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-CSS-300x188.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-CSS-768x480.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/08\/JS-Column-Chart-with-Height-and-Width-Set-in-CSS-1024x640.png 1024w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<h2>Further Learning<\/h2>\n<p>These methods for controlling your chart\u2019s size should work well in most situations. However, we understand that specific cases, like embedding charts in <a href=\"https:\/\/www.anychart.com\/solutions\/\" target=\"_blank\">dashboards<\/a>, might require a different approach. If you find yourself in such a situation, feel free to explore our documentation on creating dashboards. This will guide you through more advanced scenarios while ensuring everything remains straightforward:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.anychart.com\/Dashboards\" target=\"_blank\" rel=\"nofollow\">Dashboards | AnyChart JS Documentation<\/a><\/li>\n<\/ul>\n<h2>Wrapping Up<\/h2>\n<p>Need help or have questions? Simply comment right here below\u00a0or\u00a0ask our <a href=\"https:\/\/www.anychart.com\/support\/\" target=\"_blank\">Support Team<\/a>\u00a0directly.<\/p>\n<p>Stay tuned for\u00a0the\u00a0<a href=\"https:\/\/www.anychart.com\/blog\/category\/js-chart-tips\" target=\"_blank\">JavaScript Chart Tips<\/a> series on our blog as we&#8217;ll continue to share valuable tips and tricks\u00a0inspired by recent support cases from our customers.<\/p>\n<p><strong>Enjoy your journey with\u00a0JavaScript charting!<\/strong><\/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>Navigating chart dimensions is key in crafting user-friendly visual presentations, especially when integrating multiple charts into an existing web page or app screen. In our JavaScript chart tutorials, charts are usually showcased as stretching across an entire web page. But it&#8217;s far from rocket science to make them smaller. In today\u2019s JS Chart Tips, we [&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":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7,23,13,3780,4],"tags":[2033,53,3840,4053,4102,3935,289,4122,70,71,254,3819,3149,4127,284,4129,127,4130,166,4104,3942,3971,258,4109,4110,4111,4112,2749,290,85,4113,3956,3833,292,4114,156,3818,4042,1292,880,806,3352,509,3845,2838,54,1760,2757,256,4121,350,4120,3032,3978,844,743,133,3369,4115,4116,4105,2032,4103,4106,805,4117,3820,3772,2013,2014,32,55,167,4085,4084,146,433,152,2949,4090,3749,151,4089,36,3925,141,249,3111,81,3931,57,4107,3939,169,170,1238,142,96,99,4108,3947,3586,4054,58,3832,65,56,3929,101,3526,1937,2335,1938,4124,4118,304,4123,4125,3630,4119,4126,30,2665,172,293,745,1939,4132,3494,2015,2816,1763,804,3599,3600,4131,3406,3407,4128],"class_list":["post-17619","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-dashboards","category-html5","category-javascript","category-js-chart-tips","category-tips-and-tricks","tag-annotations","tag-anychart","tag-anychart-api","tag-anychart-js-api-reference","tag-anychart-playground","tag-anychart-tutorial","tag-api","tag-appearance","tag-bar-chart","tag-bar-charts","tag-chart","tag-chart-customization","tag-chart-development","tag-chart-dimensions","tag-chart-examples","tag-chart-height","tag-chart-types","tag-chart-width","tag-charting","tag-charting-features","tag-charting-library","tag-charting-software","tag-charts","tag-code","tag-code-examples","tag-code-samples","tag-code-snippets","tag-codebase","tag-column-chart","tag-column-charts","tag-configure","tag-css","tag-custom-data-visualization","tag-custom-drawing","tag-customer-support","tag-customizability","tag-customization","tag-customizing-charts","tag-data-chart","tag-data-charting","tag-data-charts","tag-data-graphic","tag-data-graphics","tag-data-presentation-tips","tag-data-visualisation","tag-data-visualization","tag-data-visualization-design","tag-data-visualization-development","tag-data-visualization-examples","tag-data-visualization-library","tag-data-visualization-projects","tag-data-visualization-software","tag-data-visualization-technologies","tag-data-visualization-tools","tag-data-visualization-tutorial","tag-data-viz","tag-dataviz","tag-developers","tag-development","tag-documentation","tag-drawing","tag-drawing-tools","tag-drawing-tools-and-annotations","tag-examples","tag-front-end-development","tag-functions","tag-gantt-chart-customization","tag-height","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-interactive-charts","tag-interactive-data","tag-interactive-data-chart","tag-interactive-data-visualization","tag-interactive-graphics","tag-interactive-infographic","tag-interactive-infographics","tag-interactive-project","tag-interactive-visualization","tag-interactive-visualizations","tag-interactive-web-charts","tag-javascript","tag-javascript-chart-customization","tag-javascript-charting","tag-javascript-charting-api","tag-javascript-charting-features","tag-javascript-charting-library","tag-javascript-charting-tutorial","tag-javascript-charts","tag-javascript-code","tag-javascript-data-visualization","tag-javascript-drawing","tag-javascript-drawing-library","tag-javascript-graph","tag-javascript-graphics","tag-javascript-graphics-library","tag-javascript-library","tag-javascript-tutorial","tag-javascript-visualization-tutorial","tag-js","tag-js-api-reference","tag-js-chart","tag-js-chart-tips","tag-js-charting","tag-js-charts","tag-js-data-visualizations","tag-js-graphics","tag-js-library","tag-json","tag-json-charts","tag-json-data-visualization","tag-learning","tag-methods","tag-programming","tag-sample-code","tag-shapes","tag-software-development","tag-support-team","tag-text-markers","tag-tips-and-tricks","tag-triangles","tag-tutorial","tag-visualization","tag-visualization-techniques","tag-visualizing-json-data","tag-web-app","tag-web-chart","tag-web-charts","tag-web-design","tag-web-developers","tag-web-development","tag-web-page","tag-web-project","tag-webpage","tag-website","tag-website-development","tag-width","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>3 Ways to Set Height &amp; Width of JavaScript Charts | JS Chart Tips<\/title>\n<meta name=\"description\" content=\"Learn three ways to set the width &amp; height of a JavaScript chart: using JS API, JSON configuration, and CSS styles. Optimize your chart dimensions easily.\" \/>\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\/2024\/10\/17\/height-width-chart-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting Height &amp; Width of JS Charts | JavaScript Chart Tips\" \/>\n<meta property=\"og:description\" content=\"Learn 3 simple ways to set the width &amp; height of a JavaScript chart: using JS API, JSON configuration, and CSS styles.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/\" \/>\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=\"2024-10-17T10:32:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png\" \/>\n<meta name=\"author\" content=\"AnyChart Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Setting Height &amp; Width of JS Charts | JavaScript Chart Tips\" \/>\n<meta name=\"twitter:description\" content=\"Learn 3 simple ways to set the width &amp; height of a JavaScript chart: using JS API, JSON configuration, and CSS styles.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.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=\"AnyChart Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/\"},\"author\":{\"name\":\"AnyChart Team\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/2470e26e58231357db6d9993ecd6461b\"},\"headline\":\"3 Ways to Set Height and Width of JavaScript Charts \u2014 JS Chart Tips\",\"datePublished\":\"2024-10-17T10:32:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/\"},\"wordCount\":675,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png\",\"keywords\":[\"annotations\",\"AnyChart\",\"AnyChart API\",\"AnyChart JS API Reference\",\"AnyChart Playground\",\"AnyChart tutorial\",\"api\",\"appearance\",\"bar chart\",\"bar charts\",\"chart\",\"chart customization\",\"chart development\",\"chart dimensions\",\"chart examples\",\"chart height\",\"chart types\",\"chart width\",\"charting\",\"charting features\",\"charting library\",\"charting software\",\"charts\",\"code\",\"code examples\",\"code samples\",\"code snippets\",\"codebase\",\"column chart\",\"column charts\",\"configure\",\"CSS\",\"custom data visualization\",\"custom drawing\",\"customer support\",\"Customizability\",\"customization\",\"customizing charts\",\"data chart\",\"data charting\",\"data charts\",\"data graphic\",\"data graphics\",\"data presentation tips\",\"data visualisation\",\"Data Visualization\",\"data visualization design\",\"data visualization development\",\"data visualization examples\",\"data visualization library\",\"data visualization projects\",\"data visualization software\",\"data visualization technologies\",\"data visualization tools\",\"data visualization tutorial\",\"data-viz\",\"dataviz\",\"developers\",\"development\",\"documentation\",\"drawing\",\"drawing tools\",\"drawing tools and annotations\",\"examples\",\"front-end development\",\"functions\",\"Gantt chart customization\",\"height\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"interactive charts\",\"interactive data\",\"interactive data chart\",\"interactive data visualization\",\"interactive graphics\",\"interactive infographic\",\"interactive infographics\",\"interactive project\",\"interactive visualization\",\"interactive visualizations\",\"interactive web charts\",\"JavaScript\",\"JavaScript chart customization\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting features\",\"JavaScript charting library\",\"JavaScript charting tutorial\",\"javascript charts\",\"JavaScript code\",\"JavaScript data visualization\",\"javascript drawing\",\"javascript drawing library\",\"javascript graph\",\"javascript graphics\",\"JavaScript graphics library\",\"JavaScript library\",\"JavaScript tutorial\",\"JavaScript visualization tutorial\",\"js\",\"JS API Reference\",\"js chart\",\"JS chart tips\",\"js charting\",\"js charts\",\"js data visualizations\",\"JS graphics\",\"js library\",\"JSON\",\"JSON charts\",\"JSON data visualization\",\"learning\",\"methods\",\"programming\",\"sample code\",\"shapes\",\"software development\",\"support team\",\"text markers\",\"Tips and tricks\",\"triangles\",\"tutorial\",\"visualization\",\"visualization techniques\",\"visualizing JSON data\",\"web app\",\"web chart\",\"web charts\",\"web design\",\"web developers\",\"web development\",\"web page\",\"web project\",\"webpage\",\"website\",\"website development\",\"width\"],\"articleSection\":[\"AnyChart Charting Component\",\"Dashboards\",\"HTML5\",\"JavaScript\",\"JS Chart Tips\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/\",\"name\":\"3 Ways to Set Height & Width of JavaScript Charts | JS Chart Tips\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png\",\"datePublished\":\"2024-10-17T10:32:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/2470e26e58231357db6d9993ecd6461b\"},\"description\":\"Learn three ways to set the width & height of a JavaScript chart: using JS API, JSON configuration, and CSS styles. Optimize your chart dimensions easily.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png\",\"width\":1336,\"height\":710},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"3 Ways to Set Height and Width of JavaScript Charts \u2014 JS Chart Tips\"}]},{\"@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\/2470e26e58231357db6d9993ecd6461b\",\"name\":\"AnyChart Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4faeb24a1b553a1b071b765bfad138c00441a955b3a631c7564624ceeafdf884?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4faeb24a1b553a1b071b765bfad138c00441a955b3a631c7564624ceeafdf884?s=96&r=g\",\"caption\":\"AnyChart Team\"},\"sameAs\":[\"https:\/\/www.anychart.com\"],\"url\":\"https:\/\/www.anychart.com\/blog\/author\/andrey-khachaturov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"3 Ways to Set Height & Width of JavaScript Charts | JS Chart Tips","description":"Learn three ways to set the width & height of a JavaScript chart: using JS API, JSON configuration, and CSS styles. Optimize your chart dimensions easily.","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\/2024\/10\/17\/height-width-chart-js\/","og_locale":"en_US","og_type":"article","og_title":"Setting Height & Width of JS Charts | JavaScript Chart Tips","og_description":"Learn 3 simple ways to set the width & height of a JavaScript chart: using JS API, JSON configuration, and CSS styles.","og_url":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2024-10-17T10:32:41+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png","type":"","width":"","height":""}],"author":"AnyChart Team","twitter_card":"summary_large_image","twitter_title":"Setting Height & Width of JS Charts | JavaScript Chart Tips","twitter_description":"Learn 3 simple ways to set the width & height of a JavaScript chart: using JS API, JSON configuration, and CSS styles.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"AnyChart Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/"},"author":{"name":"AnyChart Team","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/2470e26e58231357db6d9993ecd6461b"},"headline":"3 Ways to Set Height and Width of JavaScript Charts \u2014 JS Chart Tips","datePublished":"2024-10-17T10:32:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/"},"wordCount":675,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png","keywords":["annotations","AnyChart","AnyChart API","AnyChart JS API Reference","AnyChart Playground","AnyChart tutorial","api","appearance","bar chart","bar charts","chart","chart customization","chart development","chart dimensions","chart examples","chart height","chart types","chart width","charting","charting features","charting library","charting software","charts","code","code examples","code samples","code snippets","codebase","column chart","column charts","configure","CSS","custom data visualization","custom drawing","customer support","Customizability","customization","customizing charts","data chart","data charting","data charts","data graphic","data graphics","data presentation tips","data visualisation","Data Visualization","data visualization design","data visualization development","data visualization examples","data visualization library","data visualization projects","data visualization software","data visualization technologies","data visualization tools","data visualization tutorial","data-viz","dataviz","developers","development","documentation","drawing","drawing tools","drawing tools and annotations","examples","front-end development","functions","Gantt chart customization","height","HTML","HTML charts","HTML5","html5 charts","interactive charts","interactive data","interactive data chart","interactive data visualization","interactive graphics","interactive infographic","interactive infographics","interactive project","interactive visualization","interactive visualizations","interactive web charts","JavaScript","JavaScript chart customization","javascript charting","javascript charting api","JavaScript charting features","JavaScript charting library","JavaScript charting tutorial","javascript charts","JavaScript code","JavaScript data visualization","javascript drawing","javascript drawing library","javascript graph","javascript graphics","JavaScript graphics library","JavaScript library","JavaScript tutorial","JavaScript visualization tutorial","js","JS API Reference","js chart","JS chart tips","js charting","js charts","js data visualizations","JS graphics","js library","JSON","JSON charts","JSON data visualization","learning","methods","programming","sample code","shapes","software development","support team","text markers","Tips and tricks","triangles","tutorial","visualization","visualization techniques","visualizing JSON data","web app","web chart","web charts","web design","web developers","web development","web page","web project","webpage","website","website development","width"],"articleSection":["AnyChart Charting Component","Dashboards","HTML5","JavaScript","JS Chart Tips","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/","url":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/","name":"3 Ways to Set Height & Width of JavaScript Charts | JS Chart Tips","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png","datePublished":"2024-10-17T10:32:41+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/2470e26e58231357db6d9993ecd6461b"},"description":"Learn three ways to set the width & height of a JavaScript chart: using JS API, JSON configuration, and CSS styles. Optimize your chart dimensions easily.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2024\/10\/javascript-chart-width-height.png","width":1336,"height":710},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2024\/10\/17\/height-width-chart-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"3 Ways to Set Height and Width of JavaScript Charts \u2014 JS Chart Tips"}]},{"@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\/2470e26e58231357db6d9993ecd6461b","name":"AnyChart Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4faeb24a1b553a1b071b765bfad138c00441a955b3a631c7564624ceeafdf884?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4faeb24a1b553a1b071b765bfad138c00441a955b3a631c7564624ceeafdf884?s=96&r=g","caption":"AnyChart Team"},"sameAs":["https:\/\/www.anychart.com"],"url":"https:\/\/www.anychart.com\/blog\/author\/andrey-khachaturov\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/17619","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\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=17619"}],"version-history":[{"count":37,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/17619\/revisions"}],"predecessor-version":[{"id":18334,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/17619\/revisions\/18334"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=17619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=17619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=17619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}