Git Product home page Git Product logo

meowcow's Introduction

meowcow

Quickly visualize multi-dimensional data through various charting types such as:

  • bar
  • box
  • violin
  • scatter
  • line

TODO

  • docs
  • readme
  • help modal for each plot type showing an example SVG - should make this a config option too
  • plot options for line plot: isArea, defined; data options: area, classed,
  • save svg button
  • order all the filters by type (e.g. group all sliders together)
  • resize width on width resize (updateColWidth())

overal chart options:

  • log scale axes
  • show labels
  • manually define labels
  • axis left/right or top/bottom
  • tick format?
  • title
  • focus

Input data

Data should be provided in a tidy format where each row represents and observation and each column represents a data attribute to be visualizied.

It should be formatted as a list of objects, for example:

var inputData = {
    description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    meta: null,
    source: 'source data goes here',
    colDescription: {
        Subject:'identifier for study subject',
        Study:'study name',
        ...
    },
    data : [
        {Subject: 157418, Study: 'I', Weight: 11.7, Date: '2016-07-26', Protocol: 'control', Drug: 'zeta', Isolator: 'A'},
        {Subject: 157418, Study: 'I', Weight: 10.9, Date: '2016-07-27', Protocol: 'control', Drug: 'zeta', Isolator: 'A'},
        {Subject: 157418, Study: 'I', Weight: 12.9, Date: '2016-07-29', Protocol: 'control', Drug: 'zeta', Isolator: 'A'},
        {Subject: 157418, Study: 'I', Weight: 14.4, Date: '2016-08-02', Protocol: 'control', Drug: 'zeta', Isolator: 'A'},
        {Subject: 157418, Study: 'I', Weight: 16.6, Date: '2016-08-09', Protocol: 'control', Drug: 'zeta', Isolator: 'A'},
        {Subject: 157418, Study: 'I', Weight: 17.1, Date: '2016-08-16', Protocol: 'control', Drug: 'zeta', Isolator: 'A'},
        ...
    ]
}

Note that data can be input as strings and will be converted to the proper type (int of float) automatically; furthermore, the data type can be overwritten with the option .colTypes. For example, in the dataset shown above, the Subject attribute should be treated as an ordinal datatype as opposed to a quantitative one; this can be specified with .colTypes({Subject: 'str'}).

Usage

Designate a DOM element into which the GUI and plots should be rendered, e.g. <body class='container-fluid' id='renderHere'></body>

Then, instantiate everything (on load) with something like:

<script>
    $(function() {

        var moo = meowcow()
            .container('#renderHere')
            .data(inputDat) // declared in js/tall.js - if left unspecified, a modal will be loaded which allows user to upload a delimited file
            .config(guiSetup) // declared in js/config.js
            .ignoreCol(['_UID']) // ignore these columns in input data
            .colTypes({Subject: 'str'}) // overwrite column type
            .run();
    });
</script>

Options

The following options are available:

  • .container(str) - DOM selector into which to render both the GUI and the eventual plots.
  • .data(list, optional) - data to be visualized; if not specified, a modal will be presented with an option to upload a delimited file.
  • .config(JSON) - configuration file for the app which includes options for the GUI as well as for the various plot types.
  • .ignoreCol(list, optional) - list of attributes that should be excluded from the GUI, must be present in data if provided.
  • .colTypes(obj, optional) - overwrite the automatically detected attribute type, types must be one of str, float, date or datetime, e.g. {Subject: 'str'}
  • .run(void) - initialize the app.

Config file

This configuration file sets all the proper options for both the GUI and each of the plot types to be rendered; an example file can be found in js/config.js.

Main (outer level)

  • useToyData - bool, whether to provide use option to select from several toy datasets from the file upload modal in cases where the .data() attribute hasn't been specified. OPTIONAL, default false
  • missing - list, datum to treat as missing from loaded dataset, e.g. 'NA'. OPTIONAL, default "" (empty string)
  • plotTypes - object, the available plot types to provide select for in GUI; object keys are plot type name and must be an available model in NVD3, object values are formatted as an object and specify the configuration for each plot type.

plotTypes

Each of the keys in this entry will populate the plot type select input located in the setup tab of the GUI. The keys for this object defines a particular plot type and must be available as a model in NVD3; the value for an entry in this object is also an object and must have the following entries:

  • allowFacets - bool, whether to allow faceting of data for this plot type - OPTIONAL, default true
  • parseData - TODO
  • label -str, label to use in select option for this plot type; if not provided, plot type key will be used - OPTIONAL
  • axes - list of objects, bind the proper data attribute to the plot's primary axes - REQUIRED
  • options - list of objects, customization options for plot type

axes

Each entry in this list will generate a select input in the setup tab of the GUI and will bind the proper data attribute to the plot's primary axes; must be formatted as an object with the following entries:

  • type - str, the data attribute's data type, either quantitative or ordinal; if not provided, it is assumed any data type will do - OPTIONAL
  • accessor - str, accessor with which to bind data attribute, must be a NVD3 model option for the given plot type - REQUIRED
  • label - str, label to give to axes select; if not provided, accessor value will be used - OPTIONAL
  • skipCheck - bool, when passed as true this accessor won't be checked against the NVD3 model; this is normally set when specifying a parseData function.

options

Each of the items listed in this entry will generate a form input in the options tab of the GUI and is used to set the corresponding option for the given plot type. The items are formatted as objects with the following entries:

  • type - str, the type of form input to render, must be one of select, text and slider - REQUIRED
  • accessor - str, accessor with which to set plot option, must be a NVD3 model option for the given plot type - REQUIRED
  • label - str, label to give to form input; if not provided, accessor value will be used - OPTIONAL
  • help - obj, if provided, a help icon will be rendered next to the form input which serves as a bootstrap popover for provided the user with details regarding the specific option. It uses the same format as the bootstrap popover options, see docs - OPTIONAL
  • domClass str, class to give to input group e.g. col-sm-4
  • required - bool, whether to set the form input as required - OPTIONAL, default false

Along with the entries shown above, each input type has specific options.

select

  • values - array or object, populate the select input with these values; if an object is provided, the keys will set the select labels and the values will set the select values - REQUIRED
  • addOption - array or object, additional option to prepend to select options, formatted similarly to values - OPTIONAL
  • setDefault - str, default value used to set default option - OPTIONAL

toggle

  • options - obj, options for toggle, must have same format as the bootstrap toggle options, see docs - REQUIRED
  • setDefault - bool, default value used to pre-populate text input - OPTIONAL, default false

text

  • setDefault - str, default value used to pre-populate text input - OPTIONAL

slider

  • options - obj, options for slider, must have same format as the noUIslider options, see docs - REQUIRED
  • format - function, if provided, function is used to format the slider value displayed in the input label - OPTIONAL

meowcow's People

Contributors

constantinoschillebeeckx avatar

Watchers

 avatar  avatar  avatar  avatar

meowcow's Issues

add "num" to data tab

especially for data sets that get truncated (...) it might be nice to know how many categorical levels there are.

might want to all say "Type: categorical" instead of str. and for the numbers do "Type: ordinal" "Format: int"

screen shot 2018-01-10 at 4 50 42 pm

title positioning

The issue with this is that, even if there is a large enough margin at the top of the chart, the legend is coded in such a way that it always sticks to the top of the svg
image

Ideally, the legend NVD3 model would be the one that does that positioning (instead of each chart model). Or, each of the chart models will need to be updated.

NOTE: lineChart and scatterChart have a legendPosition option

call render after init loaded

GUI can be initialized through the config; currently can't get the auto-render to generate the plot with config.init to work.

distroplot object constancy

There seems to be an object constancy problem when updating the distrocharts:
screen shot 2017-10-24 at 11 24 54
this is the default render (with central tendency line at mean [should change this to median BTW])
once I update the central tendency to median I get:
screen shot 2017-10-24 at 11 25 18

Top row, second panel, stats change completely ...

generated with this data.

distrubtion plot scatter

The scatter style for distribution plot is not working. I think it's because the False setting of plottype is being parsed as a literal string instead of a bool

pre-populate GUI

finish coding out setGUIvals() function for other input types

distroplot chart doesn't work properly with chart.update()

http://meepmoop.com/tijden_werk/
-> render
colorGroup: none
-> render
swarm
showOnlyOutliers: false
-> render
filter out two rooms
-> render, BUG! (point x pos & object constancy)

http://meepmoop.com/tijden_werk/
-> render
swarm
showOnlyOutliers: false
-> render
filter out two rooms
-> render, BUG! (object constancy)

http://meepmoop.com/tijden_werk/
-> render
colorGroup: none
-> render
filter out Room 208 & Room 452
-> render, BUG (point x pos & object constancy)

distroplot color group

distroplot
x: study
y: terminal wt
-> render
color group: sex id
-> render
show only outliers: false
-> render, bug!

screen shot 2017-12-14 at 10 00 47

init

does not work when colTypes() or ignoreCol() are undefined
screen shot 2017-12-14 at 14 03 39

don't reset dropdown when changing another option

for example, if you choose X & Y first, and then change the plot type, the X & Y choices change, even if the same options are available. should probably cache the chosen options, then set them to the same if available.

improve facet warning

Error message isn't very useful since both row and col are empty; message should be more like: "Columns cannot be empty when specifying col wrap"
screen shot 2018-01-04 at 12 44 33 pm

updates with facets not working

distribution plot
x: studyUID
y: WT_end
row: sexID

render

then change an option like "show only outliers" and the rows won't update properly.

I think this is the same bug as #10

scatter not updating with colorGroups

when you first render a scatter (without colorGroups) and then do an update by adding colorGroups, the chart doesn't update properly.

i've investigated a little bit and it looks like the var data doesn't properly get sent from scatterChart.js to scatter.js

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.