Giter Site home page Giter Site logo

API or documentation for scale nicing about d4 HOT 9 OPEN

fin avatar fin commented on June 27, 2024
API or documentation for scale nicing

from d4.

Comments (9)

heavysixer avatar heavysixer commented on June 27, 2024

Hey @fin absolutely, if you have a way of making d4 better which doesn't break anything in terms of backward compatibility I am all for it. My feeling is that this should probably be an accessor, there are several examples of how to do this in other features. Also you will probably want to checkout https://github.com/heavysixer/d4-www to run your changes against the examples directory. If you have both projects checked out side by side it's designed to copy over your development version of d4 into the example site so that you can ensure you are not breaking anything.

Thanks again for the interest in D4

from d4.

fin avatar fin commented on June 27, 2024

hey,
i have tried to build this and now i'm confused. it looks like the .domain() calls in builders/scales.js is always d3.scale.domain, not the anonymous functions d3.scale.domain is wrapped with by base.js/createAxisScaleAccessor

do you have a minute to shed some light on this?
thanks.

from d4.

heavysixer avatar heavysixer commented on June 27, 2024

Hi @fin is there a branch i can pull to see what's going on? I think i'll need to be able to reproduce the error before i can help.

from d4.

fin avatar fin commented on June 27, 2024

i pushed a clean commit, the diff to your master will be slightly more involved since grunt seems to re-format sourcefiles as well, but those are the only functional changes:

fin@eed88c7

figured it would be enough to override the proxy's .domain function to call .nice after its values were set, but the proxy seems to not be accessed by the builders.
which means my mental model for what's going on was wrong. i'll try to look further into it, but if you have pointers i'd appreciate them!

from d4.

heavysixer avatar heavysixer commented on June 27, 2024

@fin awesome, let me pull and see if I can suss out what is going on. Thanks for taking a stab at it.

from d4.

heavysixer avatar heavysixer commented on June 27, 2024

working on this now...

from d4.

heavysixer avatar heavysixer commented on June 27, 2024

Hey @fin just to make sure I understand what you are after checkout this codepin:
http://codepen.io/heavysixer/pen/wKwBBZ

You'll see you can adjust nice and the chart will update based on the new parameters that are being supplied. This is how d4 works currently without modifications. I am trying to understand where you are trying to use nice() instead.

from d4.

fin avatar fin commented on June 27, 2024

i'm trying to move the .nice into the declaration of the chart.

in your example, the chart is coupled to the data doubly: in the declaration, and through the .datum().call() function.

what i would have wanted to achieve is to have a setting on the axis, saying "should the axis' scale be niced? (y/n/[integer value like d3.time.day])"

so that the chart can be defined independently from the data, and there's only one data ingress point: the .datum().call() pattern.

from d4.

heavysixer avatar heavysixer commented on June 27, 2024

Forgive me if I am still not understanding you, but I think we are agreed that we don't want to nice() the entire chart. If you did could do so by pre-processing the incoming data. In my mind nicing lives at the feature level, so that you can nice two axis elements in different ways. The way you'd do that is with the using() pattern (like my example shows). The part I am less clear on is how this approach effects the data ingress point like you pointed out. In my mind, the way nice() works now provides an adequate and desirable separation of concerns between features.

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.