Contents
- Tooltip format
- Rtl
Having trouble getting help?
Contact Support
Contact Support
Localization in Angular Sparkline component
27 Apr 20243 minutes to read
The sparkline control supports localization. The default culture for localization is en-US
. You can change the culture using the setCulture
method.
Tooltip format
Sparkline tooltip supports localization. The following code sample shows tooltip text with currency format based on culture.
[app.component.ts
]
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SparklineModule, SparklineTooltipService } from '@syncfusion/ej2-angular-charts'
import { Component } from '@angular/core';
import { TooltipSettingsModel } from '@syncfusion/ej2-angular-charts';
@Component({
imports: [
SparklineModule
],
providers: [SparklineTooltipService],
standalone: true,
selector: 'app-container',
template: `<ejs-sparkline id='container' width='350px' height='200px' [containerArea]= 'containerArea' lineWidth= 3 format= 'c0' useGroupingSeparator= 'true' [padding]='padding' [dataSource]="data" fill= '#b2cfff' type="Area"
[tooltipSettings]="tooltipSettings">
</ejs-sparkline>`
})
export class AppComponent {
public data: object[] = [30000, 60000, 40000, 10000, 30000, 20000, 50000] as any;
public containerArea: object= {
border: { color: '#033e96', width: 2 }
};
public tooltipSettings: object= {
visible: true
};
public padding: object = { left: 20, right: 20, bottom: 20, top: 20};
public border: object = { color: '#033e96', width: 2 };
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Rtl
If you set the enableRtl
property to true, then the sparkline will be rendered from rigt-to-left direction.
The following example shows the sparkline is render from “Right-to-left”.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SparklineModule, SparklineTooltipService } from '@syncfusion/ej2-angular-charts'
import { Component } from '@angular/core';
import { TooltipSettingsModel } from '@syncfusion/ej2-angular-charts';
@Component({
imports: [
SparklineModule
],
providers: [SparklineTooltipService],
standalone: true,
selector: 'app-container',
template: `<ejs-sparkline id='container' width='150px' height='150px' [dataSource]="data" enableRtl= true
>
</ejs-sparkline>`
})
export class AppComponent {
public data: object[] = [0, 6, 4, 1, 3, 2, 5] as any;
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));