Giter Site home page Giter Site logo

elm-plot's Introduction

Current Versions

elm 0.19.0
elm-format 0.8.1

elm-plots

elm-plots is a plotting framework built entirely in elm using svg. It draws inspiration from d3 and vega. The goal of elm-plots is to make drawing visuals such as plots and charts easy to do.

Plots

A plot consists of top level attributes, scales, and visual elements. To make it easy to build up a plot, its functions are setup in a way to chain together updating and adding to it using the forward function applicator.

Top Level Attributes

Top level attributes include things like dimensions, margins, title, etc. The only information that is needed to initially create a plot is its dimensions. The rest have defaults that can be overridden as needed.

Scales

Scales determine how to position your visual elements in a plot. All scales are created with an input (domain) and an output (range). The domain is dependent on the type of scale. For example, a linear scale would have a domain of floats, but an ordinal scale would have a domain of strings. The range is the interval in pixels that you would like your inputs mapped to. Scales are also in charge of creating the locations for ticks for an axis. This is because the tick placement for an axis is dependent on the given scale. Information needed creating ticks varies from scale to scale.

Visual Elements

Visual Elements are drawn on the plot in they order they are added. This allows you control of what overlaps what in your plot. Do you want your bars to overlap your lines? Then add the lines before you add the bars to the plot.

All visual elements require data so the framework knows where to draw them. Additionally svg attributes can be included along with each piece of data. This allows you to provide additional styles or event handlers for each data point individually. Elm's svg package provides a comprehensive list of the attributes and event handlers than can be provided.

Examples

Examples on how to create and use elm-plots are included in the examples folder. To run these examples checkout this repository, install the dependencies, start elm-reactor, and then navigate to the examples in the browser.

cd examples
elm reactor
# then navigate to http://localhost:8000/examples/ in a browser to see all examples in action

Tests

Unit tests are written for logic other than the outputted svg using elm-test.

Test can be ran by:

elm-test

elm-plot's People

Contributors

codyplungis avatar oakesja avatar

Watchers

Justin Grimes avatar Tim Lancaster avatar  avatar James Cloos avatar  avatar  avatar Jim Edwards avatar Nate O'Neill avatar Patrick Sullivan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.