-
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
-
Reporting
- AI-powered Extensions
-
Interaction
-
Report Types
-
Data binding
-
Real-life Reports
-
Layout Features
-
Report Controls
-
Web-specific Features
-
Rich Text Editor
- Overview
- Load/Save
- Document Protection
-
Templates
- Autocorrect
-
Customization
- Simple View
-
Spreadsheet
- Overview
-
Open a Document
- Export And Printing
-
Features
-
UI Customization
-
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
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Resizable
-
-
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
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Related Demos:
Your search did not match any results.
Vector Map - Colors Customization
This demo shows how to color different map elements. The map represented here indicates the top ten largest countries in the world by means of colors. These colors are assigned to the map areas using the customize callback function of the layers object. Moreover, when one of the areas is selected or hovered over, its color changes to those specified by the selectedColor and hoveredColor properties.
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
@(Html.DevExtreme().VectorMap()
.ID("vector-map")
.Bounds(new double[] { -180, 85, 180, -60 })
.Tooltip(t => t
.Enabled(true)
.Border(b => b.Visible(false))
.Font(f => f.Color("#fff"))
.CustomizeTooltip("vectorMap_customizeTooltip")
)
.Layers(l => l.Add()
.DataSource(new JS("DevExpress.viz.map.sources.world"))
.Customize("vectorMap_layer_customize")
)
.OnClick("vectorMap_onClick")
)
<script src="~/data/countries.js"></script>
<script>
function vectorMap_customizeTooltip(arg) {
var name = arg.attribute("name"),
country = countries[name];
if(country) {
return { text: name + ": " + country.totalArea + "M km²", color: country.color };
}
}
function vectorMap_layer_customize(elements) {
$.each(elements, function(_, element) {
var country = countries[element.attribute("name")];
if(country) {
element.applySettings({
color: country.color,
hoveredColor: "#e0e000",
selectedColor: "#008f00"
});
}
});
}
function vectorMap_onClick(e) {
var target = e.target;
if(target && countries[target.attribute("name")]) {
target.selected(!target.selected());
}
}
</script>
using Microsoft.AspNetCore.Mvc;
using DevExtreme.NETCore.Demos.Models.SampleData;
namespace DevExtreme.NETCore.Demos.Controllers {
public class VectorMapController : Controller {
public ActionResult ColorsCustomization() {
return View();
}
}
}
var countries = {
"Russia": { totalArea: 17.12, color: "#1E90FF" },
"Canada": { totalArea: 9.98, color: "#B8860B" },
"China": { totalArea: 9.59, color: "#BDB76B" },
"United States": { totalArea: 9.52, color: "#FFA07A" },
"Brazil": { totalArea: 8.51, color: "#3CB371" },
"Australia": { totalArea: 7.69, color: "#D8BFD8" },
"India": { totalArea: 3.29, color: "#DB7093" },
"Argentina": { totalArea: 2.78, color: "#FFD700" },
"Kazakhstan": { totalArea: 2.72, color: "#CD5C5C" },
"Algeria": { totalArea: 2.38, color: "#B0C4DE" }
};
#vector-map {
height: 440px;
}
Tooltips for the map areas representing the largest countries are customized as well. Using the tooltip | customizeTooltip callback function, they are colored identical to the areas themselves and display the total area of the country.