Comments (10)
Hey @yanofsky this sounds like a great addition to d4, let me see if I can figure it out. Do you have a fiddle or codepen you can share for what you've done so far? It is always helpful for me if I can fiddle with actual code.
I understand the issue with the declarative nature of the API, maybe we can do something like this
chart.y(function(){},1) where 1 is the index (defaulting to 0 if omitted)?
I think I might need to wrap my head around it a bit before I am totally sure, however this is something which is very common in data visualization and therefore a worthwhile addition.
Thanks!
from d4.
Sure thing, here's a fiddle http://jsfiddle.net/26n3znsh/
The idea is that the line and right axis should be on an independent scale from the bars and the left axis
If we were to do it how you have above i can imagine the commented out methods on lines 70, 88, and 125 being the way forward (though maybe 125 isn't necessary?)
from d4.
@yanofsky thinking this through a bit last night I have a couple questions / comments i'd like to get your thoughts on.
- I think this is absolutely an essential feature so we'll add it.
- Like you pointed out keeping the API expressive and consistent is an important consideration.
- We need to ensure we solve this problem with a pattern or metaphor we can use elsewhere so that once a developer has learned it they can apply that concept everywhere.
With that in mind I am wondering what you think of this approach.
- Add xScale and yScale proxies to the features that use scales so that they can be injected from the using method e.g.
var chart = d4.charts.column();
chart
.x(function(axis){
axis
.scale('linear')
})
.using('bars', function(bars) {
bars
.xScale(function(axis){ axis.scale('ordinal')})
})
from d4.
Sorry for the slow reply!
That looks workable. The things that have been tying me up thinking about it is how to make it easiest to maintain the background auto scaling
Would there be a way to select an scale/axis by index? Or get a list of the current list of scales/axes? I think that would be useful.
from d4.
Hey @yanofsky i am working on this feature as we speak so this is perfect timing. Can you explain what you mean by auto-scaling? My thinking was that d4 would assume a single scale at the chart level, and then features could be locally overridden with a new scale. In this way you'd declare a single scale object outside the main chart object and then assign it to all the features you'd need like the axis, and line series. This would keep the inner workings of d4 basically the same, while still allowing for feature specific overrides. Thoughts?
from d4.
@yanofsky here you go: http://visible.io/charts/column/multi-dimension.html
from d4.
Awesome, thanks, for doing this so quickly. It really helps us out a lot
What I was getting at before is that by default the domain of the nth scale could be calculated automatically...but the person who gets this deep into charting with d4 would probably be okay setting the scale too
from d4.
Thank you for the feedback, if after playing with my implementation you have suggestions for improvements I am very happy to hear about it. Thanks again for your continued support of d4.
from d4.
@yanofsky sounds like you are using d4 on a regular basis, do you have any other pain points that you've noticed in using the lib?
from d4.
I do!
I'll put them in as separate issues to keep them organized on here...as such some of them are unique to our use case so I won't be offended by any wontfix
from d4.
Related Issues (20)
- Waterfall charts do not respect min/max of the chart domain.
- Transitions broken on the donut chart example HOT 1
- Scales shouldn't auto-nice without an option to prevent it HOT 1
- Method to change stack order of elements HOT 7
- Better series indexing HOT 10
- Add Padding method make distinct from Margin HOT 8
- Dual-axis capability breaks when using groupedColumnSeries HOT 6
- Negative label values are not displayed properly
- Refactor as node module HOT 7
- API or documentation for scale nicing HOT 9
- Attempt to make the svg more responsive to resizing
- d4.js:1172 Uncaught ReferenceError: d4 is not defined HOT 3
- License Missing HOT 1
- Throws reference error when using Browserify (assuming will also throw error with other bundlers?) HOT 2
- Cannot read property 'ordinal' of undefined HOT 12
- missing [week,hour,0] data result wrong graph for punch-card example
- [enhance] add line for punch-card
- wrong order punch-card data result wrong graph for punch-card example
- Example links in documentation are broken
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 d4.