Open risalfajar opened 1 year ago
Hi @risalfajar 👋
I agree having a better getting started doc is very much needed. We do make a callout to LayerCake
's docs, which LayerChart
is built up, and does provide a good foundation, but I would like to cover the basics within our docs as well.
Along with LayerCake's docs, here are some additional resources you might find helpful
d3-*
packages. Many are these are used by LayerChart "under the hood" or are not applicable with Svelte, but it's nice if you want a better understanding of the D3 "ecosystem". d3-scale
, d3-array
, and d3-scale-chromatic
are a few I reach for quite often (especially d3-array
).Much of the above I'll likely link in a "further reading" page in the docs, but the goal of LayerChart is to simplify creating charts significantly than using D3 directly. It's more akin to Observable Plot (made my Mike Bostock) but with a Svelte/component focus, and more interactivity.
Also note clicking on "Page Source" at the top gives you the full docs including imports
Also note how to handle the imports compared to the docs...
Thank you for the resourceful answer, I'll look into that.
Yes, the view page source helps. I just thought it would be better if other dependencies that needed to use this library can be stated in Getting Started section.
Maybe there are more dependencies other than d3-scale?
d3-scale
is the main one, since it is used in most/all of the cartesian / polar charts (standard x/y charts), and in some capacity in others depending on the chart type (scale isn't used for x/y, but might be used for color, for example).
d3-array
is used a lot for data transformation (you can think of as a data/visualization centric lodash in some capacity).
d3-hierarchy
is used for the hierarchy visualizations (pack, treemap, etc)
It comes down to the specific visualization(s) you are creating, but for the most part, those would cover a great deal of the most common ones.
I'm trying to implement the Bar example, but it doesn't work since the library doesn't have
scaleBand
function which is needed. Turns out I need to installd3-scale
first.I think this should be documented in Getting Started section. Also explaining the relations of this library with d3-scale could help as well, especially for folks that never heard of it before.