d3 / d3-axis

Human-readable reference marks for scales.

Home Page:https://d3js.org/d3-axis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support external rendering

korigod opened this issue · comments

Hi,

It's quite common now to use a JS framework such as React or Vue to render the elements instead of D3.js DOM manipulation. While it's possible with most of the packages, d3-axis doesn't support this kind of operation which is useful not only for consistency and reactivity but also for rendering of labels outside of svg to keep font rendering and size consistent with the remaining page elements even when chart is being scaled.

Is it possible to make d3-axis more friendly for select-less operation? E.g. provide methods to get ticks coordinates, line path etc. I would file a PR if I was sure how to do it right but I'm not, so could you either implement it or guide me on how this can be done?

With apologies, but I don’t see this as being possible (or… feasible). Your best bet is probably forking this library and re-implementing it with your framework of choice.

Also, there’s already scale.ticks, d3.ticks, d3.format etc. for doing all this stuff outside of d3-axis. The remaining logic in this module is essentially mapping that to SVG (and handling transitions).