gampleman / elm-visualization

A data visualization library for Elm

Home Page:http://package.elm-lang.org/packages/gampleman/elm-visualization/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose Scale type constructor

fbergroth opened this issue · comments

I would like to implement a custom scale, but since Scale doesn't expose it's type constructor, I can't see a way to do it. Or am I missing something?

What I would like is for

module Scale exposing
( Scale
to expose Scale(..).

Thanks!

Hi @fbergroth! Thanks for posting, but to properly evaluate this I would need to hear a lot more about:

  1. What is it that you are trying to achieve? What is the context here?
  2. Are there other solutions that you have explored? Why didn't they work?

Specifically, what kind of scale are you building and why do you need it to share the type with elm-visualization scales? Are you trying to get Axes to work with it?

In general I am very dubious about exposing the constructor at this time. It is a breaking release (Elm's semver enforcement is weird) and I would like to change the scale implementation more drastically in v3. I can of course be convinced, or there might be a better API I can expose for doing whatever you want. As such I will close your PR for now (we can reopen it if we change our mind).

1. What is it that you are trying to achieve? What is the context here?

I'm working in a project where we currently have elm-visualization vendored with the Scale constructor exposed, which I'd like to fix. We have a chart where the user can choose which scales to use, with one being our custom scale.

2. Are there other solutions that you have explored? Why didn't they work?

Other than vendoring, I can only think of ugly workarounds. How would you as a consumer of elm-visualization create a Scale with a custom convert, invert, etc?

Specifically, what kind of scale are you building and why do you need it to share the type with elm-visualization scales? Are you trying to get Axes to work with it?

The custom scale is a tanh-scale for the y-axis. We're calling Scale.convert, Scale.invert, Scale.rangeExtent, ..., when plotting the chart.

In general I am very dubious about exposing the constructor at this time. It is a breaking release (Elm's semver enforcement is weird) and I would like to change the scale implementation more drastically in v3. I can of course be convinced, or there might be a better API I can expose for doing whatever you want. As such I will close your PR for now (we can reopen it if we change our mind).

Ah, I hadn't realized that it would be a breaking release. I'm not too familiar with Elm, perhaps you know a better way to solve my issue?