d3 / d3-scale

Encodings that map abstract data to visual representation.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d3-luxon

yamass opened this issue · comments

I've written a luxon-based implementation of time intervals and a corresponding zoned scale:

https://github.com/yamass/d3-luxon

With the currently existing scale implementations, I can format the captions of ticks corresponding to the desired time zone, but the ticks themselves are kind of "shifted", since they correspond to "nice" ticks in the user's time zone (or UTC, depending on the implementation), not the timezone I would like to display the data in.

d3-luxon solves this by using luxon for the time zone-related calculations. I'll also post a demo on observablehq, soon. Also, I will add some documentation (currently only type declarations).

I've got a few questions regarding some details:

License / Copyright header

I did some serious copy/paste from the d3 repos in order to leverage existing tests. I can see that a huge amount of effort has gone into them. For now, I have set the copyright notice in the LICENSE header to my name. But I feel like this is might be not the right way to go. @mbostock What do you think?

NPM Package Name

I will go with d3-luxon (unscoped), if possible. Feel free to veto. I'll wait till tomorrow.

Imports

I created some interval implementations and a scale implementations. I have seen that the existing implementations use functionality that is not part of the public API:

// utcTime.js
import {calendar} from "./time.js";
import {initRange} from "./init.js";

// calendar.js
import continuous, {copy} from "./continuous.js";
import {initRange} from "./init.js";
import nice from "./nice.js";

// d3-time/utcHour.js and others
import interval from "./interval.js";

I am therefore simply importing these files from the node_modules directory, e.g.:

import interval from "../../node_modules/d3-time/src/interval";

This basically copies the imported code into the output of my library, something like 1kb. I am fine with this solution, but if there is a better one, I would be happy to hear about it.


I'd be happy to get some feedback about the library.

Best regards!