Search results

Internationalization in JavaScript Linear Gauge control

08 May 2023 / 1 minute to read

Globalization is the process of designing and developing a component that works in different cultures. Internationalization is used to globalize the number content in Linear Gauge component using format property in Linear Gauge component. It has static text on some features such as

  • Axis label
  • Tooltip

The static text on above features can be changed to any culture such as Arabic, Deutsch and French. To know more about the globalization in JavaScript components, refer here

Numeric Format

The text in axis labels and tooltip can be displayed in the numeric format such as currency, percentage and so on. To know more about the numeric formats in axis labels, refer here. In the below example, the axis label is displayed in the currency format.

Source
Preview
index.ts
index.html
Copied to clipboard
import { LinearGauge } from '@syncfusion/ej2-lineargauge';
import { loadCldr, setCulture, Ajax, setCurrencyCode } from '@syncfusion/ej2-base';
setCulture("de");
setCurrencyCode('EUR');
let gauge: LinearGauge = new LinearGauge({
locale: "de",
format:'c',
axes: [{
  labelStyle: {
    font: {
      color: 'red'
    }
  }
}]
}, '#element');
Copied to clipboard
<!DOCTYPE html>
<html lang="en">

<head>
            
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <link href="//cdn.syncfusion.com/ej2/21.2.3/ej2-popups/styles/material.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>