Comments (3)
Released v1.6.0 and published it to npm.
from echarts-extension-gmap.
Ok, so I have been able to track down and replicate the issue.
The issue come from how zrender compute the canvas resize.
In Painter.js
(in zrender/echart) you can find the function CanvasPainter.resize
:
CanvasPainter.prototype.resize = function (width, height) {
if (!this._domRoot.style) {
if (width == null || height == null) {
return;
}
this._width = width;
this._height = height;
this.getLayer(CANVAS_ZLEVEL).resize(width, height);
}
else {
var domRoot = this._domRoot;
domRoot.style.display = 'none';
var opts = this._opts;
var root = this.root;
width != null && (opts.width = width);
height != null && (opts.height = height);
width = getSize(root, 0, opts);
height = getSize(root, 1, opts);
domRoot.style.display = '';
if (this._width !== width || height !== this._height) {
domRoot.style.width = width + 'px';
domRoot.style.height = height + 'px';
for (var id in this._layers) {
if (this._layers.hasOwnProperty(id)) {
this._layers[id].resize(width, height);
}
}
this.refresh(true);
}
this._width = width;
this._height = height;
}
return this;
};
This function call the getSize
function, which do the following:
export function getSize(root, whIdx, opts) {
var wh = ['width', 'height'][whIdx];
var cwh = ['clientWidth', 'clientHeight'][whIdx];
var plt = ['paddingLeft', 'paddingTop'][whIdx];
var prb = ['paddingRight', 'paddingBottom'][whIdx];
if (opts[wh] != null && opts[wh] !== 'auto') {
return parseFloat(opts[wh]);
}
var stl = document.defaultView.getComputedStyle(root);
return ((root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh]))
- (parseInt10(stl[plt]) || 0)
- (parseInt10(stl[prb]) || 0)) | 0;
}
It looks complex, but it basically more or less just get the width and height of the root
div.
This div is the root div which contains the map.
The issue comes from when the container div has a size that is not the fullscreen size. The canvas will match this size no matter what instead of matching the fullscreen size.
For exemple, if you take the default exemple codepen, it works with no issue because the root div has a width and height of 100% and has no parent except the body: https://codepen.io/plainheart/pen/VweLGbR
But if you update the codepen and change the style of the div to a fixed sized, you will be able to reproduce the issue: https://codepen.io/maeln/pen/XWxmPpe
Try to go fullscreen and you should see all the point disappear unless you move the map so that they are in the left top corner.
A potential fix to this would be to pass the first child of the ec-extension-google-map
to the resize function instead, since this one has an absolute position (so it doesn't depend on the parent sizing) and correctly resize to fullscreen:
from echarts-extension-gmap.
Since the PR has been approved, I close this issue. Thanks @plainheart !
from echarts-extension-gmap.
Related Issues (12)
- Lines problems HOT 13
- if i import or require this package how to set gmap key HOT 1
- Size gmap HOT 8
- Is it possible to combine GeoJSON with this extension ?
- Echarts not reflow
- can not support graph? HOT 2
- Can this extension implement polygons and polylines on Google Map? HOT 9
- TypeError: echarts.init is not a function HOT 3
- brush selection HOT 1
- Angular 2+ support? HOT 1
- Is it workds with dataset? Could you show an example? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from echarts-extension-gmap.