Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method for datum transformation in the datasources #142

Open
jorgeyp opened this issue Jan 19, 2017 · 1 comment
Open

Add method for datum transformation in the datasources #142

jorgeyp opened this issue Jan 19, 2017 · 1 comment

Comments

@jorgeyp
Copy link
Collaborator

jorgeyp commented Jan 19, 2017

At this moment Proteic datasources only work with the following data format:

[
  { "date": "01/03", "value": 234, "key": "v1" },
  { "date": "01/03", "value": 532, "key": "v2" },
  { "date": "01/03", "value": 233, "key": "v3" },
  { "date": "02/03", "value": 243, "key": "v1" },
  { "date": "02/03", "value": 531, "key": "v2" },
  { "date": "02/03", "value": 156, "key": "v3" }
]

Having a specific data format for static data is not a big problem, since you can allways apply a transformation to your data. However, with streaming data the library should provide a method to transform the incoming data to the Proteic format. This could be solved passing a transform function to the datasource, that applies the transformation to each datum.

A typical time-series example could be the following:

Incoming data:

[
  {  "date":  "01/03",  "v1": "234", "v2": "532", "v3": "233" },
  {  "date":  "02/03",  "v1": "243", "v2": "531", "v3": "156" }
]

Chart creation applying the transformation function:

new proteic.Linechart([]).ds(ws).apply( (d) => [ 
  { date: d.date, value: d.v1, key: 'v1' },
  { date: d.date, value: d.v2, key: 'v2' },
  { date: d.date, value: d.v3, key: 'v3' }
 ] );
@jorgeyp jorgeyp changed the title Add method for datum transformation to the datasources Add method for datum transformation in the datasources Jan 19, 2017
@0xNacho
Copy link
Collaborator

0xNacho commented Jun 14, 2017

The unpivot() method has already been implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants