Update d3 to v6.7.0
This commit is contained in:
@@ -6,7 +6,7 @@ docs: >
|
|||||||
The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a SVG element.
|
The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a SVG element.
|
||||||
tags: "d3"
|
tags: "d3"
|
||||||
resources:
|
resources:
|
||||||
- https://unpkg.com/d3@5.9.2/dist/d3.js
|
- https://unpkg.com/d3@6.7.0/dist/d3.min.js
|
||||||
- https://unpkg.com/topojson@3.0.2/dist/topojson.js
|
- https://unpkg.com/topojson@3.0.2/dist/topojson.js
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ docs: >
|
|||||||
</p>
|
</p>
|
||||||
tags: "raster, pixel, maptiler"
|
tags: "raster, pixel, maptiler"
|
||||||
resources:
|
resources:
|
||||||
- https://unpkg.com/d3@4.12.0/build/d3.js
|
- https://unpkg.com/d3@6.7.0/dist/d3.min.js
|
||||||
cloak:
|
cloak:
|
||||||
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Get your own API key at https://www.maptiler.com/cloud/
|
value: Get your own API key at https://www.maptiler.com/cloud/
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ function plot(resolution, counts, threshold) {
|
|||||||
})
|
})
|
||||||
.attr('height', yScale);
|
.attr('height', yScale);
|
||||||
|
|
||||||
bar.on('mousemove', function (count, index) {
|
bar.on('mousemove', function () {
|
||||||
|
const index = bar.nodes().indexOf(this);
|
||||||
const threshold = counts.min + index * counts.delta;
|
const threshold = counts.min + index * counts.delta;
|
||||||
if (raster.get('threshold') !== threshold) {
|
if (raster.get('threshold') !== threshold) {
|
||||||
raster.set('threshold', threshold);
|
raster.set('threshold', threshold);
|
||||||
@@ -188,7 +189,8 @@ function plot(resolution, counts, threshold) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bar.on('mouseover', function (count, index) {
|
bar.on('mouseover', function (event) {
|
||||||
|
const index = bar.nodes().indexOf(this);
|
||||||
let area = 0;
|
let area = 0;
|
||||||
for (let i = counts.values.length - 1; i >= index; --i) {
|
for (let i = counts.values.length - 1; i >= index; --i) {
|
||||||
area += resolution * resolution * counts.values[i];
|
area += resolution * resolution * counts.values[i];
|
||||||
@@ -198,7 +200,7 @@ function plot(resolution, counts, threshold) {
|
|||||||
tip
|
tip
|
||||||
.transition()
|
.transition()
|
||||||
.style('left', chartRect.left + index * barWidth + barWidth / 2 + 'px')
|
.style('left', chartRect.left + index * barWidth + barWidth / 2 + 'px')
|
||||||
.style('top', d3.event.y - 60 + 'px')
|
.style('top', event.y - 60 + 'px')
|
||||||
.style('opacity', 1);
|
.style('opacity', 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user