Skip to content

Displaying a specific column from TS  #184

@mavila0896

Description

@mavila0896

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!

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