Skip to content

Commit ab11fbc

Browse files
36449 (#833)
36449
1 parent 900de96 commit ab11fbc

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//begin imports
2+
using IgniteUI.Blazor.Controls;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Collections;
6+
//end imports
7+
8+
import { CodeGenHelper } from 'igniteui-webcomponents-core';
9+
10+
public class ShapeFileOnViewInit
11+
{
12+
//begin eventHandler
13+
14+
private IgbShapeDataSource Data;
15+
16+
public void ShapeFileOnViewInit()
17+
{
18+
var geoMap = CodeGenHelper.GetDescription<IgbGeoGraphicMap>("content");
19+
20+
this.Data = new IgbShapeDataSource()
21+
{
22+
ShapefileSource = "https://static.infragistics.com/xplatform/shapes/world_countries_all.shp",
23+
DatabaseSource = "https://static.infragistics.com/xplatform/shapes/world_countries_all.dbf"
24+
};
25+
this.geographicShapeSeries1.ShapefileDataSource = Data;
26+
this.geoMap.BackgroundContent = null;
27+
}
28+
//end eventHandler
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//begin eventHandler
2+
igRegisterScript("ShapeFileStyling", (o, e) => {
3+
// applying conditional styling based on Contient field loaded from DBF file
4+
var c = e.item.getFieldValue("Continent")
5+
if (c == "Africa") {
6+
e.shapeFill = "#ECB912";
7+
} else if (c == "Asia") {
8+
e.shapeFill = "#E11D1D";
9+
} else if (c == "Europe") {
10+
e.shapeFill = "#2894EC";
11+
} else if (c == "South America" || c == "North America") {
12+
e.shapeFill = "#0CC308";
13+
} else if (c == "Australia") {
14+
e.shapeFill = "#B42AE9";
15+
} else {
16+
e.shapeFill = "gray";
17+
}
18+
e.shapeOutline = "black";
19+
}, false);
20+
//end eventHandler
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"export": false,
3+
"onViewInit": [ "ShapeFileOnViewInit"],
4+
"descriptions": {
5+
"content": {
6+
"type": "GeographicMap",
7+
"name": "geoMap",
8+
"zoomable": true,
9+
"series": [
10+
{
11+
"type": "GeographicShapeSeries",
12+
"name": "GeographicShapeSeries1",
13+
"styleShapeRef": "ShapeFileStyling"
14+
}
15+
]
16+
}
17+
},
18+
"modules": [
19+
"maps/GeographicMapModule",
20+
"charts/LegendModule",
21+
"charts/DataChartAnnotationModule",
22+
"charts/DataChartInteractivityModule"
23+
]
24+
}

0 commit comments

Comments
 (0)