Articles in this section
Category / Section

How to customize the JavaScript Chart size?

1 min read

You can customize the width and height of the JavaScript Chart by using size property of Chart. It has options to specify width and height of the chart. You can also specify chart dimensions in percentage. Refer to Chart Dimensions for more information about different units to specify chart size. The following code example explains how to customize the width and height of the Chart.

JS

$("#container").ejChart({
    size: {
        width: '500',
        height: '500'
    }
});

 

The following screenshot displays the Chart in specified size.

Customization of the chart size

Figure: Chart with dimensions 500 X 500

JS Playground sample link: Chart Size


Conclusion

I hope you enjoyed learning about how to customize the JavaScript Chart size.

You can refer to our JavaScript Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Chart example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (2)
Please  to leave a comment
GC
Grant Clark
Hi there, In this example, the width and height are both set to 500 pixels. However the image width="493" and height="476", and there is still padding inside the image. I understand this is just a screen image snip, but is it possible to get rid of the padding in the first svg container when the chart renders, so that the drawn areas of the chart are exactly the width and height specified? Thanks!
AT
Anandaraj T
Hi Grant, Link to the sample used for taking the screenshot is attached below the image. In that link, you can see that the SVG container takes 500 pixel width and height as specified by inspecting the DOM. By default, there is a padding of 10 pixel inside the SVG container. This can be customized using the margin option in Chart. Margin option has left, right, top and bottom properties to specify the padding between SVG container and left, right, top and bottom sides respectively. Sample for customizing the margin is available in the following JS Playground link http://jsplayground.syncfusion.com/mkpvygh0 Regards, Anandaraj
GC
Grant Clark
Thats great help Anadaraj, thanks very much!
Access denied
Access denied