Sparkline Customization

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>