Sparkline Customization

29 Nov 20173 minutes to read

This section explains you the customization options available to make changes in the Sparkline for getting better appearance.

Sparkline background

You can specify the background color for the Sparkline using background property. When you don’t specify the background, it takes “transparent” as background color.

  • HTML
  • <ej-sparkline id="spark" background="blue">          
                                   
    </ej-sparkline>

    Stroke color and width

    You can customize the series border color and width using strokeand width. This is applicable for Sparkline types line and area.

  • HTML
  • <ej-sparkline id="spark" stroke="blue" [width]="2">          
                                   
    </ej-sparkline>

    Sparkline border

    You can customize the border width and height of the Sparkline using border width and border heightproperties. This is applicable for column, win-loss and pie series.

  • HTML
  • <ej-sparkline id="spark" stroke="blue" [width]="3">          
                                   
    </ej-sparkline>

    Opacity

    By default opacityof the Sparkline is 1. You can specify the opacity value from 0 to 1. This is applicable for all types of series.

  • HTML
  • <ej-sparkline id="spark">          
    
    <e-border [width]="50" [height]="10"> </e-border>
                                   
    </ej-sparkline>

    Localization

    Sparkline is having support for localization as well. Default culture is “en-US”. You can modify the culture using the property locale.

  • HTML
  • <ej-sparkline id="spark" [opacity]="0.5">          
                                   
    </ej-sparkline>

    Padding for Sparkline

    Padding is used to specify the padding value between the container and Sparkline. By default padding value of the Sparkline is 5.

  • HTML
  • <ej-sparkline id="spark" [padding]="2">          
                                   
    </ej-sparkline>

    Canvas support

    You can control whether Sparkline has to be rendered as SVG or Canvas. Canvas rendering supports all the functionalities supported in SVG rendering.

  • HTML
  • <ej-sparkline id="spark" enableCanvasRendering="true">          
                                   
    </ej-sparkline>

    Themes

    You can specify different themes for Sparkline control.

  • HTML
  • <ej-sparkline id="spark" theme="saffaron">          
                                   
    </ej-sparkline>