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

Displaying a specific column from TS #184

Open
mavila0896 opened this issue Mar 3, 2020 · 0 comments
Open

Displaying a specific column from TS #184

mavila0896 opened this issue Mar 3, 2020 · 0 comments

Comments

@mavila0896
Copy link

mavila0896 commented Mar 3, 2020

I am working on something that is able to call a column from the Time Series I created and display it on a table. I have the function ready to do that but its just the column calling.

Here is an example:

(Assume the points were created and data are from a local file/Storage)

const series1 = new TimeSeries ({
            name: 'Fruit Delivery',
            columns: ['time', 'price', 'fruit'], //assume time is the day of delivery
            points: points_fruitd
 });

const series2 = new TimeSeries ({
            name: 'Fruit Inventory',
            columns: ['time', 'fruit', 'unit'], //assume time is the date it was arrived from delivery (basically items placed in inventory)
            points: points_fruitd
 });

When I call in for a table:

<Table style={scrollStyle} aria-label="caption table" size="small">
                        <TableBody>
                            {this.state.selections.map((tr, i) => {
                                return (
                                    <tr key={i} >
                                        <td
                                            onClick={() => this.setState({ selected: i })}
                                            style={{ color: 'black', fontSize: 9.5, fontWeight: 500, maxWidth: 100, overflowX: "hidden", paddingLeft: 7 }}

                                        > <tr>{`${series1.crop(tr)}`} </tr>
                                        </td>

                                        <td
                                            style={{ color: 'black', fontSize: 9.5, fontWeight: 500, maxWidth: 105, overflowX: "hidden", paddingLeft: 7 }}
                                        > <tr>{`${series1.crop(tr)}`} </tr>> 
                                        </td>
                                    </tr>

                                );
                            })}
                        </TableBody>

                    </Table>

It will display the time in ms (which I want to be in date format) and the columns name.
Example:

{"name":"Fruit Delivery","utc":true,"columns":["time"],"points":[[1121504241, 5.23, (*) ]]} and etc...

2 questions:

  1. How would I aoid that specific output and have one of the ts function call the column per say:
    .columns('price') -> it will display the price based on the time seires for that date or time.

Example of output: 5.23, 1.25, 3.00, 2.50, etc...

  1. I want to display a string based on the price, since fruit time and price are in sync I want to be able ti display the fruit as well, How would I do that since i tried that and it threw either null or error.

Thanks!

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

No branches or pull requests

1 participant