-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish: add new heatmap component, and heatmap type in overlay compon…
…ent is deprecated
- Loading branch information
Showing
11 changed files
with
683 additions
and
271 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
] | ||
}, | ||
"globals": { | ||
"BMap": true | ||
"BMap": true, | ||
"BMapLib": true | ||
} | ||
} |
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
357 changes: 357 additions & 0 deletions
357
demo/js/features/apidoc/components/subs/apiContent/subs/docHeatmap.co
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,357 @@ | ||
export default { | ||
template: ` | ||
<p> | ||
The <code>heatmap</code> component is sub-component of <code>baidu-map</code>. It is used to add <code>BMapLib.HeatmapOverlay</code> to the map. | ||
</p> | ||
<h2 class="title">Usage</h2> | ||
<div class="snippet" highlight> | ||
<pre><code class="html"><baidu-map map-options="{expression}"> | ||
<heatmap options="{expression}" dataset="{expression}" loaded="{expression}"><heatmap> | ||
</baidu-map></code></pre> | ||
</div> | ||
<h2 class="title">Attributes</h2> | ||
<blockquote>Required properties are in red</blockquote> | ||
<table class="matrix"> | ||
<thead> | ||
<tr> | ||
<th style="width: 80px;">Param</th> | ||
<th>Type</th> | ||
<th>Details</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>options</td> | ||
<td><span class="label required">expression</span></td> | ||
<td>Literal for constructing heatmap. See <a href="http://api.map.baidu.com/library/Heatmap/2.0/docs/symbols/BMapLib.HeatmapOverlay.html">options</a></td> | ||
</tr> | ||
<tr> | ||
<td>dataset</td> | ||
<td><span class="label">expression</span></td> | ||
<td> | ||
Data for displaying this heatmap. See <a href="http://api.map.baidu.com/library/Heatmap/2.0/docs/symbols/BMapLib.HeatmapOverlay.html">dataset</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>loaded</td> | ||
<td><span class="label">expression</span></td> | ||
<td>Expression to evaluate upon heatmap loaded event. (The object passed to this callback, <code>heatmap</code> for instance of <a href="http://api.map.baidu.com/library/Heatmap/2.0/docs/symbols/BMapLib.HeatmapOverlay.html" target="_blank">BMapLib.HeatmapOverlay</a>)</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<h2 class="title">Example</h2> | ||
<baidu-map map-options="$ctrl.opts"> | ||
<heatmap options="$ctrl.heatmapOpts" dataset="$ctrl.heatmapDataset" loaded="$ctrl.heatmapLoaded(heatmap)"></heatmap> | ||
</baidu-map> | ||
<div class="snippet" highlight> | ||
<pre><code class="html"><baidu-map map-options="opts"> | ||
<heatmap options="heatmapOpts" dataset="heatmapDataset" loaded="heatmapLoaded(heatmap)"></heatmap> | ||
</baidu-map></code></pre> | ||
</div> | ||
<br/> | ||
<div class="snippet" highlight> | ||
<pre><code class="javascript">app.controller('demoCtrl', ['$scope', | ||
function($scope) { | ||
$scope.opts = { | ||
centerAndZoom: { | ||
longitude: 116.418261, | ||
latitude: 39.921984, | ||
zoom: 15 | ||
} | ||
}; | ||
|
||
$scope.heatmapDataset = { | ||
data: [ | ||
{ | ||
lng: 116.421674, | ||
lat: 39.924396, | ||
count: 21 | ||
}, | ||
{ | ||
lng: 116.427268, | ||
lat: 39.92267, | ||
count: 1 | ||
}, | ||
{ | ||
lng: 116.417721, | ||
lat: 39.920034, | ||
count: 51 | ||
}, | ||
{ | ||
lng: 116.412456, | ||
lat: 39.92667, | ||
count: 7 | ||
}, | ||
{ | ||
lng: 116.420432, | ||
lat: 39.919114, | ||
count: 11 | ||
}, | ||
{ | ||
lng: 116.425013, | ||
lat: 39.921611, | ||
count: 35 | ||
}, | ||
{ | ||
lng: 116.418733, | ||
lat: 39.931037, | ||
count: 22 | ||
}, | ||
{ | ||
lng: 116.419336, | ||
lat: 39.931134, | ||
count: 4 | ||
}, | ||
{ | ||
lng: 116.413557, | ||
lat: 39.923254, | ||
count: 5 | ||
}, | ||
{ | ||
lng: 116.418367, | ||
lat: 39.92943, | ||
count: 3 | ||
}, | ||
{ | ||
lng: 116.424312, | ||
lat: 39.919621, | ||
count: 100 | ||
}, | ||
{ | ||
lng: 116.423874, | ||
lat: 39.919447, | ||
count: 87 | ||
}, | ||
{ | ||
lng: 116.424225, | ||
lat: 39.923091, | ||
count: 32 | ||
}, | ||
{ | ||
lng: 116.417801, | ||
lat: 39.921854, | ||
count: 44 | ||
}, | ||
{ | ||
lng: 116.417129, | ||
lat: 39.928227, | ||
count: 21 | ||
}, | ||
{ | ||
lng: 116.426426, | ||
lat: 39.922286, | ||
count: 80 | ||
}], | ||
max: 100 | ||
}; | ||
|
||
//below are for heatmap | ||
$scope.heatmapOpts = { | ||
visible: true | ||
}; | ||
|
||
$scope.heatmapLoaded = function(heatmap) { | ||
console.log('heatmap loaded', heatmap) | ||
}; | ||
} | ||
]);</code></pre> | ||
</div> | ||
`, | ||
controller: class { | ||
/* @ngInject */ | ||
constructor() { | ||
this.opts = { | ||
centerAndZoom: { | ||
longitude: 116.418261, | ||
latitude: 39.921984, | ||
zoom: 15 | ||
} | ||
} | ||
|
||
this.heatmapDataset = { | ||
data: [ | ||
{ | ||
lng: 116.418261, | ||
lat: 39.921984, | ||
count: 50 | ||
}, | ||
{ | ||
lng: 116.423332, | ||
lat: 39.916532, | ||
count: 51 | ||
}, | ||
{ | ||
lng: 116.419787, | ||
lat: 39.930658, | ||
count: 15 | ||
}, | ||
{ | ||
lng: 116.418455, | ||
lat: 39.920921, | ||
count: 40 | ||
}, | ||
{ | ||
lng: 116.418843, | ||
lat: 39.915516, | ||
count: 100 | ||
}, | ||
{ | ||
lng: 116.42546, | ||
lat: 39.918503, | ||
count: 6 | ||
}, | ||
{ | ||
lng: 116.423289, | ||
lat: 39.919989, | ||
count: 18 | ||
}, | ||
{ | ||
lng: 116.418162, | ||
lat: 39.915051, | ||
count: 80 | ||
}, | ||
{ | ||
lng: 116.422039, | ||
lat: 39.91782, | ||
count: 11 | ||
}, | ||
{ | ||
lng: 116.41387, | ||
lat: 39.917253, | ||
count: 7 | ||
}, | ||
{ | ||
lng: 116.41773, | ||
lat: 39.919426, | ||
count: 42 | ||
}, | ||
{ | ||
lng: 116.421107, | ||
lat: 39.916445, | ||
count: 4 | ||
}, | ||
{ | ||
lng: 116.417521, | ||
lat: 39.917943, | ||
count: 27 | ||
}, | ||
{ | ||
lng: 116.419812, | ||
lat: 39.920836, | ||
count: 23 | ||
}, | ||
{ | ||
lng: 116.420682, | ||
lat: 39.91463, | ||
count: 60 | ||
}, | ||
{ | ||
lng: 116.415424, | ||
lat: 39.924675, | ||
count: 8 | ||
}, | ||
{ | ||
lng: 116.419242, | ||
lat: 39.914509, | ||
count: 15 | ||
}, | ||
{ | ||
lng: 116.422766, | ||
lat: 39.921408, | ||
count: 25 | ||
}, | ||
{ | ||
lng: 116.421674, | ||
lat: 39.924396, | ||
count: 21 | ||
}, | ||
{ | ||
lng: 116.427268, | ||
lat: 39.92267, | ||
count: 1 | ||
}, | ||
{ | ||
lng: 116.417721, | ||
lat: 39.920034, | ||
count: 51 | ||
}, | ||
{ | ||
lng: 116.412456, | ||
lat: 39.92667, | ||
count: 7 | ||
}, | ||
{ | ||
lng: 116.420432, | ||
lat: 39.919114, | ||
count: 11 | ||
}, | ||
{ | ||
lng: 116.425013, | ||
lat: 39.921611, | ||
count: 35 | ||
}, | ||
{ | ||
lng: 116.418733, | ||
lat: 39.931037, | ||
count: 22 | ||
}, | ||
{ | ||
lng: 116.419336, | ||
lat: 39.931134, | ||
count: 4 | ||
}, | ||
{ | ||
lng: 116.413557, | ||
lat: 39.923254, | ||
count: 5 | ||
}, | ||
{ | ||
lng: 116.418367, | ||
lat: 39.92943, | ||
count: 3 | ||
}, | ||
{ | ||
lng: 116.424312, | ||
lat: 39.919621, | ||
count: 100 | ||
}, | ||
{ | ||
lng: 116.423874, | ||
lat: 39.919447, | ||
count: 87 | ||
}, | ||
{ | ||
lng: 116.424225, | ||
lat: 39.923091, | ||
count: 32 | ||
}, | ||
{ | ||
lng: 116.417801, | ||
lat: 39.921854, | ||
count: 44 | ||
}, | ||
{ | ||
lng: 116.417129, | ||
lat: 39.928227, | ||
count: 21 | ||
}, | ||
{ | ||
lng: 116.426426, | ||
lat: 39.922286, | ||
count: 80 | ||
} | ||
], | ||
max: 100 | ||
} | ||
|
||
// below are for heatmap | ||
this.heatmapOpts = { | ||
visible: true | ||
} | ||
|
||
this.heatmapLoaded = function(heatmap) { | ||
console.log('heatmap loaded', heatmap) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.