Pull down to refresh...
Release to refresh...
Refreshing...
-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
- Overview
-
Action Sheet
-
Button
- Floating Action Button
- Drop Down Button
-
Context Menu
-
List
-
Lookup
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Related Demos:
Your search did not match any results.
Loading...
JavaScript/jQuery Gauges - Title and Center Label Customization
This demo shows how to specify a CircularGauge title and display custom labels in the component's center.
A CircularGauge title usually informs users about the nature of gauge data. To customize it, use the properties of the title configuration object:
-
Location
Use the horizontalAlignment and verticalAlignment properties to place a title on any side of your gauge. -
Font Settings
Use the font configuration object.
You can display a custom label in the center of a CircularGauge. Use the centerTemplate property. Render template content as an SVG element.
Was this demo helpful?
Feel free to share demo-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Backend API
x
$(() => {
$('#gauge').dxCircularGauge({
scale: {
startValue: 0,
endValue: 10,
tickInterval: 1,
minorTick: { visible: true },
},
export: {
enabled: true,
},
rangeContainer: {
backgroundColor: '#03a9f4',
},
valueIndicator: {
color: '#03a9f4',
},
value: 7.78,
title: {
text: 'Gold Production (in Kilograms)',
verticalAlignment: 'bottom',
font: {
size: 25,
},
margin: {
top: 25,
},
},
centerTemplate: (gauge, container) => {
const topGroup = createGroup(50, 0);
const bottomGroup = createGroup(43, 140);
const baseRect = createRect(200, 200, 'transparent', 0);
const topRect = createRect(100, 70, '#f2f2f2', 8);
const bottomRect = createRect(114, 56, '#fff', 8);
const valueText = createText(50, 27, 20, 'middle', 30, gauge.value(), 'kg');
const bottomText = createText(15, 23, 12, 'start', 20, 'Capacity: 10 kg', 'Graduation: 10 g');
bottomRect.setAttribute('class', 'description');
topGroup.appendChild(topRect);
topGroup.appendChild(valueText);
bottomGroup.appendChild(bottomRect);
bottomGroup.appendChild(bottomText);
container.appendChild(baseRect);
container.appendChild(topGroup);
container.appendChild(bottomGroup);
},
});
});
function createRect(width, height, fill, radius) {
const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
rect.setAttribute('x', 0);
rect.setAttribute('y', 0);
rect.setAttribute('width', width);
rect.setAttribute('height', height);
rect.setAttribute('fill', fill);
rect.setAttribute('rx', radius);
return rect;
}
function createText(x, y, fontSize, textAnchor, dy, content1, content2) {
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', x);
text.setAttribute('y', y);
text.setAttribute('fill', '#000');
text.setAttribute('text-anchor', textAnchor);
text.setAttribute('font-size', fontSize);
const tspan1 = createTSpan(x, 0, content1);
const tspan2 = createTSpan(x, dy, content2);
text.appendChild(tspan1);
text.appendChild(tspan2);
return text;
}
function createGroup(x, y) {
const group = document.createElementNS('http://www.w3.org/2000/svg', 'g');
group.setAttribute('transform', `translate(${x} ${y})`);
return group;
}
function createTSpan(x, dy, content) {
const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
tspan.setAttribute('x', x);
tspan.setAttribute('dy', dy);
tspan.textContent = content;
return tspan;
}
xxxxxxxxxx
xxxxxxxxxx