Skip to content

Polyjs.data Implicit Type Coercion Buggy #6

@jobowoo

Description

@jobowoo

When providing a list of data to polyjs.data without a meta argument the resulting polyjs data object produces strange results even for sane inputs. This causes the data not to be rendered correctly in the resulting chart. Please see the example below.

var d = [{"foo": "Period 1"}]
var polydata = polyjs.data(d)

Expected:

d[0].foo == "Period 1"
polydata.raw[0].foo == "Period 1"

Actual:

d[0].foo == 978336000
polydata.raw[0].foo == 978336000

Once I specify a meta object where the type of foo is cat, the polyjs data object works as expected. While I can see this being a valid workaround, given the benign input, it took me a while to track down. I could see this being a big gotcha for other users. Only one of the examples use the meta field. At the very least, this should be better documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions