score:0
Accepted answer
since there is no plunker/fiddle provided, this is an another guess :)
try putting the new element into dom before compling like this:
var newelem = '<div d3-bars bar-height="20" bar-padding="5"></div>';
newelem = angular.element(newelem);
element.append(newelem);
$compile(newelem)(scope);
that is in order to allow the new element to have width and height before get compiled.
score:0
i would guess, that you forgot to assign your scope
variable. just try $scope
instead if you're in a controller.
another possible apporach would be, to toggle a boolean variable with your button and use ng-show
for your d3 code like this:
<button ng-click="showd3 = != showd3">click me!</button>
<div d3-bars bar-height="20" bar-padding="5" ng-show="showd3"></div>
Source: stackoverflow.com
Related Query
- How to get container dimensions before compile?
- How to get the dimensions of a D3.js element before drawing it?
- Leaflet: How to get pixel position of a lat lng after zoom, before zoom begins
- How to get nav bar always in foreground also before svg?
- D3.js: How to get the computed width and height for an arbitrary element?
- How to add an image to an svg container using D3.js
- How to get coordinates of an svg element?
- How to get data of parent node in d3.js
- How do I get the width of an svg element using d3js?
- How to get absolute coordinates of object inside a <g> group?
- How can I get the D3.js axis ticks and positions as an array?
- How to get maximum value from an array of objects to use in d3.scale.linear().domain()
- MultiBar chart with nvd3 / d3 only shows labels for every other tick on the x-axis. How can I get them all to show up?
- how to include use of node_modules in rollup compile
- In d3, how to get the interpolated line data from a SVG line?
- How to get variable attribute in d3
- d3.js how to get minimum value of scale's domain when using nice()
- How do I ensure D3 finishes loading several CSVs before javascript runs?
- how to get dynamic value of input element with d3?
- how to get localizable or customizable si codes with d3.format
- How to get the outline of a stroke?
- How can I get numeric values instead of Logarthmic values in D3 axis scale?
- How to properly get text width to center labels above graph bars?
- How to get the total depth of an unknown JSON hierarchy?
- D3js: how to get Lat/Log geocoordinates from mouse click?
- How can I get "call" to execute for each data element in D3?
- How to get coordinates of slices along the edge of a pie chart?
- How do I get a topojson layer to show up in leaflet using d3?
- how to get the type of a scale in D3?
- How to get the vertically-oriented tree using d3.js
More Query from same tag
- How do I reformat the data in d3 having values to the key and another values to the value of the key?
- How do I find the associated DOM element when I have the Data object in D3?
- How to get the vertically-oriented tree using d3.js with rectangular box
- d3.js scale doesn't place tick at the top
- Parsing timestamp in d3.js issues
- How to do time-data in D3 maps
- adding clickable zones to an svg
- How to prevent SVG text from flowing out of its circle?
- Different gradient for every area
- Line Generator not working
- Simple Pan and Zoom in d3 v7
- Gauge D3, display values positions
- D3 Bar Chart - Reverse Bars from Right to Left
- D3js chart not rendering correctly on client, D3 source code stored on server
- d3js error on decrementing datapoints - how to resolve?
- Changing time scale from days to weeks, how do I update and sum data values?
- How to show rating using row chart in dc js
- creating a legend with d3.js
- Javascript callback in JavaFX from within a HTML page (using D3)
- Created A Bar Chart But Height Is Not Reciprocating Changes
- Cannot read property 'push' of undefined when refactoring code
- d3.js - circle pack layout with nested g nodes
- d3 donut chart with labels
- d3.js - select force layout group not update the nodes
- D3 tickFormat error stating n.getMonth is not a function
- How to insert text sibling elements for each existing circle element of svg group?
- D3 Monotone Interpolation - Smoothing a line
- d3 - Format an integer as time on 24 hour clock
- D3: ordinal scale returning undefined in part of its range
- Draw a frequency plot in d3 with JSON data