-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
11,671 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import HighCharts from 'highcharts'; | ||
import MapChart from 'highcharts/modules/map.js'; | ||
|
||
function MapHook() { | ||
this.mounted = function () { | ||
// the `dataset` property carries all `data-*` attributes of the corresponding html element | ||
const element_data = this.el.dataset | ||
// initialize the library | ||
MapChart(HighCharts); | ||
// Create the chart | ||
this.map = HighCharts.mapChart(element_data.mapId, { | ||
chart: { | ||
map: JSON.parse(this.el.dataset.json), | ||
backgroundColor: 'rgba(0,0,0,0)', // transparent background | ||
height: '100%' | ||
}, | ||
|
||
title: { text: '' }, | ||
credits: { enabled: false }, | ||
|
||
mapNavigation: { | ||
enabled: true, | ||
}, | ||
|
||
colorAxis: { min: 0 }, | ||
|
||
series: [{ | ||
name: this.el.dataset.country, | ||
borderColor: '#A0A0A0', | ||
nullColor: 'rgba(200, 200, 200, 0.3)', | ||
states: { | ||
hover: { | ||
color: '#BADA55' | ||
} | ||
}, | ||
tooltip: { | ||
headerFormat: '', | ||
pointFormat: '{point.description}', | ||
}, | ||
dataLabels: { | ||
enabled: false, | ||
} | ||
}, { | ||
type: 'mappoint', | ||
tooltip: { | ||
headerFormat: '', | ||
pointFormat: '{point.description}', | ||
}, | ||
events: { | ||
click: function (e) { | ||
const url = e.target.point.url; | ||
window.open(url); | ||
} | ||
}, | ||
color: "#030303" | ||
}] | ||
}); | ||
|
||
// setup the event handler | ||
this.handleEvent("panel-" + element_data.componentId + "::refresh-data", this.setMapData()) | ||
}; | ||
|
||
this.setMapData = function () { | ||
return (payload) => { | ||
this.map.series[0].setData(payload.Areas) | ||
this.map.series[1].setData(payload.Pins) | ||
} | ||
}; | ||
|
||
}; | ||
|
||
export default MapHook; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import ChartJSHook from "./components/chartjs_hook" | ||
import TableHook from "./components/table_hook" | ||
import TimeRangeHook from "./components/time_range_hook" | ||
import MapHook from "./components/map_hook" | ||
|
||
export { ChartJSHook, TableHook, TimeRangeHook } | ||
export { ChartJSHook, TableHook, TimeRangeHook, MapHook } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.