techniq / layerchart

Composable Svelte chart components to build a wide range of visualizations
https://www.layerchart.com
MIT License
660 stars 12 forks source link

Missing documentation on d3-scale #71

Open risalfajar opened 1 year ago

risalfajar commented 1 year ago

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 install d3-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.

techniq commented 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.

image

Along with LayerCake's docs, here are some additional resources you might find helpful

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.

techniq commented 1 year ago

Also note clicking on "Page Source" at the top gives you the full docs including imports

image

image

Also note how to handle the imports compared to the docs...

image

risalfajar commented 1 year ago

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?

techniq commented 1 year ago

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.