Skip to content

2.0.0

Compare
Choose a tag to compare
@gampleman gampleman released this 05 Oct 10:25
· 105 commits to master since this release

I'm happy to announce version 2.0. Here are the highlights:

0.19 Compatibility

Elm 0.19 among other things brings dead code elimination, so Elm-visualization can now be used on projects that only require a function or two.

Ecosystem Integration

Elm-visualization now more relies on great community packages. Colors use avh4/elm-color, path use folkertdev/one-true-path-experiment and
our examples are written in elm-community/typed-svg.

API Refinements

All of the APIs should still be familiar from 1.x, but a number of small developer usability improvements have been made.

Now for the detailed changelog:

All modules have dropped the Visualization prefix.

Scales

  • Important: The order of arguments for constructing scales has switched from domain -> range to range -> domain. This better fits how scales are often constructed, where the domain is computed in a pipeline. Unfortunately for linear, log and potentially ordinal scales, this will not result in type errors when upgrading. So remember to grep for these in your codebase and update the call sites. If you see wildly messed up visualizations after the upgrade, this is the most likely cause.

  • In order to help with this, ContinuousScale now takes a type argument (typically Float) and ContinuousTimeScale is now ContinuousScale Time.Posix. So if you have explicit type annotations for your scales, the compiler can possibly help here.

  • Scale.nice has also switched argument order to better support pipeline style.

  • Scale.identity now actually takes a (Float, Float) argument, which should make it much more useful.

  • The docs have been restructured a bit.

  • The color interpolation and scheme functions have been moved out of Scale into their own module Scale.Color. I anticipate we may add many more color schemes in the future and the Scale module is already pretty crowded.

  • The scheme20... functions have been removed. They are not great for accessibility as many of the color combinations they produce are hard to distinguish. If you still need them, you can easily copy their source code into your project.

  • Log scales now generate ticks much more reliably. The default tick formatting now produces much better default formats.

  • toRenderable now takes a toString function

  • time scales now operate with the new Posix.Time. As such they also need a Time.Zone attribute that represents the timezone in which the data should be displayed.

Axes

  • The view function now accepts a list of attributes rather than a record. This makes it more like other view functions. It also eliminates some of the Maybe types, since the default behavior can now be triggered by simply omitting the relevant attributes.

  • The axis function has been split into orientation relevant ones: left, right, bottom, top.

import Visualization.Axis as Axis exposing (defaultAxisOptions, Orientation(..))

main = Axis.axis { defaultAxisOptions | ticks = Just [ 5, 3, 1 ], orientation = Top } myScale

now becomes

import Axis

main = Axis.top [ Axis.ticks [ 5, 3, 1 ] ] myScale

Shape

  • arc, line, lineRadial, area, and areaRadial now return a Path (from the one-true-path-experiment package) rather than a string.

  • Curve functions have changed their type (from Curve -> List PathSegment to List (Float, Float) -> SubPath), now they are mere aliases to the underlying one-true-path-experiment functions.

  • It is now easy to implement your own curve function, since the Curve type was replaced with List (Float, Float)

  • The Point type alias has been removed in the docs.

Statistics

  • Visualization.List has been renamed to Statistics.

  • extentWith has been renamed to extentBy. A new function called extentWith : (a -> a -> Order) -> List a -> Maybe ( a, a ) has been added.

  • Added three new functions: variance, deviation, quantile.

  • range has changed from number -> number -> number -> List number to Float -> Float -> Float -> List Float. This has enabled using a much faster and more precise implementation.

Force

  • Many-body force now uses a QuadTree implementation under the hood. This turns the algorithm from O(n²) to O(n log(n)) and generally improves performance. However, this may lead to slightly different layouts.

  • Adds a customManyBody : Float -> List ( comparable, Float ) -> Force comparable which adds full control over the many body simulation including controlling the level of approximation. This allows you to disable the optimization mentioned above if necessary.

Examples

  • All example code has been changed from elm/svg to elm-community/typed-svg. This is inline with best practice, as anyone who's serious about graphics programming in elm should not use elm/svg. It has almost no type safety and litters your code with String.fromFloat calls. The examples now lead you to this, and consequently the code is a bit simpler.

  • The example website has been spruced up a bit.

Acknowledgments

Many thanks to @folkertdev for contributing the QuadTree optimization.

Thanks to Salomon Turgman, @ianmackenzie and @dmy for helping improve the documentation.

Thanks to @justinmimbs and @folkertdev for updating/redesigning/fixing dependencies.