Giter Club home page Giter Club logo

Comments (10)

heavysixer avatar heavysixer commented on July 20, 2024

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.

yanofsky avatar yanofsky commented on July 20, 2024

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.

heavysixer avatar heavysixer commented on July 20, 2024

@yanofsky thinking this through a bit last night I have a couple questions / comments i'd like to get your thoughts on.

  1. I think this is absolutely an essential feature so we'll add it.
  2. Like you pointed out keeping the API expressive and consistent is an important consideration.
  3. 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.

  1. 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.

yanofsky avatar yanofsky commented on July 20, 2024

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.

heavysixer avatar heavysixer commented on July 20, 2024

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.

heavysixer avatar heavysixer commented on July 20, 2024

@yanofsky here you go: http://visible.io/charts/column/multi-dimension.html

from d4.

yanofsky avatar yanofsky commented on July 20, 2024

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.

heavysixer avatar heavysixer commented on July 20, 2024

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.

heavysixer avatar heavysixer commented on July 20, 2024

@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.

yanofsky avatar yanofsky commented on July 20, 2024

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)

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.