Comments (9)
Hey Guys,
Is there any news on when this will be available?
from nvd3-elements.
Unfortunately, I didn't test nvd3-elements in Polymer v2.
from nvd3-elements.
Ok, I'm going to try it myself and report back.
from nvd3-elements.
from nvd3-elements.
I tested line, pie and discrete-bar in Polymer v2 and so far it works as expected! bower adds a 'resolution' section to map the old polymer version demanded by nvd3-elements to 2.0.0.
The only thing I have not yet been able to get working is make the charts fill 100% of the container. I set the flex-size and auto-resize attributes and omitted explicit height and width attributes. Both line and discrete-bar charts get rendered too big in y-direction.
Assume I have an (empty) container div that fills 100% of the browser window which I simply checked by setting its background-color. As soon as I place a chart with flexSize in it, a y-scrollbar appears because the chart is too big.
Do you have any advice on that? How to correctly use flexSize and viewBoxHeight/Width?
from nvd3-elements.
Thanks for testing it with Polymer 2.0. I'll check and upgrade Polymer on Bower soon.
Please create a demo (https://plnkr.co/) for the problem.
from nvd3-elements.
I tried to create a demo but got stuck when trying to create a chart. The Polymer stuff works but I don't know how to correctly import nvd3-elements. Do you know what is missing? Here is the plunker.
Apart from that I noticed that I didn't correctly understand the viewport thing. I found a lot of stackoverflows now about responsive d3 charts but I do not yet understand how to make an nvd3-element chart fill the container. Without specifying height/width/viewPortHeight/viewPortWidth/flexSize the chart is stretched to the full width of the container which is half the way. I guess in the end I will have to set the height in code :-(
Sorry for bothering you with this but I thought in the age of responsiveness it would be a great feature to easily have the chart fill the container. Any more ideas?
from nvd3-elements.
You need to set the height for NVD3 Charts. If you check samples on nvd3.org, you will see the height settings. I'll try to make charts more responsive while switching to Polymer 2.0.
from nvd3-elements.
Ok, I tried it and was suprised how much time it took until I got it all sorted out :-( In case anyone else has this problem I shortly sketch my solution:
the chart is supposed to always fill the containing element, initially and after window resizing. The containing element is itself either set to height: 100% or part of a flexbox. Initializing must be deferred until the clientHeight property of the element is available! For auto-resizing the window.onresize event can be used but of course should be debounced. As of now there seems to be almost no information and examples about the new Polymer 2.0 debouncing APIs, except this great SO post.
In the attachedCallback
I have this for the initialization:
setTimeout(function() {
this.$.barChart.height = this.clientHeight;
this.$.barChart.refresh();
}.bind(this), 0);
In the ready
callback I have this for auto-resizing:
window.addEventListener('resize', function() {
this._debouncer = Polymer.Debouncer.debounce(
this._debouncer,
Polymer.Async.timeOut.after(200),
function() {
this.$.barChart.height = this.clientHeight;
this.$.barChart.refresh();
}.bind(this));
}.bind(this));
from nvd3-elements.
Related Issues (11)
- Combined nvd3-efforts HOT 3
- Support for x axis labels HOT 2
- Events from Tooltip/ DataPoint HOT 1
- Using "dom: 'shadow'" option in polymer invalidates the css styles HOT 2
- Styles issues since Polymer 1.7 HOT 2
- Using a chart inside iron-collapse causes unecessary refresh HOT 1
- Chart elements cannot be styled by CSS HOT 2
- parse date HOT 1
- Polymer 3.0 Support? HOT 2
- Switch to nvd3/nvd3 HOT 1
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 nvd3-elements.