Data Columns & Types

A Dataset is made up of Miso.Dataset.Column objects, that each have a name, type and corresponding data. More about the Miso.Dataset.Column type can be found in the API Docs.

By default, unless specified otherwise, Dataset will attempt to detect the column type itself by looking through the first few rows of the data and checking which type it fits under.

Dataset has some prebuild Miso.Dataset.types:
  • number
  • string
  • boolean
  • time

Overriding Detected Types

Dataset will attempt to detect what the type of your data is. However, it is more efficient to just tell it what your column types are and if any of your columns are of a time format, it's important to specify the format the time will be coming in as. To specify the type of a column, set the columns property like so:

columns : [
  { name : 'columnName', 
    type : '',
    … any additional optional type required properties here.

Dataset will take care of the actual type coercion, making it trivial to convert strings to numbers or timestamps to moment objects. For example, coercing an incoming timestamp string column into a time column and the total column to a numeric type would look like so:

You can edit the code in this block and rerun it.

Custom Types

The type system itself can be extended to add new types for your data. The current type set is defined in src/types.js.

To define a new type, the required signature is as follows:

For example, we might define a custom phone type like so:

You can edit the code in this block and rerun it.

« Working with Live Data

Accessing Data »