Comments (1)
If I understand your problem correctly, this sounds like a case for attach
. You should be able to re-use the scales; how you do it depends on how you structure your code. Here are two approaches that come to mind:
- You could define a single chart that initializes the chart you wish to extend, retrieves references to that instance's scales immediately following initialization, and defines the new layer in terms of that reference.
- You could define two charts. "Chart A" would define the layer you want to add, and it would accept a set of scales as an initialization option. "Chart B" would create one instance of the chart you wish to reuse and one instance of Chart A, passing in the scales as appropriate. Finally, Chart B would use
attach
to hook up the draw cycles.
The second approach requires more abstraction, but it's also more composable and potentially more flexible for it. Would either work for you?
from d3.chart.
Related Issues (20)
- Set 'new' chart width based on y-axis width
- Is there a hook to redraw the chart on window resize? HOT 5
- Release notes for version 0.2 HOT 4
- Question - Has anyone integrated this with Angular yet? HOT 1
- Is d3.chart still being developed/maintained/used? HOT 7
- Not deleted when data is updated. HOT 1
- d3 dependency difference HOT 1
- Spam entry in http://misoproject.com/d3-chart/charts.html HOT 3
- compatibility with d3.js version 4? HOT 7
- How to properly enter/update/exit new data HOT 5
- Wrong link on the Api Wiki page
- misoproject.com suggests visitors "Buy this domain"
- d3.chart + requirejs HOT 8
- Idiomatic way to add x-axis, y-axis and tooltips HOT 5
- Assert that an added layer has .insert function
- Detect when a layer has been inserted HOT 4
- Where can I "short-circuit" the draw process? HOT 2
- `beforeDraw` hook HOT 7
- Uniform access 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 d3.chart.