Git Product home page Git Product logo

Comments (9)

hegsie avatar hegsie commented on July 1, 2024 1

Hey Guys,
Is there any news on when this will be available?

from nvd3-elements.

saeidzebardast avatar saeidzebardast commented on July 1, 2024

Unfortunately, I didn't test nvd3-elements in Polymer v2.

from nvd3-elements.

nicolasr75 avatar nicolasr75 commented on July 1, 2024

Ok, I'm going to try it myself and report back.

from nvd3-elements.

saeidzebardast avatar saeidzebardast commented on July 1, 2024

from nvd3-elements.

nicolasr75 avatar nicolasr75 commented on July 1, 2024

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.

saeidzebardast avatar saeidzebardast commented on July 1, 2024

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.

nicolasr75 avatar nicolasr75 commented on July 1, 2024

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.

saeidzebardast avatar saeidzebardast commented on July 1, 2024

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.

nicolasr75 avatar nicolasr75 commented on July 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.