Sparkline Dimensions

You can set the size directly on the Sparkline or to the container of the sparkline. When you do not specify the size, it takes 30px as the height and 50px as its width, by default.

Set size for the container

You can customize the Sparkline dimension by setting the width and height for the container element.

  • html
  • <html xmlns="http://www.w3.org/1999/xhtml" lang="en" ng-app="SparklineApp">
        <head>
            <title>Essential Studio for AngularJS: Sparkline</title>
            <!--CSS and Script file References -->
        </head>
      <body ng-controller="SparkCtrl">
        <div id="container" style="width:820px;height:500px;" >
        <ej-sparkline></ej-sparkline>
        </div>
        <script>
        angular.module('SparkApp', ['ejangular'])
        .controller('SparkCtrl', function ($scope) {
                       });
        </script>
    </body>
    </html>

    Set size in pixels

    You can also set the e-width and e-height of Sparkline by using the e-size property of the Sparkline.

  • html
  • <html xmlns="http://www.w3.org/1999/xhtml" lang="en" ng-app="SparklineApp">
        <head>
            <title>Essential Studio for AngularJS: Sparkline</title>
            <!--CSS and Script file References -->
        </head>
      <body ng-controller="SparkCtrl">
        <div id="container" >
        <ej-sparkline e-size-height="40px" e-size-width="60px"></ej-sparkline>
        </div>
        <script>
        angular.module('SparkApp', ['ejangular'])
        .controller('SparkCtrl', function ($scope) {
                   });
        </script>
    </body>
    </html>

    Responsive Sparkline

    To resize the Sparkline when the browser or the sparkline container is resized, set the e-isResponsive property to true, where the sparkline adapts to the changes in size of the container.

  • html
  • <html xmlns="http://www.w3.org/1999/xhtml" lang="en" ng-app="SparklineApp">
        <head>
            <title>Essential Studio for AngularJS: Sparkline</title>
            <!--CSS and Script file References -->
        </head>
      <body ng-controller="SparkCtrl">
        <div id="container" >
        <ej-sparkline e-isresponsive="true"></ej-sparkline>
        </div>
        <script>
        angular.module('SparkApp', ['ejangular'])
        .controller('SparkCtrl', function ($scope) {
                    });
        </script>
    </body>
    </html>